Flow Execution Error: Open Context Record

hanaphouse
Tera Guru

Previously, we are seeing the UI for the flow context errors but lately we have been receiving this. What could be the issue?

find_real_file.png

1 ACCEPTED SOLUTION

OlaN
Tera Sage

Hi,

If you turn off Flow debugging (it's turned off by default in PROD instances), this banner will show whenever you try to open a Flow Execution context on a Flow that has generated an error.

To enable flow debugging, set the system property com.snc.process_flow.reporting.level to ON

 

View solution in original post

9 REPLIES 9

Hai,

I've searched using global search also , I cannot find any, please find the below attachment.

shaik_chan_1_0-1681295286859.png

 

That property is not available by searching.

Enter:  sys_properties.list
in the navigation panel, and hit enter.
This opens all properties available.

Then search for the name above.

Thanks for the help OlaN.

I have sorted it out.

pooja0409
Tera Contributor
var MSHardwareAssetManagementUtil = Class.create();
MSHardwareAssetManagementUtil.prototype = {
    initialize: function() {
    },

    extractConditionFromDecisionTable: function(decisionTable, answerValue, regex, answerElementName) {
        var dt = new sn_dt.DecisionTableAPI();
        var response = dt.getQuestions(decisionTable);
        var results = response.result;
        gs.debug(JSON.stringify(results));
        var answerArr = [];
       

        // Loop through the questions/answers
        for (var i = 0; i < results.length; i++) {
            var result = results[i];
            var answerElementValues = result.answer.answerElementValues;

            if (answerElementValues.length) {
               
                // Loop through the answers only for each set of question/answers
                for (var j = 0; j < answerElementValues.length; j++) {
                    for(var k in answerElementValues){ //newly added code
                    if (
                        // If the answer value is the one we're looking for
                        answerElementValues[k].value == answerValue //modified
                        // AND the element is either anything (if we didn't specify an element name)
                        && (!answerElementName || answerElementValues[k].answerElementName == answerElementName) //modified
                    ) {
                       
                        // We have found our answer, now get the condition and, if we provided a regex, pull out the target string
                        if (regex) {
                           

                            var match = result.condition.match(regex);
                            if (match) {
                                if(answerArr.indexOf(match[1])) //newly added
                                answerArr.push(match[1]);
                            }
                        } else {
                            // If not, just provide the entire condition string
                            answerArr.push(result.condition);
                        }
                    }
                }
            }
            }
        }

        return answerArr;
    },
// below function works correctly
    getGroupStockrooms: function(groupID, groupType) {
        // Get the Decision Table sys_id from a system property
        var decisionTableID = gs.getProperty('ms_stockroom_groups_decision_table_id');
       
        // Define the regex pattern to extract the stockroom
        var regexPattern = /u_stockroom=(.*?)\^EQ/;

        // Use the extractConditionFromDecisionTable method
        return this.extractConditionFromDecisionTable(decisionTableID, groupID, regexPattern, groupType);
    },
// Below function may not work correctly as userGroups is an array of gliderecords--> suggested code
/*var userGroups=gs.getUser().getMyGroups();
 for (var i=0; i<userGroups.length;i++) { // *** hasNext will be used to loop, we need to change it to loop hasNext() to next()
            //var group = userGroups.next(); //
            var groupID = userGroups[i].getValue('sys_id');
 }*/
    getUserStockrooms: function(groupType) {
        var userGroups = gs.getUser().getMyGroups();
        var stockrooms = [];

        // Loop through each group the user belongs to
        while (userGroups.hasNext()) { // *** as array of glideRecords does not have has next it may not work
            var group = userGroups.next(); //maty not be needed
            var groupID = group.getValue('sys_id');

            // Get the stockrooms for this group
            var groupStockrooms = this.getGroupStockrooms(groupID, groupType);

            // Add them to the stockrooms array
            if (groupStockrooms.length > 0) {
                stockrooms = stockrooms.concat(groupStockrooms);
            }
        }

        // Return a blank array if no results are found
        return stockrooms.length > 0 ? stockrooms : [];
    },

    type: 'MSHardwareAssetManagementUtil'
};

pooja0409
Tera Contributor
/*var MSHardwareAssetManagementUtil = Class.create();
MSHardwareAssetManagementUtil.prototype = {
    initialize: function() {
    },

    extractConditionFromDecisionTable: function(decisionTable, answerValue, regex, answerElementName) {
        var dt = new sn_dt.DecisionTableAPI();
        var response = dt.getQuestions(decisionTable);
        var results = response.result;
        gs.debug(JSON.stringify(results));
        var answerArr = [];
       

        // Loop through the questions/answers
        for (var i = 0; i < results.length; i++) {
            var result = results[i];
            var answerElementValues = result.answer.answerElementValues;

            if (answerElementValues.length) {
               
                // Loop through the answers only for each set of question/answers
                for (var j = 0; j < answerElementValues.length; j++) {
                    for(var k in answerElementValues){ //newly added code
                    if (
                        // If the answer value is the one we're looking for
                        answerElementValues[k].value == answerValue //modified
                        // AND the element is either anything (if we didn't specify an element name)
                        && (!answerElementName || answerElementValues[k].answerElementName == answerElementName) //modified
                    ) {
                       
                        // We have found our answer, now get the condition and, if we provided a regex, pull out the target string
                        if (regex) {
                           

                            var match = result.condition.match(regex);
                            if (match) {
                                if(answerArr.indexOf(match[1])) //newly added
                                answerArr.push(match[1]);
                            }
                        } else {
                            // If not, just provide the entire condition string
                            answerArr.push(result.condition);
                        }
                    }
                }
            }
            }
        }

        return answerArr;
    },
// below function works correctly
    getGroupStockrooms: function(groupID, groupType) {
        // Get the Decision Table sys_id from a system property
        var decisionTableID = gs.getProperty('ms_stockroom_groups_decision_table_id');
       
        // Define the regex pattern to extract the stockroom
        var regexPattern = /u_stockroom=(.*?)\^EQ/;

        // Use the extractConditionFromDecisionTable method
        return this.extractConditionFromDecisionTable(decisionTableID, groupID, regexPattern, groupType);
    },
// Below function may not work correctly as userGroups is an array of gliderecords--> suggested code
/*var userGroups=gs.getUser().getMyGroups();
 for (var i=0; i<userGroups.length;i++) { // *** hasNext will be used to loop, we need to change it to loop hasNext() to next()
            //var group = userGroups.next(); //
            var groupID = userGroups[i].getValue('sys_id');
 }*/
    getUserStockrooms: function(groupType) {
        var userGroups = gs.getUser().getMyGroups();
        var stockrooms = [];

        // Loop through each group the user belongs to
        while (userGroups.hasNext()) { // *** as array of glideRecords does not have has next it may not work
            var group = userGroups.next(); //maty not be needed
            var groupID = group.getValue('sys_id');

            // Get the stockrooms for this group
            var groupStockrooms = this.getGroupStockrooms(groupID, groupType);

            // Add them to the stockrooms array
            if (groupStockrooms.length > 0) {
                stockrooms = stockrooms.concat(groupStockrooms);
            }
        }

        // Return a blank array if no results are found
        return stockrooms.length > 0 ? stockrooms : [];
    },

    type: 'MSHardwareAssetManagementUtil'
};*/