The CreatorCon Call for Content is officially open! Get started here.

Automate decision table to update via flow

Varun Sharma
Tera Expert

Hi Team, 

 

I've a requirement where i've created a decision table which contain multiple output result for single input value. 

I want a flow to run via service catalogue ,so the requestor can update the values in Decision table and keep it updated. 

What scripting API can i use, i'm not able to understand how the output values are stored and if i can pick and choose what i want to update . 

kindly assist. 

 
1 ACCEPTED SOLUTION

Varun Sharma
Tera Expert

Hi Everyone , 

 

anyone faces similar requirements in future, 

here is how i did it , 

 

 var decisionTableGR = new GlideRecord('sys_decision');
    decisionTableGR.addQuery('sys_id', decisionTableSysId);
    decisionTableGR.query();
    if (decisionTableGR.next()) {
        var decisionAnswerGR = new GlideRecord('sys_decision_question');
        decisionAnswerGR.addEncodedQuery('decision_table=table_SYS ID ^active=true'');
        decisionAnswerGR.query();
        while (decisionAnswerGR.next()) {

            var resultElements = decisionAnswerGR.answer.toString();
            var grDecisionResult = GlideRecord('sys_decision_multi_result');
            grDecisionResult.get(resultElements);

            grDecisionResult.result_elements.variableONTable = newVariableValue;
            grDecisionResult.update();

        }

View solution in original post

7 REPLIES 7

Jon23
Mega Sage

Hi @Varun Sharma,

I don't know how to do it using scripting, however, fully automating the process sounds risky as you will want to validate values so they don't inadvertently break your decision table.

 

I would suggest exporting the decision table as an Excel file.  This file can be used by your users to update values and attach to a catalog item.  This catalog request would open a task (with attachment) to a team(admin).

Team performs the import on sub-prod for validation, if approved, import to production.

@Jon23 My business requirement is that we create approval based on the category, 

these owners and subowners for the category often change, earlier these values were hard coded, i've now updated these values in Decision table and i'm automating the updation of owner and subowners via the Service catalogue. 

 

Regards, 

Varun Sharma

@Varun Sharma 

You would still have some automation using the spreadsheet approach. The end user would modify the values in the spreadsheet and upload to a catalog item.  

If decision table configuration changes to add new inputs/outputs, simply create the new Excel file. Excel file is easily created from the decision table form

 

IMO this would be an easier/safer approach, and keep controls in place so not to break the decision table.

Ankur Bawiskar
Tera Patron
Tera Patron

@Varun Sharma 

why would end user input something which will update the Decision table itself?

Decision table is to be updated by developers.

what's your business requirement for this?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader