Workflow to flow design

Kanimitha S
Kilo Guru

Hi,

I need to convert this workflow logic script in flow design. So, how we can implement this?

// Set the variable 'answer' to a comma-separated list of user ids and/or group ids or an array of user/group ids to add as approvers.
//
// For example:
     answer = [];

if(!current.variable_pool.infosec_rep1_repository.nil()){
if(current.variable_pool.infosec_rep1_repository.u_approver_1 != ''){
    var selected_app = current.variable_pool.infosec_rep1_repository.u_approver_1.toString();

    var list = selected_app;
    var array = list.split(",");

    for (var i=0; i < array.length; i++) {

        var apprvr = new GlideRecord('sys_user') ;
        apprvr.addQuery('sys_id', array[i]) ;
        apprvr.addQuery('active', 'true') ;

        apprvr.query() ;
        if (apprvr.next()) {
            answer.push(array[i]);
        }
        else{
            gs.log("The approver 1 for source code repository 1 either doesn't exist or the user is inactive. /nThis will cause the approval to be approved automatically.");
current.description = "The approver 1 for source code repository 1 either doesn't exist or the user is inactive. /nThis will cause the approval to be approved automatically.";
        }
    }
}else{
gs.log("The approver 1 for source code repository 1 either doesn't exist or the user is inactive. /nThis will cause the approval to be approved automatically.");
current.description = "The approver 1 for source code repository 1 either doesn't exist or the user is inactive. /nThis will cause the approval to be approved automatically.";
}
}

 

6 REPLIES 6

k_lutz
Giga Sage

Hello @Kanimitha S 

 

This is from a high-level and there may be a "best practice"...but will say what I have done. I have created a custom script action. You create inputs for those variables you need in the script. Then you replace the variable entries that you have in the script with the format need like "inputs.<input variable name you created>". You could create one similar to your variable so its easy to replace. You create an output or outputs based on what you need and pass that out of the script into an output variable. I know that sounds weird but if you work in flow you know what I mean...you have the value that you are passign out the outputs entry that you can use in the next part of your flow.

Kanimitha S
Kilo Guru

I got a solution, by simple action steps. Thankyou

Cool...at the end of the day we have to get it working!

Kanimitha S
Kilo Guru

Hi.. That logic is working in dev instance not working in test environment