How to get all parent services recursively using script?

Ksnow
Tera Contributor

Hi All,

I am looking for a recursive script to get all the parent business services, here is my requirement there is sla definition on the business services, when we select that business services on incident form that particular sla will get attached to the incident. In the same way for one business service there will be parent services and child services.

Lets assume there are business services as Test, test-1, test-2, test-3, test-4. Where Test is parent for test-1 and test-1 is parent for test-2 and test-2 is parent for test-3 and test-3 is parent for test-4. If I am taking test-4 (doesn't have sla) business service in incident form, script has to check whether the parent test-3 has sla or not, if yes attach that sla to the incident, if not check for test-2...go on until 1st parent level(that is Test) irrespective of the levels it should check it could be 5 or 10 levels.

How can we do that?

Please assist.

Thanks,

K

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check following links and it should help you:

https://community.servicenow.com/community?id=community_question&sys_id=bf44047cdb98a308a39a0b55ca96...

https://community.servicenow.com/community?id=community_question&sys_id=caa14b69db98dbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=d34b8321db9cdbc01dcaf3231f96...

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ksnow 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ksnow 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader