Issue in the business rule

PritikaA
Tera Contributor

We are loading data into ServiceNow using a Transform Map. Each record includes a Plugin ID, and multiple records may share the same Plugin ID. Based on this, we need to establish a parent-child relationship among incidents:

  • The first record (based on opened_at) should be treated as the parent incident.
  • All other records with the same Plugin ID should be linked to this parent as child incidents.

The initial setup for this logic is complete, and the parent-child relationship is being successfully created.

The remaining requirement is to ensure that the parent incident’s short description is updated to distinguish it from the child incidents.

To support this:

  • We’ve created a custom field and are validating it in the Transform Map field script.
  • If the field is empty, we assign a default correlation ID (e.g., 1234).
  • A Business Rule has been implemented to handle the parent-child logic, as shown in the attached script.

PritikaA_0-1757600313221.pngPritikaA_1-1757600356694.pngPritikaA_2-1757600440153.png

 

4 REPLIES 4

Prithvi Ramesh1
Mega Sage

Is the expectation to update the parent's short description as "Parent Incident: <<Plugin ID>>?

k_lutz
Tera Expert

Pritika,

 

I am not sure I would handle the requirement in this way. It seems like you could take the logic from the BR and place it into an onComplete script as part of the transform map. Secondly, SN may be getting confused as you can see from the screenshot that imported records may have the same "Opened" time. You may need to have an orderbyasc on the opened_at field and then an orderby on the number field...something like that as the INC number with the lower number should be the first one created for that correlation id value. If you have that data in the system, I would take it into a background script and try it with displays until you see it print out what you are looking for and then apply it to the onComplete transform script.

Ankur Bawiskar
Tera Patron
Tera Patron

@PritikaA 

So what's your question?

if something is not working then what debugging did you do and what are your findings?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

palanikumar
Mega Sage

1) If first screenshot I see you check whether correlation id is 1234. Is this condition correct? update this condition if it is not correct

2) In Transform Map check whether "Run business rules" check box is unchecked. Your business rule will not execute if unchecked. In this case check this and save

 

Note: If this parent to child relationship is built only when executing the Import set, then my suggestion is to add this logic to onAfter transform script. This will be executed for each record after they are inserted.

Business rules will execute even if any update made manually.

 

 

Thank you,
Palani