Application Provisioning Form to be dependent

Which IIQ version are you inquiring about?

8.4

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

Hi all,

I have a provisioning form in my application and I would only like a field to be manually filled up once by the user. On the backend, I would like another field to just reference the same value a user has filled up.

My current code is throwing an error where getField is An unexpected error occurred: Typed variable declaration : Attempt to resolve method: getField() on undefined variable or class name: form : at Line: 1

My code is as below where I want field2 to be the same as field1 value which user will manually input in the provisioning form.

<ProvisioningForms>
    <Form name="Create Account" objectType="account" type="Create">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Create Account"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="field1" name="field2" postBack="true" required="true" reviewRequired="true" type="string"/>
		<Field displayName="field2" name="field2" type="string" dependencies="field1">
          <Script>
            <Source>form.getField("field1").getValue();</Source>
          </Script>
        </Field>
	</Section>
    </Form>
  </ProvisioningForms>

Any help is appreciated!

I think, form models can be accessed by scripts within forms using the $() parsing
tokens, for example, $(field1).

try this one

<ProvisioningForms>
    <Form name="Create Account" objectType="account" type="Create">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Create Account"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="field1" name="field1" postBack="true" required="true" reviewRequired="true" type="string"/>
		<Field displayName="field2" name="field2" type="string" dependencies="field1">
          <Script>
            <Source> return $(field1);</Source>
          </Script>
        </Field>
	</Section>
    </Form>
  </ProvisioningForms>

Regards
Ankush

Hi @shirbhatea what if I need to use the value to concat? Can I do something like:

String f1 = $(field1);
field2 = f1 + "testinggg";

Yes you can do that.

@shirbhatea , I am getting error An unexpected error occurred: Command not found: $(java.lang.String) : at Line: 1 below is my code.

<ProvisioningForms>
    <Form name="Create Account" objectType="account" type="Create">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Create Account"/>
        </Map>
      </Attributes>
      <Section>
        <Field dependencies="cn" displayName="con_prov_policy_ldap_user_DN" name="dn" type="string">
          <Script>
            <Source>
String temp = $(cn);
String divValue = "";
String dn = "CN="+ temp +"," + divValue + ",OU***";
return dn;</Source>
          </Script>
        </Field>
        <Field displayName="Account ID" name="cn" postBack="true" required="true" reviewRequired="true" type="string"/>
        <Field dependencies="dn" name="distinguishedName" type="string">
          <Script>
            <Source>return $(dn);</Source>
          </Script>
        </Field>
        <Field name="displayName" required="true" type="string">
          <Script>
            <Source>return identity.getAttribute("email");</Source>
          </Script>
        </Field>
        <Field dependencies="cn" name="name" type="string">
          <Script>
            <Source>return $(cn);</Source>
          </Script>
        </Field>
        <Field dependencies="mail" name="userPrincipalName" required="true" type="string">
          <Script>
            <Source>return $(mail);</Source>
          </Script>
        </Field>
        <Field name="mail" required="true" reviewRequired="true" type="string">
          <Script>
            <Source>String email = identity.getAttribute("email");
return mail;</Source>
          </Script>
        </Field>
        <Field dependencies="cn" name="sAMAccountName" type="string">
          <Script>
            <Source>return $(cn);</Source>
          </Script>
        </Field>
      </Section>
    </Form>
    <Form name="Create Group" objectType="group" type="Create">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Create Group"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="con_prov_policy_ldap_group_DN" helpKey="help_con_prov_policy_ldap_group_DN" name="dn" required="true" reviewRequired="true" type="string"/>
        <Field displayName="con_prov_policy_ldap_description" helpKey="help_con_prov_policy_ldap_description" name="description" reviewRequired="true" type="string"/>
      </Section>
    </Form>
    <Form name="Update Group" objectType="group" type="Update">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Update Group"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="con_prov_policy_ldap_owner" name="owner" type="string"/>
        <Field displayName="con_prov_policy_ldap_common_name" name="cn" type="string"/>
        <Field displayName="con_prov_policy_ldap_object_class" multi="true" name="objectClass" type="string"/>
        <Field displayName="con_prov_policy_ldap_description" name="description" type="string"/>
      </Section>
    </Form>
  </ProvisioningForms>

Hi @shijingg ,

Once use the below code

<ProvisioningForms>
    <Form name="Create Account" objectType="account" type="Create">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Create Account"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="field1" name="field1" dynamic="true" postBack="true" required="true" reviewRequired="true" type="string"/>
		<Field displayName="field2" name="field2" type="string" dependencies="field1">
          <Script>
            <Source>return field1;</Source>
          </Script>
        </Field>
	</Section>
    </Form>
  </ProvisioningForms>
1 Like

Hi @shijingg ,

You can try this updated code.
Inside provisioning forms, form.getField() doesn’t work, so you should use fields.get() to read values.

<ProvisioningForms>
  <Form name="Create Account" objectType="account" type="Create">
    <Attributes>
      <Map>
        <entry key="pageTitle" value="Create Account"/>
      </Map>
    </Attributes>
    <Section>
      <Field displayName="Field 1" name="field1" postBack="true" required="true" reviewRequired="true" type="string"/>
      <Field displayName="Field 2" name="field2" type="string" dependencies="field1" editable="false">
        <Script>
          <Source>
            return fields.get("field1").getValue();
          </Source>
        </Script>
      </Field>
    </Section>
  </Form>
</ProvisioningForms>