This sample script demonstrates how to create and insert hardcoded rows into a grid. It is particularly useful in scenarios where users are only required to input values in specific columns, ensuring a controlled data entry process.

Applicability

This functionality must be implemented in the pre-form action. This is necessary because the grid is automatically generated when the form is opened, so the required rows must be set up beforehand.

Code Example

The following example demonstrates how to hardcode or predetermine rows in the Financial Impacts grid.

// Create Row for Financial impact Grid​
    //​
​
    var ds = new List<‍‍‍Dictionary<‍‍‍string, string‍‍‍>‍‍‍> ​
    { ​
        new Dictionary<‍‍‍string, string‍‍‍>() { {"fr", "Impact"}, {"en", "Impact"}, {"de", "Auswirkung"}, {"ar", "تأثير"}}​
    };​
    domainObject.BPMAPP_BCM_Financial_Impact_GridsBIARef = new List<‍‍‍Ray.BPMApp.BCM.Model.BPMAPP_BCM_Financial_Impact_Grid‍‍‍>();​
    ​
    foreach (var S in ds)​
    {​
        var row = bpmAppService.BPMSServices.DomainObjectService.CreateDomainObject<‍‍‍Ray.BPMApp.BCM.Model.BPMAPP_BCM_Financial_Impact_Grid‍‍‍>();​
        row.BPMAPP_BCM_BIABIARef = formObject.DomainObject;​
        row.Hours = S[language];​
        formObject.DomainObject.BPMAPP_BCM_Financial_Impact_GridsBIARef.Add(row);

Result