how can i copy any value to the work notes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2024 12:01 AM
Hi
I want to insert one table number as reference to everyone. i am adding number to the work notes in the incident but i am unable to see anything in the worknotes. can i insert anything in the work notes by using script.
i used "incident.work_notes = ''TRE0001432";
But it is not populating this value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2024 12:37 AM - edited ā04-04-2024 12:37 AM
Hi @shivaadapa there is a error in your script
"incident.work_notes = ''TRE0001432";
assuming your BR is on before update on incident table, it should be
current.work_notes = "TRE0001432";
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2024 12:46 AM
Can you share your entire script, if the solution Harish provided doesn't work?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2024 01:50 AM
Hi Shivaadapa,
To insert a value to all the new records, you can create a onload client script and add the below line.
g_form.setValue("work_notes","TRE0001432");
To insert a value to all the old records, you can run a background script or fix-script and add the below code.
var gr = new GlideRecord("incident");
gr.addEncodedQuery("number!=INC0000001^ORnumber=NULL"); //to select all the records you can filter out only one record and copy the query from the breadcrumbs
gr.setLimit(2000); //you can execute the script in batch to avoid and performance issue.
gr.query();
while(gr.hasNext()){
gr.work_notes = "TRE0001432";
//gr.autoSysFields(false); if you don't want to update the fields like created, updated, created by, updated by
//gr.setWorkflow(false); // if you don't want any business rule to run due to this update to the record
gr.update();
}
If you have specific question regarding your error, please share your code so that we can find what went wrong.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumbs up.
Best regards,
Tharun Kumar