How to trigger Flow Designer after a specific field on a Requested Item record is updated?

Smith Johnson
Tera Guru

Hello,

I would like to trigger a flow on Flow Designer, after a specific field on a RITM is updated.

I checked the available triggers on Flow Designer, but there is not one for updated records on sc_req_item table.

SmithJohnson_0-1677772654581.png

How could I set up a trigger for my use case?
It needs to satisfy the following:
field "X" updated on a record of the "sc_req_item" table

Thank you in advance for you ideas,
Smith.

 

1 ACCEPTED SOLUTION

Unfortunately, what you mentioned does not work in my case, since the Catalog Item itself is bound to a workflow. This means that when the Item is requested, the workflow is triggered. But in any case thank you so much for your time and your ideas 🙂

However, I found the solution. I put it here in case someone needs it in the future.

The solution was to create a BR on the sc_req_item table with conditions to run for the specific catalog item and when the value of the field "X" changes. Then in the script, I used the following code:

 (function() {

        try {
            var inputs = {};
            inputs['table_name'] = 'sc_req_item';
            inputs['request_item'] = current; 

            // Start Asynchronously: Uncomment to run in background.
            sn_fd.FlowAPI.getRunner().flow('global.test').inBackground().withInputs(inputs).run();

            // Execute Synchronously: Run in foreground.
            //sn_fd.FlowAPI.getRunner().flow('global.test').inForeground().withInputs(inputs).run();

        } catch (ex) {
            var message = ex.getMessage();
            gs.error(message);
        }

    })();

 
Where "global.test" is my flow that created in the Flow Designer. This flow has as trigger "Service Catalog".

View solution in original post

5 REPLIES 5

priyasunku
Kilo Sage

Hi @Smith Johnson 

 

You need to create a flow designer with  trigger as servcie catalog 

 

and then add a if condition saying state is inprogress for example to execute your actions.

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

Hello @priyasunku ,

 

as shown below, I can't put conditions on the trigger.

SmithJohnson_0-1677830565040.png

I think the service catalog trigger is activated when a new RITM is created.

SmithJohnson_1-1677830683035.png


However, what I want to achieve is to trigger a flow when a specific field (name it "X") is changed in a requested item.

Any further ideas?

@Smith Johnson 

 

First inorder to create a RITM you need flow designer to be written on Service catalog

 

1. select trigger as service catalog

2. 'Get variables' action

3. you can create if condition and check if RITM state is inprogress for example

 

priyasunku_0-1677831310009.pngpriyasunku_1-1677831328993.png

 

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

Unfortunately, what you mentioned does not work in my case, since the Catalog Item itself is bound to a workflow. This means that when the Item is requested, the workflow is triggered. But in any case thank you so much for your time and your ideas 🙂

However, I found the solution. I put it here in case someone needs it in the future.

The solution was to create a BR on the sc_req_item table with conditions to run for the specific catalog item and when the value of the field "X" changes. Then in the script, I used the following code:

 (function() {

        try {
            var inputs = {};
            inputs['table_name'] = 'sc_req_item';
            inputs['request_item'] = current; 

            // Start Asynchronously: Uncomment to run in background.
            sn_fd.FlowAPI.getRunner().flow('global.test').inBackground().withInputs(inputs).run();

            // Execute Synchronously: Run in foreground.
            //sn_fd.FlowAPI.getRunner().flow('global.test').inForeground().withInputs(inputs).run();

        } catch (ex) {
            var message = ex.getMessage();
            gs.error(message);
        }

    })();

 
Where "global.test" is my flow that created in the Flow Designer. This flow has as trigger "Service Catalog".