checking if a user is in an AD group - orchestration

subhyde
Giga Contributor

I am trying to check if a user is already present in a group in AD, I figured the easiest way may be to parse the data from the failure message from the orchestration task "add user to ad" stating that the user is already in the group.

 

If this task fails it will create a ticket for service desk to do it manually, when there is multiple groups, I’d like to skip over the group in case the user is already in it.

 

Is there any way to get the data from the previous orchestration task and check the data in an if statement?

 

1 ACCEPTED SOLUTION

Steven Parker
Giga Sage

We use this IF function evaluate that failure (see Run Script below that occurs before this IF):

//IF STATEMENT: Was the user already a member of the group?

answer = ifScript();
     function ifScript() {
      if (workflow.scratchpad.addtogrouperror.indexOf("The object already exists") > -1) {
         return 'yes';
      }
      return 'no';
   }

 

This is the Run Script, prior to the IF Statement and right after the Orchestration Activity, that we use to grab the output/errors from the Orchestration Activity.  Your data.get(#) would change to whatever number needed from your workflow - You find it on the "Data" tab on the far right in Workflow Editor when you have the workflow on your screen:

var addtogroupoutput = data.get(3).errorMessage;
workflow.scratchpad.addtogrouperror = addtogroupoutput;

Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

View solution in original post

1 REPLY 1

Steven Parker
Giga Sage

We use this IF function evaluate that failure (see Run Script below that occurs before this IF):

//IF STATEMENT: Was the user already a member of the group?

answer = ifScript();
     function ifScript() {
      if (workflow.scratchpad.addtogrouperror.indexOf("The object already exists") > -1) {
         return 'yes';
      }
      return 'no';
   }

 

This is the Run Script, prior to the IF Statement and right after the Orchestration Activity, that we use to grab the output/errors from the Orchestration Activity.  Your data.get(#) would change to whatever number needed from your workflow - You find it on the "Data" tab on the far right in Workflow Editor when you have the workflow on your screen:

var addtogroupoutput = data.get(3).errorMessage;
workflow.scratchpad.addtogrouperror = addtogroupoutput;

Please mark this response as correct and/or helpful if it assisted you with your question.
Steven