- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 09:48 AM
Hello Implement,
When the assignee is changed on a project task the project short description was changed
on several projects.
In the System Log Statements an entry with Message
'Project found - OPS0000137 Test 140703 10:00 Ops Project: OPS0000151 - PArent SCHEDULE - 8-5 weekdays excluding holidays'
was found that has not previously appeared during testing. It is sumised that the change and the message in
log was written by a business rule.
After searching several of the 952 businesss rules in our instance a method for searching the text in business rules
was found
Search for Text in Business Rules - ServiceNow Wiki
Substituted the string 'PArent SCHEDULE' as shown in code below
Got
Javascript compiler exception: missing ) after condition (; line 10) in:
Not sure what is causing the error
Thanks
Allen Pitts
LHP Hospital Group
+++++++++++++++++beginning of code++++++++++++++++++
findit('PArent SCHEDULE');
function findit(str) {
var scr = "";
var gr1 = new GlideRecord('sys_script');
gr1.query();
while (gr1.next()) {
scr = gr1.script.toString();
if (scr.indexOf(str) > -1) {
gs.addInfoMessage(gr1.name);
}
}
}
+++++++++++++++++end of code++++++++++++++++++
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 10:12 AM
Hi Allen,
Don't think there is anything wrong with the function as such.
Also you can find the business rule using the breadcrumbs in the list layout.
Thanks,
Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 10:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 10:18 AM
Hi Allen,
I have tired the same script in my instance and its working fine.. and as suggested by Mandar, you can find the business rule using filters.
Please mark answer as correct/helpful, if it was really helpful.
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 11:15 AM
Hello Solutioner,
Could you please copy
the code you ran so I can
try it in my instance.
Thanks
Allen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2014 12:21 AM
Hello Allen,
I tired below code:
findit('PArent SCHEDULE');
function findit(str) {
var scr = "";
var gr1 = new GlideRecord('sys_script');
gr1.query();
while (gr1.next()) {
scr = gr1.script.toString();
if (scr.indexOf(str) > -1) {
gs.addInfoMessage(gr1.name);
}
}
}
Just FYI, if you see code in wiki you can see below line
if (scr.indexOf(str) > -1) { -- Because of this line you are getting issue.
Above mention code will work
Please mark answer as correct/helpful, if it was really helpful.
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/