How to set Value of field on postBack="true", as when i select the value it gets refreshed and selected value comes as Null

Hi Team,

I am trying to create a form which gives all the identity Active Identity in drop down, but when i select the identity with postBack=“true” it gets null as the page refresh. I need to keep the field as postBack=“true” as there is a dependency to this value selection to next Field. Please help not sure what i am missing here:

sample Field:

On selection of the value from DropDown value is again getting set to Null.

Hi @dheerajk27

Generally setting postBack=true shouldn’t resetting the field itself. Moreover, if the value has been entered manually in the field, field value recalculations are not processed. Please share the form xml to debug understand the issue.

Hi @Jarin_James ,

Thank you for responding… attaching form here
Sailpoint IIQ Form.xml (3.6 KB)

There’s something wrong with the XML. It looks like the lower half of the Field in question got removed, between lines 36 and 37. If what you removed is a value script or value rule, that’s the problem. When the field is posted back, the value script will generate a new value. You’ll have to use the “current” variable to take into account the current value, if that’s the case.

I would also remove the multi=“true” unless you genuinely need to be able to select more than one Identity.

Hi @Devin,

Apologies below is the correct form:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Form PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Form name="Sailpoint IIQ Form" type="Workflow">
  <Attributes>
    <Map>
      <entry key="pageTitle" value="Sailpoint IIQ Form Attestation1"/>
      <entry key="pageTitleParam" value="$(identityName)"/>
    </Map>
  </Attributes>
  <Section type="text">
    <Field displayName="provision_identity_update_description"/>
  </Section>
  <Section label="provision_request_information" type="datatable">
    <Field displayName="Requester" name="Requester" type="string">
      <Script>
        <Source>return launcher;</Source>
      </Script>
    </Field>
  </Section>
  <Section label="provision_target_identity" type="datatable">
    <Field displayName="Select Identity" displayType="combobox" filterString="inactive == false" name="selectedIdentity" postBack="true" required="true" type="sailpoint.object.Identity">
      <Attributes>
        <Map>
          <entry key="onchangeValue">
            <value>
              <Script>
                <Source>

                  log.error("|||||||||||||||||||||||"+field.getValue());
                  return field.getValue();
                </Source>
              </Script>
            </value>
          </entry>
        </Map>
      </Attributes>
    </Field>
    <Field dependencies="selectedIdentity" dynamic="true" helpKey="Only used for logic processing" name="hidden_fld" postBack="true" type="sailpoint.object.Identity">
      <Attributes>
        <Map>
          <entry key="hidden" value="true"/>
        </Map>
      </Attributes>
    </Field>
    <Field dependencies="hidden_fld" displayName="Assigned Role/Entitlements" displayType="combobox" dynamic="true" name="assignment" postBack="true" required="true" type="String">
      <AllowedValuesDefinition>
        <Script>
          <Source>
            import sailpoint.object.Identity;
            import sailpoint.object.Filter;
            import sailpoint.object.QueryOptions;
            import java.util.Iterator;
            import java.util.List;
            import java.util.ArrayList;
            import sailpoint.tools.Util;
            import sailpoint.object.Assignment;
            import sailpoint.tools.GeneralException;
            import sailpoint.object.AttributeAssignment;

            String selectedIdentity=form.getField("selectedIdentity").getValue();
            log.error("selectedIdentity===>"+selectedIdentity);
            List assignedRoles=new ArrayList();
            try{
            if(!Util.isNullOrEmpty(selectedIdentity)){
            Identity identity=context.getObjectByName(Identity.class,selectedIdentity);
            if(null!=identity){
            log.error("identity===>"+identity);
            List roles=dentity.getAssignedRoles();
            if(!Util.isEmpty(roles))
            {
            for(Bundle bundle : roles){ 
            if(null==bundle){ return assignedRoles; }
            assignedRoles.add("Bundle : " +bundle.getName());
            }
            }
            }
            }
            }catch(GeneralException e){
            e.printStacTrace();
            }finally{
            log.error("assignedRoles:====>" +assignedRoles);
            return assignedRoles;
            }
          </Source>
        </Script>
      </AllowedValuesDefinition>
    </Field>
  </Section>
  <Button action="next" label="button_ok"/>
  <Button action="refresh" label="refresh"/>
  <Button action="cancel" label="button_cancel"/>
  <Button action="cancel" label="button_return" readOnly="true"/>
</Form>

Below is the form Screenshot:

When i select any identity form reload and the field is again set to null:

I’m fairly sure it’s that your Section type is “datatable” for the section containing the inputs. That type isn’t intended to be interactive.

Also, where did you find “onchangeValue”? I’ve never seen that before and am surprised it works.

1 Like

Hi @drosenbauer,

Thankyou for the help it as section type indeed.

onchangeValue is just an attribute which i tried to add on the field to see if value change is getting captured.

Thankyou for the help.

1 Like

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