How to create dynamic form in workflow to show violations

Which IIQ version are you inquiring about?

[SailPoint IIQ 8.3]

Please share any images or screenshots, if relevant.

[


]

Please share any other relevant files that may be required (for example, logs).

[
DynamicFormWorkflow.xml (4.6 KB)
]

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

[i have tried the static form and now I am trying to get violations in 2nd form (Which I want to convert in Dynamic) when we select the business role in 1st form. Some of the violation should hidden in dynamic form if there’s no violation.]

How is the business role related to violation. Do you already have a Role SOD policy configured for the role and you want to present the details of the configured policy on the form.

Hello @SanjeevIAM , Thanks for reply. It is not related to violation of roles in actual but I am having one requirement for test like once I clicked on quicklink it will show the form for select the roles and after that in 2nd form I want to show the dynamic form with Violation1 ,2,3 With Risk Name , Risk Code, Risk Type, Risk Description for each violation . The role selection form is working properly but the dynamic form I am not able to display.
Shareing the workflow code-

<?xml version='1.0' encoding='UTF-8'?> import sailpoint.object.*; import sailpoint.api.*; import java.util.*; import sailpoint.object.Form.Section; import sailpoint.object.Form.Button;
    // Retrieve selected roles
    Object selectedRoles = workflow.get("selectedRoles");

    if (selectedRoles != null) {
    List roles = selectedRoles;

    // Create dynamic form
    Form dynamicForm = new Form();
    dynamicForm.setName("Violations Review Form");
    dynamicForm.setPageTitle("Violations for Selected Roles");

    int count = 1;
    for (String roleName : roles)
    
    {
    // Creating new section for each selected role
    
    Section sec = new Section();
    sec.setName("roleSec_" + roleName);
    sec.setDisplayName("Role: " + roleName);
    sec.setType("text");

    // Violation Name
    Field nameFld = new Field();
    nameFld.setName("violName_" + count);
    nameFld.setDisplayName("Violation Name");
    nameFld.setType("string");
    nameFld.setReadOnly(true);
    nameFld.setValue("Violation for " + roleName);
    sec.add(nameFld);

    // Violation Type
    Field typeFld = new Field();
    typeFld.setName("violType_" + count);
    typeFld.setDisplayName("Violation Type");
    typeFld.setType("string");
    typeFld.setReadOnly(true);
    typeFld.setValue("Type for " + roleName);
    sec.add(typeFld);

    // Violation Code
    Field codeFld = new Field();
    codeFld.setName("violCode_" + count);
    codeFld.setDisplayName("Violation Code");
    codeFld.setType("string");
    codeFld.setReadOnly(true);
    codeFld.setValue("Code for " + roleName);
    sec.add(codeFld);

    // Violation Description
    Field descFld = new Field();
    descFld.setName("violDesc_" + count);
    descFld.setDisplayName("Violation Description");
    descFld.setType("string");
    descFld.setReadOnly(true);
    descFld.setValue("Description for " + roleName);
    sec.add(descFld);

    // Add section to the form
    
    dynamicForm.add(sec);
    count++;
    }

    // Add Submit button
    
    Form.Button submitButton = new Form.Button("submit", "Submit");
    
    List bList = new ArrayList();
    bList.add(submitButton);
    dynamicForm.setButtons(bList);

    // Set generated form as the final form
    workflow.put("finalForm", dynamicForm);
    return dynamicForm;
    }

    return null;  
  </Source>
</Script>
<Transition to="Stop"/>