- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 02:11 PM
ServiceNow Experts,
I have written a below Fix Script in my PDI to test out some functionality:
___________________________________
var accRegCode;
var strShorDesc;
var strAccountName;
var grAcct = new GlideRecord('customer_account');
var grCase = new GlideRecord('sn_customerservice_case');
// grAcct.orderByDesc('sys_updated_on');
grAcct.query();
while(grAcct.next()){
strAccountName = grAcct.getDisplayValue('name');
accRegCode = grAcct.getDisplayValue('registration_code');
grCase.setWorkflow(false);
grCase.addQuery('account', strAccountName);
grCase.query();
while(grCase.next()){
strShorDesc = grCase.getDisplayValue('short_description');
grCase.setValue('short_description', strShorDesc+' : '+accRegCode);
grCase.setWorkflow(false);
grCase.update();
}
}
_________________
I am getting below error when I go to Progress worker:
Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
Any thoughts?
Thanks,
MK
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2022 06:34 AM
Here's the solution:
___________________
var accRegCode='';
var strShorDesc='';
var strAccountName='';
var grAcct = new GlideRecord('customer_account');
// grAcct.orderByDesc('sys_updated_on');
grAcct.query();
while(grAcct.next()){
var grCase = new GlideRecord('sn_customerservice_case');
strAccountName = grAcct.getDisplayValue('sys_id')+'';
accRegCode = grAcct.getDisplayValue('registration_code')+'';
grCase.addQuery('account', strAccountName);
grCase.query();
while(grCase.next()){
strShorDesc = grCase.getDisplayValue('short_description');
grCase.setValue('short_description', strShorDesc+' : '+accRegCode);
grCase.setWorkflow(false);
grCase.update();
}
}
______________________________
I have to use sys_id for querying at the Case table. Attached screenshot.
Thanks for all you help.
MK

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 03:58 PM - edited ‎12-22-2022 03:58 PM
Dont see any issue with the script. Can you try below?
var accRegCode='';
var strShorDesc='';
var strAccountName='';
var grAcct = new GlideRecord('customer_account');
// grAcct.orderByDesc('sys_updated_on');
grAcct.query();
while(grAcct.next()){
var grCase = new GlideRecord('sn_customerservice_case');
strAccountName = grAcct.getDisplayValue('name')+'';
accRegCode = grAcct.getDisplayValue('registration_code')+'';
grCase.addQuery('account', strAccountName);
grCase.query();
while(grCase.next()){
strShorDesc = grCase.getDisplayValue('short_description');
grCase.setValue('short_description', strShorDesc+' : '+accRegCode);
grCase.setWorkflow(false);
grCase.update();
}
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 04:09 PM
I agree with you. I ran it a few time. I did try the code the other way but same result. Find below the screenshot after running the above script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2022 06:34 AM
Here's the solution:
___________________
var accRegCode='';
var strShorDesc='';
var strAccountName='';
var grAcct = new GlideRecord('customer_account');
// grAcct.orderByDesc('sys_updated_on');
grAcct.query();
while(grAcct.next()){
var grCase = new GlideRecord('sn_customerservice_case');
strAccountName = grAcct.getDisplayValue('sys_id')+'';
accRegCode = grAcct.getDisplayValue('registration_code')+'';
grCase.addQuery('account', strAccountName);
grCase.query();
while(grCase.next()){
strShorDesc = grCase.getDisplayValue('short_description');
grCase.setValue('short_description', strShorDesc+' : '+accRegCode);
grCase.setWorkflow(false);
grCase.update();
}
}
______________________________
I have to use sys_id for querying at the Case table. Attached screenshot.
Thanks for all you help.
MK

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2022 09:42 AM
WOW. Thank you for answering the question.
Please mark this response as correct or helpful if it assisted you with your question.