GS.getUserID() is not working in schedule job and in email script

Anusha Dande
Tera Contributor

Hi 

 

We have  a requirement to delete the users from specific groups who are not logged in for 90 days along with notification, before removing them from the groups needs to send reminder notifications .

I have written scheduled job to check logged in user by gliding sys_user table and comparing today and last login date of users for this requirement

But in my script g's.getUserID() is not working,  

Suppose if I hardcode the user sys id then both schedule job and email script s are working as expected.

 

Can anyone please suggest an alternative method to check the logged in user in both scheduled job and email script.

 

 

Thanks,

Anusha

 

 

 

 

 

 

1 ACCEPTED SOLUTION

You want to remove the users who have not logged in then by which logic are you using gs.getUserID(); 

This only returns the sys_id of current logged in users.

 

If I understand correctly you need to follow below:

1. Run a scheduled job and get the sys_id of users ( comma separated or in array) based on last login, then you can fire an event which can fire your notification to those users, you can pass the users in the event parameter . use gs.eventQueue() to fire event.

 

2. After this you can run deletion logic of these users from groups, you will need to delete the users from "sys_user_grmember" table.


Raghav
MVP 2023

View solution in original post

5 REPLIES 5

Glad that helped


Raghav
MVP 2023