How to call flow for next step from UI action?

lucky24
Tera Contributor

Hi Team,

We have one catalog item in which we are creating task so after closed all task I don't want close RITM, I have to put in another stage likes "waiting request"and have to set awaiting requester and I have to create one UI action which will only visible for request manager once manger click on this UI action then I have to move RITM in next stage "Requested" and need to call flow and create new task 

 

How can we call flow from UI action and have to create new task??

1 REPLY 1

Sohail Khilji
Kilo Patron
Kilo Patron

You can use the below code to trigger the flow from UI action:

 

Once all your task are completed you need to use set value activity to set the RITM stage to 'waiting request', The UI action must be visible on the condition if stage is 'waiting request'. One click of UI action your flow will be called and flow will be executed.

function triggerFlowFromUIAction() {

  var flowName = 'Your_Flow_Name';

  // Define the data input for the flow (if required)
  var inputData = {
    'key1': 'value1',
    'key2': 'value2'
  };

  var flowAction = new GlideFlowAction(flowName);
  flowAction.setInputData(inputData);
  flowAction.startFlow(function(response) {
    if (response.isSuccess()) {
      gs.info('Flow executed successfully.');
    } else {
      gs.error('Flow execution failed: ' + response.getErrorMessage());
    }
  });
}

 

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect