- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 06:24 AM
Hi Team,
I need to check the short description that as keyword SAP standalone in if condition of flow designer but we don't have script toggle. How we can achieve this.
I have script but not sure how to apply in if condition of flow
(function executeRule(current) {
var desc = current.short_description + ' '; // Ensure it's a string
// check for 'SAP' as a full word (case-insensitive)
if (/\bSAP\b/i.test(desc)) {
var groupName = gs.getProperty('incident.assignment.group');
current.assignment_group= groupName;
return true;
}
return false;
})(current);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 06:44 AM
Hi,
That's correct, you cannot do a scripted condition in an IF-statement.
As a workaround, you can store the boolean option in a Flow variable (of type true/false), and evaluate it instead.
When setting the flow flow variable, you can enable scripting, and set the value to true or false, depending on the contents of your short description.
See attached example below.
Script for reference.
var incidentShortDesc = fd_data.trigger.current.short_description.toString().toLowerCase();
if (incidentShortDesc.indexOf('sap') > -1){
return true;
}
else{
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 11:04 PM
you can use a flow variable and then use it in IF logic
Approach shared by @OlaN should work for you
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 06:44 AM
Hi,
That's correct, you cannot do a scripted condition in an IF-statement.
As a workaround, you can store the boolean option in a Flow variable (of type true/false), and evaluate it instead.
When setting the flow flow variable, you can enable scripting, and set the value to true or false, depending on the contents of your short description.
See attached example below.
Script for reference.
var incidentShortDesc = fd_data.trigger.current.short_description.toString().toLowerCase();
if (incidentShortDesc.indexOf('sap') > -1){
return true;
}
else{
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 11:04 PM
you can use a flow variable and then use it in IF logic
Approach shared by @OlaN should work for you
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 12:51 AM
This step allows you to verify whether a specific keyword or phrase exists within a text variable, such as a user's message or a case description of N7. By using functions like CONTAINS() or FIND(), you can direct the flow down different paths based on the presence or absence of targeted words. This is particularly useful in customer support flows, chatbot responses, or categorizing cases based on user input. Properly implementing keyword checks enhances flow efficiency and ensures users receive contextually accurate responses.