Add column in report

Hi Team,

We have created a data source class for report it has few columns like name, entitlement and department, we want to add another column but that column is not present in data source class so how can we add custom column (identityRequestId)in that report and how can we add reference rule in the report

Hi @sureshbommareddy98 ,

You can use ExtendedColumnScript or ExtendedColumnRule to create column in report itself.

@Harikrishna_06 I’m giving more info we don’t want to modify the data source class as it depends on multiple reports so without modifying the original one need to add new column for different report which is not present in the class

Can you please provide examples the extendedscript and extendedcolumn

Hi @sureshbommareddy98,

Please find below example

<ExtendedColumnScript>
<Source>
               import sailpoint.object.Application;
import sailpoint.object.AttributeDefinition;
import sailpoint.object.ReportColumnConfig;
import sailpoint.object.Schema;



// Initialize the list to hold dynamically generated columns
List newCols = new ArrayList();
log.warn("Initialized newCols list");



// Retrieve form values
Map formValues = form.getFieldValues();
log.warn("Retrieved form values: " + formValues);



// Check if the application field is present and not null
if (formValues != null && formValues.containsKey("Application") && formValues.get("Application") != null) {



    String applicationIdOrName = (String) formValues.get("Application");
    log.warn("Application ID or Name from form: " + applicationIdOrName);



    // Fetch the Application object using the provided ID or name
    Application application = context.getObject(Application.class, applicationIdOrName);
    log.warn("Fetched Application object: " + application);



    if (application != null) {
        log.warn("Application name: " + application.getName());



        // Get the account schema from the application
        Schema schema = application.getSchema(Application.SCHEMA_ACCOUNT);
        log.warn("Retrieved account schema: " + schema);



        // Retrieve attribute definitions from the schema
        List attributes = schema.getAttributes();
        log.warn("Schema attributes count: " + (attributes != null ? attributes.size() : "null"));



        // Loop through each attribute and create a corresponding report column
        for (AttributeDefinition attribute : attributes) {
            String attrName = attribute.getName();
            log.warn("Processing attribute: " + attrName);



            // Use only the attribute name for field and header
            String field = attrName;
            String header = attrName;
            log.warn("Generated field: " + field + ", header: " + header);



            ReportColumnConfig config = new ReportColumnConfig(field, header, "java.lang.String");
            config.setProperty(String.format("attributes.%s", attrName));
            log.warn("Created ReportColumnConfig: " + config);



            newCols.add(config);
            log.warn("Added config to newCols");
        }
    } else {
        log.warn("Application object is null");
    }
} else {
    log.warn("Form values missing 'Application' or value is null");
}



log.warn("Returning newCols: " + newCols);
return newCols;
 
</Source>
</ExtendedColumnScript>

You can find example in Reports guide.

@suresh Reddy,

Kindly specify whether the report in question is Java, HQL, or Filter. From your statement, I understand it may be a Java-based report. Please confirm.

Kindly go through the document for a clearer understanding of the concept. If you find it helpful like it document.

3_LiveReports_FINAL.pptx (7.4 MB)

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