- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2021 10:23 PM
Getting this error when I try to run a business rule which is in the same scope. Tried to use the same solution as this: https://community.servicenow.com/community?id=community_question&sys_id=288b72681b8068106531ea89bd4bcbe3 but the scopes are different so I'm not sure what changes to make
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 12:29 AM
alert at line 12 won't work as alert() is used in client side, so remove that
also you should set the value again at line 14
current.other_ioc = cur_ioc;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 01:18 AM
Apologies Ankur , the alert() function was the error. Removing it has fixed it.
The script is working for new additions but doesnt work for previously existing ones.
Any fix to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 01:50 AM
Glad to know that my comment helped.
For older records you need to write fix script
(function(){
try{
var gr = new GlideRecord("table name"); // your table name here
gr.addEncodedQuery("other_iocISNOTEMPTY");
gr.query();
while(gr.next()) {
var cur_ioc = gr.other_ioc;
// your code for replacement here
gr.other_ioc = cur_ioc;
gr.setWorkflow(false);
gr.update();
}
}
catch(ex){
gs.info(ex);
}
})();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader