Approval Form with Option for More Info Needed

darronf
Tera Expert

I'm needing some option to allow approvers the option to request more info when approving / rejecting from the Ask for Approval action in Flow Designer.  This option is only needed for one Catalog Item.  I tried to create a widget that would show on the Approval Form if the RITM matched the sys id of the Catalog Item and would show a checkbox variable "need_more_info" for the Approver to toggle without having to make a decision.  

 

The idea was to have that action trigger a Task creation for a specific individual to gather the requested info and feed it back into the RITM.  Is this the right track, or is there a different approach?

 

Here's the Widget info I attempted (the widget displays but does not display the variable needed):

HTML Template:

<div>
    <h3>Need More Info</h3>
    <p>{{c.needMoreInfo}}</p>
</div>

<p>
  Test
</p>

 

Client Script:

(function() {
    var c = this;
    c.needMoreInfo = '';

    // Fetch the catalog item variable
    spUtil.get('sp-variable-value', {
        'sys_id': '5a3fc9f347a01a50a90c97d9126d437e',
        'variable_name': 'need_more_info'
    }).then(function(response) {
        console.log('Variable Value:', response.data.result);
        c.needMoreInfo = response.data.result;
    });
})();

 

Server Script:

(function() {
    data.needMoreInfo = '';
    var gr = new GlideRecord('sc_item_option_mtom');
    gr.addQuery('request_item', '5a3fc9f347a01a50a90c97d9126d437e');
    gr.query();
    while (gr.next()) {
        var optionGr = new GlideRecord('sc_item_option');
        optionGr.get(gr.sc_item_option);
        if (optionGr.item_option_new.name == 'need_more_info') {
            data.needMoreInfo = optionGr.value;
            break;
        }
    }
    gs.log('Server Script Variable Value: ' + data.needMoreInfo);
})();

 

0 REPLIES 0