
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 04:22 AM
Hello All,
I have one requirement related to SLA. In which I have to add 1 'AND' condition in the SLAs. Since there are 200 SLAs, that is why I did not want to add this condition manually. So, I want to write a fix script or an On Demand schedule job to update those SLAs.
Can anyone have this kind of script with you. If yes then please share that script with me
Thanks..
Regards,
Gaurav
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 05:47 AM
Replace
gr.start_condition = startCond + ' .and. ' + 'Symptom = Error'
With:
gr.start_condition=gr.start_condition.replace(/\^EQ/,'')
gr.start_condition+='^u_sympton=error^EQ'
Make sure you replace u_sympton with the system name of your Sympton field and the correct value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 05:04 AM
Can anyone have this kind of script with you. If yes then please share that script with me
Sounds like a simple GlideRecord script, followed by a loop to add a specific condition. How far have you got with writing it?
Since there are 200 SLAs, that is why I did not want to add this condition manually.
I wouldn't want to, either.... but I'd question why there are so many SLAs. Do you have 200 OLAs underpinning them also? This feels like someone's not properly understood Service Level Management as a process.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 05:19 AM
I have tried to write as below but this does not works.
var query = 'collection=incident^active=true^type=SLA^u_sla_type=Response';
var gr = new GlideRecord('contract_sla');
gr.addEncodedQuery(query);
gr.query();
var rows = gr.getRowCount();
gs.info(rows);
while(gr.next())
{
var startCond = gr.start_condition;
gr.start_condition = startCond + ' .and. ' + 'Symptom = Error'
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 05:36 AM
but this does not works.
That's a pretty vague problem definition. How do you know it doesn't work? What are your test cases? How did expected results differ from actual? What logging have you implemented, and what do those logs show?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 05:47 AM
Replace
gr.start_condition = startCond + ' .and. ' + 'Symptom = Error'
With:
gr.start_condition=gr.start_condition.replace(/\^EQ/,'')
gr.start_condition+='^u_sympton=error^EQ'
Make sure you replace u_sympton with the system name of your Sympton field and the correct value