- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 05:46 AM
condition = current.table_name == "incident"
When to run : After Insert/Update
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", current.table_sys_id);
gr.query();
gs.log("===>record exists", gr.next());
while(gr.next()) {
gs.log("===>record glide", gr);
//fi = gr.getElement('isAttachmentUpdated');
gr.setValue('isAttachmentUpdated', 'Updated'); //custom field isAttachmentUpdated
gr.update();
}
// Add your code here
})(current, previous);
Note: I'm able to receive the "record exists" debug as "true" but not able to get the log inside while loop. Please help me understand what is the issue fix as the custom field (isAttachmentUpdated) on incident is also not getting updated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2020 11:00 PM
Hello
If this has answered your question, kindly mark the comment as a correct answer so that the question is moved to solved list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:02 AM
Hi
I tried your suggestion, it worked but the update rule on incident is still not firing. Also, how to check the field api name for custom fields?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:09 AM
To check field name of custom field, you can go to that table
system definition -> tables. open the table and underr columns you shall find the name of the column
OR
you can go to your table_name.do it opens the form. In that right click on your field and you can see the name of the field.
Is there a update BR on incident tabel as well? Because your BR is currently on sys_attachment table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:13 AM
Yes, there is an update rule on incident as well as attachment because updating an attachment on incident record was not triggering the incident's update rule thus, i had to create a rule on attachment.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:20 AM
Can you share me the BR screenshot i.e. on incident table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:15 AM
I think the event is getting fired now after some debugging but the issue now is i want to update the incident without updating the custom field. I would like to update attachments without creating any custom field on incident, is there a way to do that?