- 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 02:42 PM
Hey,
You may try running it into the table scope which is 'sn_customerservice'.
Change your scope of fix script or create a fix script in 'sn_customerservice' scope.
Why because the fix script you are running on table is from different scope and your fix script or you are in a different scope. That's why query BR written for that table is not getting disabled by setWorkflow(false)
Hope this helps!
Regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 02:46 PM
I ran in Customer Service and Global scope but gives me the same error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 02:52 PM
Can you try with below script in Customer Service Scope?
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 03:53 PM
Thanks. I see the change which you had made.
It ran but it is fetching only one account's registration code and pasting in all the Case's Short Description. Looping is not refreshing(means from 2nd record onwards) it is not taking new Account's Registration Code.
Thoughts?