Form Variables in Search

I am trying to create a form that has two drop downs. The first is to pull up a role. When the role is selected I want the second dropdown to display the identities assigned to that role. I have not been able to use any inline variables based on the documentation.

I have used both {{$.form.input.roleName}} and {{$.form.data.roleName}} in the Search @access(name:“{{variable}}”). Are inline variables not designed to populate dropdowns on the same form, or will multiple forms be needed?

Hi,

You can use the first drop-down as type Bundle. so here you can select the role names. Here you should define postBack=“true”.

in second field(drop-down), you can write a script to get the role name and run query to get the identities assigned to that role. You can use form.getField(“fieldName”).getValue() to get the field value.

<Form name="Select the Roles" type="Workflow">
        <Attributes>
          <Map>
            <entry key="pageTitle" value="Role Details"/>
          </Map>
        </Attributes>
        <Description>Select Roles</Description>
        <Section name="Section 1">
          <Field displayName="Role Name" name="roleName" postBack="true" type="Bundle"/>
          <Field displayName="Identity Assigned" dynamic="true" multi="true" name="identities" type="List">
            <Attributes>
              <Map>
                <entry key="readOnly" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source>
              import java.util.List;
              import java.util.Iterator;
              import java.util.ArrayList;
              import sailpoint.object.QueryOptions;
              import sailpoint.object.Filter;
              import sailpoint.object.Field;

              import sailpoint.object.Identity;
              import sailpoint.tools.Util;

              List identityNames=new ArrayList();

			  Field roleSelectedField = form.getField("roleName");
              if(roleSelectedField!=null &amp;&amp; roleSelectedField.getValue()!=null ){
				roleSelected = roleSelectedField.getValue().toString();
              }

			// logic to fetch the assigned users.
              return identityNames; // user list.

            </Source>
            </Script>
          </Field>
        </Section>
        <Button action="cancel" label="Cancel"/>
        <Button action="next" label="Submit"/>
      </Form>

Hello - the only option types I see for the drop down are as displayed as such. Is your answer for IdentityNow?

This is in preparation for the upcoming feature for delegated access, so I am not sure if the form will be launched from a workflow or the other way around.

Hey @sean_cochran17, did you ever get this working? I am trying to do exactly what you describe as your use case and also have been unable to pass the variable in from the workflow to the form search. @logesh_venki’s response was for IIQ Forms.

Hi Dominick,

Yes I figured it out, although there’s no documentation on it.

When setting up my second drop down field, I included a Search on Identities where search query is just *. I used the attribute to display as displayName then included a filter attribute. I put roleName there and then went to the API and configured the rest. Here is the JSON of my form for the second dropdown. I cannot find any documentation on the .exact field in aggregationBucketField, but this seems to clear out the information on the UI, but it works as expected.