How to get field value from different field value on the same form

I am creating one Quicklink and that is calling my workflow. Workflow contain one form with two filed. When I am selecting my application in field , I want to populate account details based on salected application in my second field.
I have tried this solution but not working

<Field displayName="Search Application" name="applicationSearch" postBack="true" type="string">
            <AllowedValuesDefinition>
              <Value>
                <List>
                  <String>PCA - INFRA - Azure SGRSSS Non-PROD Tenant</String>
                </List>
              </Value>
            </AllowedValuesDefinition>
          </Field>
          <Field displayName="Input" dynamic="true" name="searchedUser" type="text">
            <Script>
              <Source>
        String applicationName = form.getField("applicationSearch").getValue();
        return applicationName;
      </Source>
            </Script>
          </Field>

Try something like this

add the displayType as combobox in first field and in the second field, try changing the type to string to see if it helps.

Try below:

<Field displayName="Search Application" name="applicationSearch" postBack="true" type="string">
            <AllowedValuesDefinition>
              <Value>
                <List>
                  <String>PCA - INFRA - Azure SGRSSS Non-PROD Tenant</String>
                </List>
              </Value>
            </AllowedValuesDefinition>
          </Field>
          <Field dependencies="applicationSearch" displayName="Input" dynamic="true" name="searchedUser" type="text">
            <Script>
              <Source>
        String applicationName = form.getField("applicationSearch").getValue();
        return applicationName;
      </Source>
            </Script>
          </Field>

@dheerajk27, Thanks for replying, I have checked but not working.

Hi @puresoftware ,

Try

<Field displayName="Search Application" name="applicationSearch" postBack="true" type="string">
            <AllowedValuesDefinition>
              <Value>
                <List>
                  <String>PCA - INFRA - Azure SGRSSS Non-PROD Tenant</String>
                </List>
              </Value>
            </AllowedValuesDefinition>
          </Field>
          <Field dependencies="applicationSearch" displayName="Input" postBack="true" dynamic="true" name="searchedUser" type="text">
            <Script>
              <Source>
        String applicationName = form.getField("applicationSearch").getValue();
        return applicationName;
      </Source>
            </Script>
          </Field>

Not working

wokflow code:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Workflow PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Workflow created="1746428134679" explicitTransitions="true" handler="sailpoint.api.StandardWorkflowHandler" id="0ac13988961e13a081969f3a85174ca3" libraries="Identity" modified="1746428998524" name="TEF_Search_Users_Test" type="IdentityLifecycle">
  <Variable input="true" name="launcher"/>
  <Variable name="identityModel"/>
  <Variable initializer="true" name="transient"/>
  <Step icon="Start" name="Start" posX="6" posY="66">
    <Transition to="Initial Form"/>
  </Step>
  <Step icon="Default" name="Initial Form" posX="214" posY="71">
    <Approval name="ApplicationForm" owner="ref:launcher" return="identityModel" send="identityModel">
      <Arg name="workItemFormBasePath" value="identityModel"/>
      <Form name="ApplicationForm">
        <Attributes>
          <Map>
            <entry key="hideIncompleteFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="includeHiddenFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="isWizard">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="pageTitle" value="ApplicationForm"/>
            <entry key="subtitle"/>
            <entry key="title"/>
          </Map>
        </Attributes>
        <Description>User Selection Form</Description>
        <Section name="Section 1">
          <Field displayName="Search Application" name="application" postBack="true" type="string">
            <AllowedValuesDefinition>
              <Value>
                <List>
                  <String>Azure AD</String>
                </List>
              </Value>
            </AllowedValuesDefinition>
          </Field>
          <Field displayName="Input(ID,Email,FirstName,LastName)" dynamic="true" name="searchedUser" type="text">
            <Script>
              <Source>
        String applicationName = form.getField("application").getValue();
        return applicationName;
**//here I want based on application will populate all account in drop down but firstly i need application via this will get account and retuen it** 
      </Source>
            </Script>
          </Field>
        </Section>
        <Button action="next" label="Next" parameter="userAction" value="next"/>
      </Form>
    </Approval>
    <Transition to="Generic Step"/>
  </Step>
  <Step icon="Stop" name="Stop" posX="582"/>
  <Step icon="Default" name="Generic Step" posX="412" posY="79">
    <Approval name="User Details Form" owner="ref:launcher" return="identityModel,tableData" send="identityModel,tableData">
      <Arg name="workItemFormBasePath" value="identityModel"/>
      <Form name="User Details Form">
        <Attributes>
          <Map>
            <entry key="hideIncompleteFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="includeHiddenFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="pageTitle" value="User Details Form"/>
          </Map>
        </Attributes>
        <Description>Second Form</Description>
        <Section name="Section 12" type="text">
          <Field displayName="User Info Page" filterString="htmlRender" name="tableData" type="text">
            <Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source> import sailpoint.object.Filter;
                import sailpoint.object.IdentityEntitlement;
                import sailpoint.object.Link;
                import sailpoint.object.QueryOptions;
                import sailpoint.object.ManagedAttribute;
                import sailpoint.object.Application;
                import sailpoint.tools.GeneralException;
                import sailpoint.tools.Util;
                import sailpoint.object.Bundle;
                import sailpoint.object.Identity;
                import org.apache.commons.logging.Log;
                import org.apache.commons.logging.LogFactory;
                
                
                 String mainStr="";
      
                 
                System.out.println("identityModel:::::"+identityModel);
                String SearchValue = (String)identityModel.get("searchedUser");
                 System.out.println("SearchValue:::"+SearchValue);
                // Define the attributes to return
                
                
                
                
       // Filter.like("FirstName", "%" + searchTerm + "%"),      
		
	  QueryOptions qo = new QueryOptions();
    Filter f1 = Filter.eq("name", SearchValue);
    Filter f2 = Filter.like("firstname", SearchValue,Filter.MatchMode.START);
    Filter f3 = Filter.like("lastname", SearchValue,Filter.MatchMode.START);
    Filter f4 = Filter.eq("email", SearchValue);

    qo.add(Filter.or(f1,f2,f3,f4));
   
     
      List&lt;Identity> identities = context.getObjects(Identity.class, qo);
    
              //  System.out.println(">>>>>>>>>>>>>>>"+ identities);
             
       
                
             
               

     
             
                
                if (identities != null &amp;&amp; !identities.isEmpty()) {
                
                 for (Identity identity : identities) {
                 System.out.println("Inside for:::::"+identity);
                 String identityAttributes = identity.getFirstname();
         //  System.out.println("identityAttributes::"+identityAttributes);
           
                
                    mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"word-break:break-all;\">\n" +
                "  &lt;tr>\n" +
                "  &lt;th>FirstName&lt;/th>\n"+
                "  &lt;th>LastName&lt;/th>\n"+
                "  &lt;th>Email&lt;/th>\n"+
                "  &lt;th>NQID&lt;/th>\n" +
               
                "  &lt;/tr>\n";
                
                 mainStr += 
                "&lt;tr>\n"+ "&lt;td>"+ identity.getFirstname()+ "&lt;/td>\n"+
                "&lt;td>" + identity.getLastname() + "&lt;/td>\n"+
                "&lt;td>" + identity.getEmail()+"&lt;/td>\n"+
                "&lt;td>" + identity.getName()+"&lt;/td>\n"+
               
                "&lt;/tr>\n";
                
           
        }
                }else{
                  mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"word-break:break-all;\">\n" +
                "  &lt;tr>\n" +
                 "  &lt;p>&lt;/p>\n" +
                "  &lt;p>Data Not Found&lt;/p>\n" +
               
                "  &lt;/tr>\n";
                
                
               
                
                
                  System.out.println("inside else");
                  
                
                }
                
              
         
                log.debug("Execution Completed for Row Data:");
                return mainStr;


                
              </Source>
            </Script>
          </Field>
        </Section>
        <Button action="cancel" label="Cancel" parameter="userAction" skipValidation="true" value="cancel"/>
      </Form>
    </Approval>
    <Transition to="Stop"/>
  </Step>
  <Step icon="Stop" name="End" posX="654" posY="20"/>
</Workflow>

quicklink code:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE QuickLink PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<QuickLink action="workflow" category="Custom" created="1746428314604" id="0ac13988961e13a081969f3d43ec4cb1" messageKey="User Search1" name="TEF_SearchUser1">
  <Attributes>
    <Map>
      <entry key="workflowName" value="TEF_Search_Users_Test"/>
    </Map>
  </Attributes>
  <QuickLinkOptions allowSelf="true" created="1746428314604" id="0ac13988961e13a081969f3d43ec4cb2">
    <DynamicScopeRef>
      <Reference class="sailpoint.object.DynamicScope" id="8a2329c663b45b3f0163ba53be941d28" name="Everyone"/>
    </DynamicScopeRef>
  </QuickLinkOptions>
</QuickLink>

Hi @puresoftware ,

Thanks for the code, let me test this in my local and comeback to you.

Hi @puresoftware ,

Please find corrected workflow:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Workflow PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Workflow created="1746428134679" explicitTransitions="true" handler="sailpoint.api.StandardWorkflowHandler" id="7f000001969f1f7281969f606281000d" libraries="Identity" modified="1746433748977" monitored="true" name="TEF_Search_Users_Test" significantModified="1746433748977" type="IdentityLifecycle">
  <Variable input="true" name="launcher"/>
  <Variable name="identityModel"/>
  <Variable initializer="true" name="transient"/>
  <Step icon="Start" name="Start" posX="82" posY="126">
    <Transition to="Initialize identityModel"/>
  </Step>
  <Step action="call:getIdentityModel" name="Initialize identityModel" posX="242" posY="126" resultVariable="identityModel">
    <Arg name="identityName" value="ref:identityName"/>
    <Arg name="expandLinks" value="script:return true;"/>
    <Description>Initialize the data for the identity that we are disabling.</Description>
    <Transition to="Initial Form"/>
  </Step>
  <Step icon="Default" name="Initial Form" posX="374" posY="126">
    <Approval name="ApplicationForm" owner="ref:launcher" return="identityModel">
      <Arg name="workItemFormBasePath" value="identityModel"/>
      <Form name="ApplicationForm">
        <Attributes>
          <Map>
            <entry key="hideIncompleteFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="includeHiddenFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="isWizard">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="pageTitle" value="ApplicationForm"/>
          </Map>
        </Attributes>
        <Description>User Selection Form</Description>
        <Section name="Section 1">
          <Field displayName="Search Application" dynamic="true" name="application" postBack="true" type="string">
            <AllowedValuesDefinition>
              <Value>
                <List>
                  <String>WindowsServer2008</String>
                </List>
              </Value>
            </AllowedValuesDefinition>
          </Field>
          <Field displayName="Input(ID,Email,FirstName,LastName)" dynamic="true" name="searchedUser" postBack="true" type="text">
            <Script>
              <Source>
              String applicationName = form.getField("application").getValue();
              log.error("applicationName==>"+applicationName);
              return applicationName;
              **//here I want based on application will populate all account in drop down but firstly i need application via this will get account and retuen it** 
            </Source>
            </Script>
          </Field>
        </Section>
        <Button action="next" label="Next" parameter="userAction" value="next"/>
      </Form>
    </Approval>
    <Transition to="Generic Step"/>
  </Step>
  <Step icon="Stop" name="Stop" posX="626" posY="126"/>
  <Step icon="Default" name="Generic Step" posX="500" posY="126">
    <Approval name="User Details Form" owner="ref:launcher" return="identityModel,tableData" send="identityModel,tableData">
      <Arg name="workItemFormBasePath" value="identityModel"/>
      <Form name="User Details Form">
        <Attributes>
          <Map>
            <entry key="hideIncompleteFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="includeHiddenFields">
              <value>
                <Boolean></Boolean>
              </value>
            </entry>
            <entry key="pageTitle" value="User Details Form"/>
          </Map>
        </Attributes>
        <Description>Second Form</Description>
        <Section name="Section 12" type="text">
          <Field displayName="User Info Page" filterString="htmlRender" name="tableData" type="text">
            <Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source> import sailpoint.object.Filter;
              import sailpoint.object.IdentityEntitlement;
              import sailpoint.object.Link;
              import sailpoint.object.QueryOptions;
              import sailpoint.object.ManagedAttribute;
              import sailpoint.object.Application;
              import sailpoint.tools.GeneralException;
              import sailpoint.tools.Util;
              import sailpoint.object.Bundle;
              import sailpoint.object.Identity;
              import org.apache.commons.logging.Log;
              import org.apache.commons.logging.LogFactory;


              String mainStr="";


              System.out.println("identityModel:::::"+identityModel);
              String SearchValue = (String)identityModel.get("searchedUser");
              System.out.println("SearchValue:::"+SearchValue);
              // Define the attributes to return




              // Filter.like("FirstName", "%" + searchTerm + "%"),      

              QueryOptions qo = new QueryOptions();
              Filter f1 = Filter.eq("name", SearchValue);
              Filter f2 = Filter.like("firstname", SearchValue,Filter.MatchMode.START);
              Filter f3 = Filter.like("lastname", SearchValue,Filter.MatchMode.START);
              Filter f4 = Filter.eq("email", SearchValue);

              qo.add(Filter.or(f1,f2,f3,f4));


              List&lt;Identity> identities = context.getObjects(Identity.class, qo);

              //  System.out.println(">>>>>>>>>>>>>>>"+ identities);









              if (identities != null &amp;&amp; !identities.isEmpty()) {

              for (Identity identity : identities) {
              System.out.println("Inside for:::::"+identity);
              String identityAttributes = identity.getFirstname();
              //  System.out.println("identityAttributes::"+identityAttributes);


              mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"word-break:break-all;\">\n" +
              "  &lt;tr>\n" +
              "  &lt;th>FirstName&lt;/th>\n"+
              "  &lt;th>LastName&lt;/th>\n"+
              "  &lt;th>Email&lt;/th>\n"+
              "  &lt;th>NQID&lt;/th>\n" +

              "  &lt;/tr>\n";

              mainStr += 
              "&lt;tr>\n"+ "&lt;td>"+ identity.getFirstname()+ "&lt;/td>\n"+
              "&lt;td>" + identity.getLastname() + "&lt;/td>\n"+
              "&lt;td>" + identity.getEmail()+"&lt;/td>\n"+
              "&lt;td>" + identity.getName()+"&lt;/td>\n"+

              "&lt;/tr>\n";


              }
              }else{
              mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"word-break:break-all;\">\n" +
              "  &lt;tr>\n" +
              "  &lt;p>&lt;/p>\n" +
              "  &lt;p>Data Not Found&lt;/p>\n" +

              "  &lt;/tr>\n";





              System.out.println("inside else");


              }



              log.debug("Execution Completed for Row Data:");
              return mainStr;



            </Source>
            </Script>
          </Field>
        </Section>
        <Button action="cancel" label="Cancel" parameter="userAction" skipValidation="true" value="cancel"/>
      </Form>
    </Approval>
    <Transition to="Stop"/>
  </Step>
</Workflow>

Logs:

2025-05-05T13:59:14,238 ERROR http-nio-8080-exec-7 sailpoint.server.InternalContext:166 - applicationName==>null
2025-05-05T13:59:18,436 ERROR http-nio-8080-exec-7 sailpoint.server.InternalContext:166 - applicationName==>WindowsServer2008
2025-05-05T13:59:18,505 ERROR http-nio-8080-exec-7 sailpoint.server.InternalContext:166 - applicationName==>WindowsServer2008

Please confirm if you still got any issue.

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