Step 4: Running an Inline Function
So far, we haven't done anything here, even if the fraud check fails. How can we handle the case where the fraud check returned a fail, and we want to skip processing the deposit transaction? We can add another inline task that can check for the outcome of the fraud check and send a different message to our users via SMS or Email.
- UI
- In your current workflow, add an Inline task after the switch case.
- Add another switch case to process the deposit only if the fraud check passes.
- Add an inline to compose the correct message for users.
- Pass the message as input to the send-message tasks.
- Run workflow.
tip
INLINE task is a great tool for writing basic logic, such as a predicate condition or object data transforms. With JavaScript, you can write complex actions that will be executed by Conductor without having to find a place to host and run this worker.
INLINE tasks can be scripted from the following template:
(function() {
// Your code here
// Variables for this function needs to be explicitly added as inputs and once added you can
// refer to them using the $.<variable-name> notation.
return $.amount > 10000;
})();
Read more on INLINE tasks here.