Business Rule not operating on Event(sysevent) table

Arjit Gourav
Tera Contributor

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);

 

8 REPLIES 8

Sandeep Rajput
Tera Patron
Tera Patron

@Arjit Gourav Please see if the following works for you.

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var gr= new GlideRecord("custom_table");
    gr.initialize();
    gr.sys_created_on = current.sys_created_on.toString();
    gr.sys_created_by = current.sys_created_by.toString();
    gr.customfield1=current.name.toString();
    gr.customfield2=cuurent.parm1.toString();
    gr.customfield3 =current.user_id.toString();
    ….
    ….
   gr.insert();

})(current, previous);

 

@Sandeep Rajput , Tried this but no luck. Records are still not getting inserted.

@Arjit Gourav Can you try and reduce the order of this business rule to 10 and run it. It seems that there is another business rule running prior to your business rule which is using setWorkflow(false); due to which your business rule is not triggering.

Thanks @Sandeep Rajput  , able to see records creating in the custom table after correcting couple of lines.

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 ?