Priority update from Integration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 02:04 AM
Hi,
I have a requirement in incident table where if the integration is sending us a priority 1 or 2 it should be set as 3, have achieved it through transform map, However if they send a priority 3/4 and our user has set it at priority 1/2 it should not change, could someone please help me with how can i achieve this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 02:21 AM
in your transform map check the target field value
if it is 1 or 2 then don't update
Don't set field map for this, handle this via onBefore transform script
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(target.priority.toString() == '1' || target.priority.toString() == '2'){
// don't do anything
}
else if(source.u_priority == '1' || source.u_priority == '2'){
target.priority = 3;
}
})(source, map, log, target);
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
02-03-2025 02:51 AM
Hello @AbidJafrey
If your user is changing Priority over the record once it has come in from integration then you can write a before update BR to check the source of creation of ticket and see if it has correlation id for integration which is usually used for mapping and on basis of it if old value was p3/p4 and changing to p1or p2 then restrict the update with error message cannot change the priority.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.