Skip to main content

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.

  1. In your current workflow, add an Inline task after the switch case.
  2. Add another switch case to process the deposit only if the fraud check passes.
  3. Add an inline to compose the correct message for users.
  4. Pass the message as input to the send-message tasks.
  5. 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.