Business Rule not operating on Event(sysevent) table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 02:42 AM
Hi Team. I do have a use case to build reports on same data that we get on Event table. So to follow the best practices, I have built a custom table and trying to copy the certain field values from Event(sysevent) table to the custom table But somehow the functionality doesn't work. It's not generating new records either.
Is there any limitation as such for that particular table because when I am utilizing the same approach for another table copy (Copy from Transaction table to another custom table), I am able to achieve it proerly.
Below is the code logic (Trigger condition as After - Insert/Update), written on the event table
Please let me know if anyone has any suggestions/guidance
(function executeRule(current, previous /*null when async*/ ) {
var gr= new GlideRecord("custom_table ");
gr.initialize();
gr.sys_created_on = current.sys_created_on;
gr.sys_created_by = current.sys_created_by;
gr.customfield1=current.name;
gr.customfield2=cuurent.parm1;
gr.customfield3 =current.user_id;
….
….
gr.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 03:49 AM
Looks like you are trying to insert a record but you are using gr.update()
Try to change that to gr.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 06:44 AM
Thanks for your response.
Tried this but no luck. Records are still not getting inserted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 06:46 AM
There were typo in spelling of current, fix that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2024 08:12 AM
Thanks much @Anurag Tripathi , able to see records creating in the custom table .
However, i do have an ask to have those records in the custom table which have the "Name" as "login" or "logout" in event table. So I am not seeing those records getting created in the custom table. It's only creating/copying those records that are created by system.
Any idea why that would be happening or any suggestions over the same ?