- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 02:53 AM - edited 01-28-2025 02:57 AM
hello dear community,
im trying to create a BR which will trigger when the start or end date of a change changes.
It then should fill the start and/or end date of the related change task(s).
It seemed at first like a quick fix but for some reason the BR wont trigger. I have tried to use a script and the script debugger but although i trigger it, the BR isnt running. I have tried to change the order and the "when" but nothing seems to help.
Its the same in my PDI, i think there is something i miss.
For help and suggestions i will be very grateful,
Solved! Go to Solution.
- Labels:
-
Data Foundations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 04:18 AM
you can use flow or you can use after update BR on change_request table
Condition: Start Date Changes OR End Date Changes
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("change_task");
gr.addQuery("change_request", current.getUniqueValue());
gr.query();
while (gr.next()) {
gr.planned_start_date = current.start_date;
gr.planned_end_date = current.end_date;
gr.update();
}
})(current, previous);
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
01-28-2025 03:13 AM
Your trigger is on the wrong table. You need to trigger it from the chang table itself, not dotwalking to it.
Then you can do a query to the change task and update the fields.
You could also do this through a flow, which will eliminate the need for a script. You can just do a lookup and drag and drop the fields.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 04:04 AM
thank you for your answer. i have created a flow now with the "look up records". but it wont find any records to update. My approach was: look up records (CTASKS) - change_request is same as "number" field in the trigger. Did i apply it wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 04:09 AM
this is the output of the test.
Thank you in advance for your help,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 04:16 AM
in the Lookup you should select the sysId and not change number for the Trigger
Change Request field on Change task is a reference field
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