Event is triggerring in not so scheduled date and time.

Prithvi Ramesh1
Mega Sage

The End date and time is selected as "09-07-2025 23:29:48" and the event is triggered when the custom table record is inserted and the BR kicks the script include cde wherein it should schedule the event at the selected end date and time, but instead it is triggering when the record is inserted at "09-07-2025 23:20:54"

 

BR - 

PrithviRamesh1_0-1752084182629.png

 

 

Script : 

	var afterBR_req_PA=new RoleManagement().triggerGroupAssignmentOnEndDate(current);

 

Script Include :

 

    triggerGroupAssignmentOnEndDate: function(current) {

        // Schedule event to revoke the role at the end date
        gs.eventQueueScheduled('testInteg_delete_user_role_end_date', current, '', '', current.u_end_date.getDisplayValue());
		gs.log('End Date: ' + current.u_end_date.getDisplayValue())
        return true;
    },
2 REPLIES 2

Shruti
Mega Sage
Mega Sage

Hi,

If eventQueueScheduled() method is used, event is fired when the BR executes but it gets processed on scheduled date and time

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Prithvi Ramesh1 

Can you please share the screenshots of the date mismatch?

 

Also, please try this

    triggerGroupAssignmentOnEndDate: function(current) {

        // Schedule event to revoke the role at the end date
        gs.eventQueueScheduled('testInteg_delete_user_role_end_date', current, '', '', current.u_end_date);
		gs.log('End Date: ' + current.u_end_date);
        return true;
    },

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP