# Form Variables in Search

**URL:** <https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921>\
**Category:** SHF Discussion and Questions\
**Tags:** forms, identity-security-cloud\
**Created:** [September 25, 2024, 5:04pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921 "2024-09-25T17:04:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean\_cochran17](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sean\_cochran17](https://developer.sailpoint.com/discuss/u/sean_cochran17)\
**Post date:** [September 25, 2024, 5:04pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/1 "2024-09-25T17:04:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![logesh\_venki](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/logesh_venki/32/17282_2.png) [@logesh\_venki](https://developer.sailpoint.com/discuss/u/logesh_venki)\
**Post date:** [September 25, 2024, 5:51pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/2 "2024-09-25T17:51:53Z")

</div>

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.

```xml
<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>

```

---

<div class="post-metadata">

**Author:** ![sean\_cochran17](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sean\_cochran17](https://developer.sailpoint.com/discuss/u/sean_cochran17)\
**Post date:** [September 25, 2024, 6:50pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/3 "2024-09-25T18:50:27Z")

</div>

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

 ![image_2024-09-25_115007197](https://global.discourse-cdn.com/sailpoint/original/3X/d/b/db1d6533d71556d60729018e4c48b2aaf70120a9.png)

---

<div class="post-metadata">

**Author:** ![sean\_cochran17](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sean\_cochran17](https://developer.sailpoint.com/discuss/u/sean_cochran17)\
**Post date:** [September 25, 2024, 6:51pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/4 "2024-09-25T18:51:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dominick-miller](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dominick-miller/32/29002_2.png) [@dominick-miller](https://developer.sailpoint.com/discuss/u/dominick-miller)\
**Post date:** [November 15, 2024, 7:46pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/5 "2024-11-15T19:46:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sean\_cochran17](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@sean\_cochran17](https://developer.sailpoint.com/discuss/u/sean_cochran17)\
**Post date:** [December 11, 2024, 7:27pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/6 "2024-12-11T19:27:08Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/7/3/7315b3a82b8839e777bff2c843489a1a964c86cd.png)  
 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/b/4/b461f1e65040b8069af9108747b3a32c8ec10e54.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [February 9, 2025, 7:27pm UTC](https://developer.sailpoint.com/discuss/t/form-variables-in-search/82921/7 "2025-02-09T19:27:56Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
