workflow user activity check code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:38 AM
Hi all i have written this code in user activity if requester is inactive user so on the basis of inactive user i am running this code but only else part run that user is not found where i am doing mistake
var answer = []; var requested = current.variables.requested_name.getDisplayValue(); gs.info("Requester name is: " + requested); var grRequester = new GlideRecord('sys_user'); grRequester.addQuery('user_name', requested); grRequester.query(); if (grRequester.next()) { if (!grRequester.active) { var grActive = new GlideRecord('sys_user'); grActive.addQuery('active', true); grActive.query(); if (grActive.next()) { answer.push(grActive.sys_id); gs.info("The active approver is: " + grActive.sys_id); } else { gs.error("No active users found for approver."); } } else { gs.info("Requested user is active, no approver needed."); } } else { gs.error("Requested user not found."); }
Note after requesting item and select requester user no approver generate in logs this message come
this message populate in logs user not found
where i am doing mistake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:50 AM
in this code i am not abel to generate approver where i am doing mistake here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:51 AM
forget the code for now, tell me what is the goal, what are you trying to implement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:55 AM
okay i have requirement in catalog item if requester is inactive user then by using of workflow another active user should generate approver it should achive only by using workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:57 AM - edited 03-13-2024 06:58 AM
How can the requestor be inactive? How can an inactive user log in and request something?
Also if requestor is inactive, how does that impact approver? Approver doesn't depend on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 10:41 PM
i make user inactive in user table and i make variable that that is refrence type and i take user table as a refrence then i connect workflow