UI Action "Show Flow" is not working for custom table

Rajesh Bandila
Tera Contributor

Hi Everyone,

 

I have an custom table called "SSB Request" that run on Flow Designer and flow gets cancelled and new flow attached for different conditions met. I have created the UI action related link "SHOW FLOW". I have written the below Script Include and UI action Script and it's working partially by opening latest attached flow to the record.

But, My requirement is when user clicks the "Show Flow" link, I want to get opened all flows that are attached to that record. How to achieve this?


Script Include:

 
var AjaxUtils = Class.create();
AjaxUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    getFlowContext: function() {
        var id = this.getParameter('sysparm_id');
        var flowContextGR = new GlideRecord('sys_flow_context');
        flowContextGR.addQuery('source_table''u_ssb_change_request');
        flowContextGR.addQuery('source_id', id);
        flowContextGR.query();
        var ids = [];
        while (flowContextGR.next()) {
            ids.push(flowContextGR.getValue('sys_id'));
        }
        return JSON.stringify(ids);
    },
    type: 'AjaxUtils'
});
 
UI action Script:
function showFlowContext() {
    var id = g_form.getUniqueValue();
    var ga = new GlideAjax('AjaxUtils');
    ga.addParam('sysparm_name''getFlowContext');
    ga.addParam('sysparm_id', id);
    ga.getXMLAnswer(function(response) {
        var ids = JSON.parse(response);
        for (var i = 0; i < ids.length; i++) {
            g_navigation.open('/$flow-designer.do#/operations/context/' + ids[i], "_blank");
        }
    });
}
Thanks,
Rajesh
2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajesh Bandila 

I think you will have to modify the URL which gets opened.

Ideally it makes sense to show the current flow attached rather than all previous ones.

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

Hi @ankur

My requirement is like I want to show current flow attached. How should I configure my UI action?

 

 

 

thanks

bharat