- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 06:06 AM
I have a ServiceNow business rule that is supposed to set the "warranty_expiration" field of a CMDB CI item based on the end date of a related contract. The script runs without errors, and I can see the log entries indicating that it should be updating the field.
However, the field is not being updated as expected.
I've double-checked the script, field and table names, permissions, and conditions, but I can't figure out why it's not working.
Could someone please help me troubleshoot this issue and provide suggestions on what might be going wrong? Thank you in advance!
Business rule runs on Insert and Update :
current.ci_item.warranty_expiration = new GlideDateTime(current.contract.ends.getValue());
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 08:27 PM
when is the BR running?
you are not using the script I shared above
var rec = new GlideRecord('cmdb_ci');
if(rec.get(current.ci_item)){
rec.warranty_expiration = new GlideDateTime(current.contract.ends);
rec.update();
}
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 06:12 AM
you cannot set dot walk field
you need to query and then update
var rec = new GlideRecord('cmdb_ci');
if(rec.get(current.ci_item)){
rec.warranty_expiration = new GlideDateTime(current.contract.ends);
rec.update();
}
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
‎10-16-2023 06:39 AM
@Ankur Bawiskar
The Business Rule works on the Contract CI table, an m2m table for cmdb_ci and contracts. Does this make a difference? Because it does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 06:45 AM
please ensure you are using correct fields.
Please share the field names and BR screenshot
Did you debug it?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 09:30 AM