How can i get search field value from form

Which IIQ version are you inquiring about?

Version 8.3

Please share any images or screenshots, if relevant.

Share all details related to your problem, including any error messages you may have received.

I have created a form for my quicklink. I don’t know how can i get field value into a variable

 <Section name="Section 1">
          <Field displayName="Search User" dynamic="true" name="applicationName" postBack="true" type="string">
            <Script>
              <Source>

  // code 
              </Script>
            </Source>

@amanKsingh
Can you explain your issue more detail

Are you looking to select an identity from the above where you list of dropdown of users?

1 Like

no, I want to search identity from field by name, email or userid. And want to get identity object on the behalf of search result.

1 Like

So basically you are looking for three fields which they can filter which will be name, email or user id ( username within SailPoint) and return a matching user for the same if found?

Also are you looking for these fields as free text or Drop down? and also exact match or not required if free text?

1 Like

drop down and exact match

1 Like

@amanKsingh ,

You can use form.getField(“fieldName”).getValue() to get the field value.

Thanks

1 Like

You can actually go to your corresponding quick link population and do the following
Enable View Identity and select for self and for other

This way it will give a way to filter all the identities within Sailpoint IIQ using searchable attributes this would be more easier way

Still if you want to do only above three attributes, instead of going with dropdown, go with free text and input should be provided by users ( reason being having dropdown for string fields will end up loading all the identities every time form loads and can cause performance issues)

I want to store searched value of field in a variable.

By default the form field name will act as variable which will be keeping the value that have been selected. But it will be visible within form only.

At the same time if you want to make some selection in the field and want to store in some variable and then want to use it in the workflow then you may declare a variable in workflow and the same can be used as variable name(field name).
Note: Just pass this variable in the step where you are opening form.

Thanks

@amanKsingh

Please use below sample Form, which will store the input form variables, provide the form field names as variables for your workflow, modify the code based on your fields

 <Form name="Select Identity Based on Filter" type="Workflow">
        <Attributes>
          <Map>
            <entry key="pageTitle" value="User-defined Filter Identity"/>
          </Map>
        </Attributes>
        <Description>Select Identity Based on Filter</Description>
        <Section name="Section 1">
          <Field displayName="Identity Name Selection" name="identityNameSelected" postBack="true" type="string"/>
          <Field displayName="Identity Display Name Selection" name="identityDisplayNameSelected" postBack="true" type="string"/>
          <Field displayName="Identity Email Selection" name="identityEmailSelected" postBack="true" type="string"/>
          <Field displayName="Identity Selected" dynamic="true" multi="true" name="identitySelected" type="string">
            <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();
              QueryOptions qo = new QueryOptions();
              String identityNameSelected="";

              String identityDisplayNameSelected="";

              String identityEmailSelected="";

              Field identityNameSelectedField = form.getField("identityNameSelected");
              if(identityNameSelectedField!=null &amp;&amp; identityNameSelectedField.getValue()!=null ){

              identityNameSelected=identityNameSelectedField.getValue().toString();
              }

              Field identityDisplayNameSelectedField = form.getField("identityDisplayNameSelected");
              if(identityDisplayNameSelectedField!=null &amp;&amp; identityDisplayNameSelectedField.getValue()!=null ) {

              identityDisplayNameSelected=identityDisplayNameSelectedField.getValue().toString();
              }
              Field identityEmailSelectedField = form.getField("identityEmailSelected");
              if(identityEmailSelectedField!=null &amp;&amp; identityEmailSelectedField.getValue()!=null ){

              identityEmailSelected=identityEmailSelectedField.getValue().toString();
              }
              if(!(Util.isNullOrEmpty(identityNameSelected) &amp;&amp; Util.isNullOrEmpty(identityDisplayNameSelected)  &amp;&amp;  Util.isNullOrEmpty(identityEmailSelected) )){

              if(Util.isNotNullOrEmpty(identityNameSelected))
              {

              qo.addFilter(Filter.ignoreCase(Filter.eq("name",identityNameSelected)));

              }
              if(Util.isNotNullOrEmpty(identityDisplayNameSelected))
              {

              qo.addFilter(Filter.ignoreCase(Filter.eq("displayName",identityDisplayNameSelected)));

              }
              if(Util.isNotNullOrEmpty(identityEmailSelected))
              {

              qo.addFilter(Filter.ignoreCase(Filter.eq("email",identityEmailSelected)));

              }


              Iterator it = context.search(Identity.class, qo);

              while ( (it != null) &amp;&amp; (it.hasNext()) ) {

              Identity identityCube = (Identity) it.next();	 
              String identityName=identityCube.getName();
              identityNames.add(identityName);

              }

              }
              return identityNames;


            </Source>
            </Script>
            <ValidationScript>
              <Source>
              import sailpoint.tools.Util;
              import sailpoint.object.Field;


              String identityNameSelected="";

              String identityDisplayNameSelected="";

              String identityEmailSelected="";

              Field identityNameSelectedField = form.getField("identityNameSelected");
              if(identityNameSelectedField!=null &amp;&amp; identityNameSelectedField.getValue()!=null ){

              identityNameSelected=identityNameSelectedField.getValue().toString();
              }

              Field identityDisplayNameSelectedField = form.getField("identityDisplayNameSelected");
              if(identityDisplayNameSelectedField!=null &amp;&amp; identityDisplayNameSelectedField.getValue()!=null ) {

              identityDisplayNameSelected=identityDisplayNameSelectedField.getValue().toString();
              }
              Field identityEmailSelectedField = form.getField("identityEmailSelected");
              if(identityEmailSelectedField!=null &amp;&amp; identityEmailSelectedField.getValue()!=null ){

              identityEmailSelected=identityEmailSelectedField.getValue().toString();
              }

              if(Util.isNullOrEmpty(identityNameSelected) &amp;&amp; Util.isNullOrEmpty(identityDisplayNameSelected)  &amp;&amp;  Util.isNullOrEmpty(identityEmailSelected) )
              return "One of the Above Fields are required";

              if(value==null){
              return "There is no corresponding Identity match for above values , provide the correct value";

              }
              if(value instanceof List)
              {

              if(value.size()>1)
              return "Multiple Identities selected with above selection, please recheck";

              if(value.size()==0)
              return "There is no corresponding Identity match for above values , provide the correct value";

              }
            </Source>
            </ValidationScript>
          </Field>
        </Section>
        <Button action="cancel" label="Cancel"/>
        <Button action="next" label="Submit"/>
      </Form>```
2 Likes

@amanKsingh
Is the issue resolved , still looking for help?

1 Like

You can change the type to “identity” like below

<Field displayName="Search User" dynamic="true" name="name" type="identity">

This will be helpful in searching identities usig their name or email id’s.
In your case, you can use email id and username to search and the result will be populated instantly in the dropdown from where you can select the user.

In case you want to use it in the workflow, just return the field name “name” (assuming you have already created a workflow variable on the name “name”) from the step where you are calling the form.

Another way to use the form field values in workflow in “formModel”. Below is the link to the usage of form Models.
https://community.sailpoint.com/t5/Technical-White-Papers/Form-Models/ta-p/78498

Hope this helps.

@amanKsingh One option i used mostly like.

a. Create a Field in form like

<Field displayName="Search User" name="sname" required="true" type="identity"/>

b. add entry in Identity Selector for Filter (Cofiguration : IdentitySelectorConfiguration) .

So your form should be clean and you can use this selector entry for other forms also.

Entry in Identity Selector

<entry key="YourFormName-form-sname-field">
 <value>
   <IdentityFilter name="SelectIdentity" order="Ascending">
      <FilterScript>
         <Script><Source>
             // add filter here like to choose identity which is Active only
       </Source>
      </Script>
    </FilterScript>
    <OrderBy>
        <String>lastname</String>
       <String>firstname</String>
       <String>name</String>
      <String>id</String>
    </OrderBy>
</IdentityFilter>
</value>
</entry>
1 Like

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