My issue is when end user selects the field value, postback happens as expected.
But when I programmatically set the value for that field, the postback action for that field is not triggering.
<Field displayName="Choose Certification Template" displayType="combobox" dynamic="true" helpKey="" name="certTemplate" postBack="true" required="true" type="string">
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.object.*;
List availableTemplates = new ArrayList();
// do business logic and popupulate the availableTemplates
// availableTemplates.add("abc1");
// availableTemplates.add("abc2");
if ( availableTemplates.size() == 1 ) {
form.setFieldValue("certTemplate", availableTemplates.get(0) // set the field value programatically instead of end user input in this scenario
form.getField("certTemplate").setReadOnly(true);
return;
}
return availableTemplates;
</Source>
</Script>
</AllowedValuesDefinition>
<Attributes>
<Map>
<entry key="hidden">
<value>
<Script>
<Source>
// part 1
// execute some code
</Source>
</Script>
</value>
</entry>
</Map>
</Attributes>
</Field>
</Section>
<Section name="staticTemplateInfo" type="text">
<Field displayName="" dynamic="true" name="certTemplateDescription" postBack="true">
<Script>
<Source>
// Part 2
// execute some code
</Source>
</Script>
</Field>
</Section>
Here, for the ‘certTemplate’ field, if the end user manually select a value from dropdown, then the postback gets triggerred and ‘Part 1’ and ‘Part 2’ gets executed.
But based on some condition, if ‘certTemplate’ field is programmatically updated (as shown in the above code), then ‘Part 1’ and ‘Part 2’ doesn’t get executed because postback of ‘certTemplate’ field didn’t get triggered.
Screenshots:
Case 1 - when user manually selects a field, other dynamic=true fields are displayed
@Arun-Kumar
Thanks for taking time and testing it.
Unfortunately, it won’t work. It worked for you because the ‘certTemplate’ field for you is the first field for you and since the form is getting loaded for the first time you access it, all fields will be refreshed by default and your description field also got refreshed as part of it.
My scenario is different. There’s one field ‘xyz’ which is the only field that shows up when the form is rendered. Based on the value selected in ‘xyz’ field, the ‘certTemplate’ field gets populated.