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

Hi...are you saying the solution you created works in your dev environment but not Test? I have seen flow act oddly and sometimes you may need to go in and make a small change like add a note or such, save it and then activate it again to make sure it compiles correctly.

the thing is I used with look up records action. In one instance it is working fine. In another, I am unable to select the data pill. It is grayed out and that fields are visible in that selected table. And I tried using custom action also, It is not working fine. Approval is not pushing it is show like no valid approval, that the users are active.