Need Help with a ServiceNow Business Rule

Olga -Maria
Tera Contributor

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 : 

(function executeRule(current, previous /*null when async*/ ) {


current.ci_item.warranty_expiration = new GlideDateTime(current.contract.ends.getValue());

1 ACCEPTED SOLUTION

@Olga -Maria 

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();
}
Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

@Olga -Maria 

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();
}
Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader