How can you see whether a record has child records

MBarrott
Mega Sage

Currently using an onSubmit client script to check if certain values have been populated. 

 

I would like to omit this check if the record in question has child records related to it. Specifically, child project tasks related to a parent project task (pm_project_task)

 

Is there a best practice method of doing this?

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@MBarrott You can use a GlideAjax + Script Include to check if the current task has child project tasks. You can refer to https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/client/c_GlideAjaxAPI to know more about it.

Bert_c1
Kilo Patron

Create a GlideAjax script include to be called from your client script that queries the table for <parent> = <sys_id of the record>.  See examples in your instance, search with 'script', 'contains', "GlideAjax".

Sumanth16
Kilo Patron

Hi @MBarrott , 

 

Please refer to below thread:

https://www.servicenow.com/community/developer-forum/function-to-find-records-without-children-recor...

 

Plz mark my solution as Accept, If you find it helpful.

 

Thanks & Regards,

Sumanth Meda