Flow Designer Trigger – "Created or Updated" as an Alternative to a BR with Insert & Update Checked
New article articles in ServiceNow Community
·
Jul 03, 2025
·
article
Handling separate actions for "Create" and "Update" operations using the Flow Designer trigger "Record is Created or Updated":
This approach can be used as an alternative to current.operation() when a Business Rule has both "Insert" and "Update" options selected.
Sample Use Case: Create a problem record when an incident is created and update the work notes of the same problem record when incident is updated
Business Rule Approach :
- Table: Incident
- When: After
- Insert: ✅
- Update: ✅
if (current.operation() == 'insert') { // Create Problem record var problemGr = new GlideRecord('problem'); problemGr.initialize(); problemGr.short_description = 'Auto-created from Incident: ' + current.number; problemGr.description = current.description; problemGr.correlation_id = current.getValue("number"); problemGr.insert(); current.problem_id = problemGr.sys_id; } else if (current.operation() == 'update' && current.problem_id) { // Update work notes on the related Problem var linkedProblem = new GlideRecord('problem'); if (linkedProblem.get(current.problem_id)) { linkedProblem.work_notes = 'Incident ' + current.number + ' was updated.'; linkedProblem.update(); } }
Flow Approach :
We’ll be leveraging the sysmodcount field—labeled as "Updates"—to determine whether the operation is an insert or an update.
If sysmodcount = 0, it indicates the record is being inserted (created).
If sysmodcount > 0, it signifies the record is being updated.
Identifying the "Insert/Create" Operation & executing the activities:
Identifying the "Update" Operation & executing the activities:
Thanks & Regards,
Subham Kumar Shaw
ServiceNow Architect/Consultant
ServiceNow Community Rising Star ' 2022/2023/2024
https://www.servicenow.com/community/developer-blog/flow-designer-trigger-quot-created-or-updated-quot-as-an/ba-p/3308388