Calculate Records from Related List to Add to Field on Incident Table

Zo2
Tera Contributor

Hi All,

I am trying to "Calculate records from a related List to add to field on the incident table".

I imagine it would be a client script as i would need for it to update onLoad and onChange.

Im not too sure how i would write the script but think I should use the GlideAggregate function.

Your help/guidance is much appreciated

1 ACCEPTED SOLUTION

Hi,

So u_related_incident field stores the incident details.

Is it a string field or reference field ?

1) if it is string field then use this query along with other

gr.addQuery('u_related_incident',current.number);

2) if it is reference field then use this query along with other

gr.addQuery('u_related_incident',current.sys_id);

then it would give the count of new call records for this current incident and store that count in the count field

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

View solution in original post

12 REPLIES 12

This is the related list

find_real_file.png

This is it within the incident form

 

find_real_file.png

 

but this is the row count it shows even after adding the extra query

 

find_real_file.png

Seems like there is still something wrong....thanks for taking the time to help

Hi,

So u_related_incident field stores the incident details.

Is it a string field or reference field ?

1) if it is string field then use this query along with other

gr.addQuery('u_related_incident',current.number);

2) if it is reference field then use this query along with other

gr.addQuery('u_related_incident',current.sys_id);

then it would give the count of new call records for this current incident and store that count in the count field

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

Thank you so much Ankur you have been a great help. It is really appreciated