- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-06-2023 09:53 AM
Have created a field "evp" as reference type in sys choice and added 2 options yes/no. So, the requirement is, when user's manager has evp field is yes then ask for approval if not check for managers manager has evp field set to yes. i have written the code, but its not working?
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
01-01-2024 01:48 AM
The code is good , Should fill all the evp fields as either yes or no, should not leave empty. Then it worked fine.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-06-2023 11:08 AM - edited 12-06-2023 11:10 AM
Can you write the below script on If activity? If yes, you can proceed with approval
 answer = ifScript();
function ifScript() {
 if (request.requested_for.manager.evp=='true') {
       return 'yes';
   }
    return 'no';
 }
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-06-2023 11:53 AM
As suggested by @Alp Utku, you can have an If activity before proceeding. The other alternate is modifying your script as below
var answer = [];
var manager = current.variables.manager.toString();
if (current.variables.manager.u_isevp=='yes')
          answer.push(manager);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
01-01-2024 01:48 AM
The code is good , Should fill all the evp fields as either yes or no, should not leave empty. Then it worked fine.
