- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Everyone
I have requirement when Sc_task's work note updated and if it contains the text ' file creation failed' need to create the incident using flow designer.
I tried it but its not working as expected can you please help me on that and have look at below screen shot.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
do this as alternative and it should work fine for you
1) create flow variable of type True/False
2) then use Set Flow Variables flow logic to set that flow variable based on matching condition
3) then use that Flow variable in your IF logic
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
3 weeks ago - last edited 3 weeks ago
To implement your requirement, here are the detailed steps to create a flow that triggers when a worknote containing "file creation failed" is added to a Catalog Task.
1. Create a Flow with the Following Trigger:
Trigger: Updated
Table: Journal Entry [sys_journal_field]
Condition:
Name is sc_task
Element is work_notes
Value contains file creation failed
This will ensure that the flow triggers whenever someone posts a worknote on a Catalog Task containing the text "file creation failed".
2. Add the Following Steps:
Step 1: Lookup Record Action
Add an action to Lookup Record in the Catalog Task Table (sc_task).
Set the filter condition:
Sys ID = Trigger - Record Updated > Journal Entry Record > Element ID
Item = {SELECT YOUR REQUIRED CATALOG ITEM}
- Set Don't fail on error as checked
This step will fetch the Catalog Task record associated with the worknote, but only if it's for the desired catalog item.
Step 2: Add an IF Flow Logic
Add an IF flow logic to check if the record exists.
This ensures that an Incident will only be created for the Catalog Task associated with the specified catalog item when the worknote contains "file creation failed"
Step 3: Create Record on Incident Table
Under the IF condition, add the action "Create Record" on the Incident table.
This action will create a new Incident record based on the conditions you’ve set.
Successful Execution Screenshot
Here’s a screenshot of the flow successful execution:
Positive case:
Negative Case: when the catalog item was not the selected one
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
First ensure the string entered in the condition exactly matches what is typed into the work note in your test case (case-sensitive).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Vinod S Patil,
Try this:
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@M Iftikhar
I need to put the condition only for one catalog item, any suggest please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
work_notes field type is sys_journal_field, and there is special about on sys_journal_field, the contains operator won't work, please read the details below.
- Use the sys_journal_field table.
- Query for the specific element_id (the sys_id of the record with the journal entries) and the name of the field (e.g., comments).
- Then, you can check if the value field of the journal entry contains your desired text.
var gr = new GlideRecord('sys_journal_field'); gr.addQuery('element_id', current.sys_id); //
Or the sys_id of the record you are working on
gr.addQuery('element', 'comments');
// Or 'work_notes'gr.addQuery('value', 'CONTAINS', 'Your Search Term');
// Apply the contains operator heregr.query();if (gr.next()) { // A matching entry was found}
work notes is type of Journal Entry [sys_journal_field] and the contains operator won't work with the this type of field, you need to use the conditions I have sent. The contains operator though available but won't work with Journal entry type field.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
