Example of copying field values from one table to another
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2017 04:10 AM
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,
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2017 04:08 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2018 10:55 PM
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?