Flow designer

kali
Tera Contributor

Hi All,

I created a flow with trigger conditions such as that whenever additional comment changes then a new hr case should be created. But i want to call the flow by using the ui action only , even if the trigger conditions satisfy it should not create a HR case .Is this possible.

 

Thanks in advance

4 REPLIES 4

Sohail Khilji
Kilo Patron
Kilo Patron

This is strange... there can be numerous comments changing and why do you need to create case on every comment change? whats the business requirement can you explain ?


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

LinkedIn - Lets Connect

Hi @Sohail Khilji , 

Only after the case is closed complete if a additional comment is inserted then a new case should be created

can you explain ?

SohailKhilji_0-1711622136368.png

 

You can create a business rule or a Flow which start or trigger conditon as if state is closed complete and additional comments changes.

 

if so, user create record action to create a record and you can do the lookup of old record to copy its existing values. (Why dont you re-open the same case rather creating a new case) ?

 

Were are you struck, did start with anything ?


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

LinkedIn - Lets Connect

Sandeep Rajput
Tera Patron
Tera Patron

@kali In this case you should create a sub-flow instead of the flow and trigger the sub-flow via UI Action script. Here is an example on how you can trigger a subflow via script.

 

Screenshot 2024-03-28 at 4.03.15 PM.png

 

Here is the script which can be used for this purpose.

 

(function() {
	
	try {

		// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
		// sn_fd.FlowAPI.getRunner().subflow('sn_hr_core.<Provide name of subflow>).inBackground().run(); //Name of the subflow
				
		// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
		var result = sn_fd.FlowAPI.getRunner().subflow('sn_hr_core.<Provide name of subflow>).inForeground().run();
		var outputs = result.getOutputs();

		// Current subflow has no outputs defined.		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}
	
})();

Please refer to https://developer.servicenow.com/dev.do#!/learn/learning-plans/utah/servicenow_application_developer... for more information.