Only need 2 of 3 strings identified

I have created the following drop-down from scratch in my create identity form:

    <Field displayName="Type of Account" helpKey="Choose from the following in the dropdown: AA, ZZ or Regular Account" name="adminacct" postBack="true" required="true" type="string">
      <AllowedValuesDefinition>
        <Value>
          <List>
            <String>AA</String>
            <String>ZZ</String>
            <String>Regular Account</String>
          </List>
        </Value>
      </AllowedValuesDefinition>
    </Field>

Further down depending on which of those 3 strings above you choose, it will be attached to the display name field with the first and last name as shown below:

 <Field displayName="Display Name" displayOnly="true" dynamic="true" helpKey="Combination of First and Last name" name="displayName" postBack="true" required="true" type="string">
      <Attributes>
        <Map>
          <entry key="readOnly" value="true"/>
        </Map>
      </Attributes>
      <Script>
        <Source>if(firstname !=null &amp;&amp; lastname!=null)
return adminacct + firstname +"." + lastname</Source>
      </Script>
    </Field>

How can I return the source in to not include the string “Regular account”. I only want it to return “aa” and “zz”.

Hi @derrickthomasvdot

Please try using the below snippet

    <Field displayName="Display Name" displayOnly="true" dynamic="true" helpKey="Combination of First and Last name" name="displayName" postBack="true" required="true" type="string">
      <Attributes>
        <Map>
          <entry key="readOnly" value="true"/>
        </Map>
      </Attributes>
      <Script>
        <Source>
          String displayName = null;
          if(firstname !=null &amp;&amp; lastname!=null){
            if(adminacct != null &amp;&amp; !adminacct.equals("Regular Account"))
              displayName = adminacct + "." + firstname +"." + lastname;
            else {
              displayName = firstname +"." + lastname;
            }
          }
          return displayName;
        </Source>
      </Script>
    </Field>

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