Example of copying field values from one table to another

rody-bjerke
Giga Guru

Hi,

Could anyone give an example of the following:

I have 2 tables: Incident and u_new_table.

On the Incident table i have short_description, priority

On the u_new_table i have u_short_description and u_priority.

Then when an incident is created and assignment_group is "CAB", I want a business rule to create a new ticket in the u_new_table with the data in the fields short_description and priority.

Let's say Incident have short_description = "New ticket" and priority = "High", the assignment_group is set to CAB. Then the information is moved on submit/update to the form u_new_table and populate the fields u_short_description and u_priority.

How would that be done using best practice.

Best regards,

16 REPLIES 16

Hi Rody,



Can you mark my answer as correct if you are able to achieve your requirement? This helps in removing this question from unanswered list.


Thanks in advance.



Regards


Ankur


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

Nikita28
Mega Guru

Hi,

 

I wanted to insert data from "Number" field of type number of "Incident Table" into another custom table("u_document_state") which has field "Incident ID"(u_incident_record_id) of Reference type.

 

I have created a After Insert Business Rule on Incident Table.

var gr = new GlideRecord('u_document_state');

gr.initialize();

gs.info("Incident Number : " + current.number);


gr.u_incident_record_id = current.number;

gr.insert();

 

In the logs, I am getting correct Incident number field value and a record is also created. But, the "Incident ID" field is not populating with the value.

 

Can anyone please suggest on it?