How can I determine the source of a new record in ServiceNow?

NicolasNguyen
Giga Contributor

I am working with a Client Script on the incident table. When creating a new record, I want to know if this record is linked to or getting data from another table (for example, request or task). Is there a way to check in a Client Script or via a background script whether this new record was created from another table, or if it has any reference fields linked to another table?

If anyone has experience, please share how to check the source of a new record in ServiceNow! Thank you!

3 REPLIES 3

M Iftikhar
Mega Sage

Hi @NicolasNguyen , If incident is created from change/problem, you can see it in incident list via caused_by_change/problem field.

MIftikhar_0-1757582555754.png

 

The source record is usually stored in a reference field, or a custom field (depending on the implementation).
→ In a Client Script, you can check if these fields are populated on form load (for example: g_form.getValue('problem')). If populated, it means the Incident is linked to another table.

 

If data is being copied into the Incident during creation, there will often be a business rule, flow, or transform map that sets description/short description fields with text like “Created from Change ” or copies data from the source record.

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Bhuvan
Mega Patron

@NicolasNguyen 

 

You can look up for fields that are reference to another table for example caused_by, problem_id or any custom field you have to track the related table. This will give details of incident relation to Change, Problem and related table source information

 

You can also use origin_id, origin_table to track the source of incident. Typically, Change can be a source for creating incident or event management [event -> alert -> incident]. Depending on your scope, you can expand this logic

Bhuvan_0-1757584911206.png

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan

@NicolasNguyen 

 

Did you get a chance to review this ?

 

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan