Dynamically execute a Flow for Sla Trigger

Kavya16
Tera Expert

Dear All,

I need to dynamically trigger a flow for sla, without updating the flow field in sla , since these sla's are used by different regions I need to trigger the flow , ITried to trigger the flow from business rule with no luck. Please help.

find_real_file.png

find_real_file.png

 

Thanks & Regards,

Kavya

2 REPLIES 2

Jorn van Beek
Tera Guru

If you want run flows from script you should look at the scriptableFlowRunner api. see:

https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server/sn_fd-namespace/ScriptableFl...

However. Thinking at your requirement.

You could also just create multiple different SLA records for 1 for each region and ensure the trigger conditions are so the right on is triggered. This has major benefits like:

  • Staying within OOTB logic, no customization needed (with all the upgrade and test things issues)
  • Visibility, on the SLA triggered you can directly see which SLA has been triggered, including flow. It is not hidden in the 'black box' part.
  • It will also work when SLA is changed. for example if prio or region so is changed. With your br solution you will run into issues af.

 

Hi Jorn,

I tried to write a script for task sla table, but its accepting the inputs if i provide the sys_id..Please help. It says input is invalid.Please help, trigger of my flow is task sla.

var inputs = {};
inputs['sys_id'] = '23f306c4dbc7c1d0f328a05605961910';
var result = sn_fd.FlowAPI.getRunner() 
.flow('global.test123')
.inBackground() 
.withInputs(inputs)
.run(); // 

var contextId = result.getContextId();
gs.info(contextId);