Using postback and dynamic

i have a field that is a dropdown where a user can select an identity. i need the next field on the same form to be a dropdown of the capabilities that that identity has. how do i accomplish this using postback and dynamic?

@arijindal you have to add postback=“true” on first field and dynamic=“true” in second field.

let me know if you need samples.

what would the second field look like? below is my first field which works.

      <Field displayName="Workgroup" filterString="workgroup == true" name="remwg" postBack="true" required="true" type="sailpoint.object.Identity"/>

how do i get second field to only show capabilities that are in the identity/workgroup selected from the first field? below is what i have to start with for second field

its not letting me post what i have to start with for second field, but what i’m asking is how do i access the identity selected from the first field and also do i need a script? also, what should the type of the field be

check this thread

Display and Get Field Values Dynamically in Form - IdentityIQ (IIQ) / IIQ Discussion and Questions - SailPoint Developer Community

you can get the value by

Field idn = form.getField("remwg");
idn.getValue will give you the value of field

import sailpoint.api.SailPointContext; import sailpoint.object.Identity; import sailpoint.object.Capability; import sailpoint.workflow.WorkflowContext;
              Identity w = context.getObjectById(Identity.class, remwg);
              List caps = w.getCapabilities();
              return caps;
              </Source>
          </Script>
        </AllowedValuesDefinition>
      </Field>

Ok so turns out i don’t need to user form.getField since remwg is already a workflow variable and i tested it and it dynamically updates when i select an identity for that field. Now for displaying the capabilities for that identity in the second field, everytime i try to use List caps = w.getCapabilities(); it breaks the form, essentially an error comes up and form doesn’t even show up. Why can’t I use getCapabilities() to access the capabilities of the selected identity?

try

Identity w = context.getObjectById(Identity.class, remwg);
log.error("w==="+w);
List caps = new ArrayList();
 if (w != null) caps  = w.getCapabilities();
return caps;

it worked, thank you

1 Like

@arijindal nice, pls mark this was solved so it close this thread.

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