You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some workflows depend on particular info being available in the context. In other words, they may depend on some previous step having been run already.
For example, CreateTransferFromMainAccountToCustomer requires context.account to be set, but this is only set when the GetAccountData workflow is run.
I propose adding a prerequisites parameter to workflows, like so:
varhelpers=require("../lib/helpers.js");module.exports.description="Creates a balance sourced transfer to a customer.";module.exports.nextSteps=[];module.exports.prerequisites=['GetAccountData'];// looky heremodule.exports.steps=[{endpoint : "transfers",method : "post",model : "CreateBalanceSourcedTransferFromMainAccountToCustomer",extractor : function(response,context){context.transfer={};context.transfer.id=response.headers['location'].split('/')[4];}}];
So, we can either have prerequisites be other Workflows, or we can have prerequisites be particular keynames of context which we'd check to make sure they aren't undefined.
The text was updated successfully, but these errors were encountered:
I've been thinking about this too - and this is a good approach, but I'm not sure its what we should use - because other routes may fulfill the prerequisite or multiple separate routes may be prerequisites.
Instead I think it would be more exact to specify which properties need to be set, and specify for each workflow what properties are set.
Some workflows depend on particular info being available in the
context
. In other words, they may depend on some previous step having been run already.For example,
CreateTransferFromMainAccountToCustomer
requirescontext.account
to be set, but this is only set when theGetAccountData
workflow is run.I propose adding a
prerequisites
parameter to workflows, like so:So, we can either have prerequisites be other Workflows, or we can have prerequisites be particular keynames of
context
which we'd check to make sure they aren'tundefined
.The text was updated successfully, but these errors were encountered: