UI Action to Flow Designer

Al-jhon
Kilo Sage

Hello All,

 

Is there a way to pass the data from dialog box to flow designer?

Aljhon_0-1708578043792.png



I want to pass the sysid of user selected from dialog box to the flow designer and trigger the flow when click ok.

9 REPLIES 9

@Ankur Bawiskar do you have idea on this? Thank you! 

Ankur Bawiskar
Tera Patron
Tera Patron

@Al-jhon 

you can trigger flow via script and pass the user sysId as input to flow

where are you stuck?

From the UI page you have 2 options

1) use UI page client script and use GlideAjax and add the code to script include function

2) use UI page processing script directly to use the server side code

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

Hello @Ankur Bawiskar , this is my script in Processing Script:

function continueOK() {

var newapprover = document.getElementById('approver').value;
var sysId = gel('record_sys_id').value;

alert(newapprover); // has value which is the sysid of the selected new approver
alert(sysId); // sysid of the Approval Record

var rec = new GlideRecord("sysapproval_approver");
    rec.addQuery('sys_id', sysId);
    rec.query();
    if(rec.next()){
        rec.approver = newapprover;
        rec.update();
    }
}

function continueCancel() {

    GlideDialogWindow.get().destroy();
}
but upon clicking OK, there's nothing happen, it did not change the approver field.
Aljhon_0-1708587795570.png


I leave the Client Script blank.


This is my HTML:


<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form>
        <g:evaluate var="jvar_sysid" expression="RP.getWindowProperties().sysid"/>
        <input type="hidden" id="record_sys_id" name="record_sys_id" value="${jvar_sysid}"/>
        <table>

            <tr>
                <td style="width:25%">
                    <g:form_label>
                        New Approver:
                    </g:form_label>
                    <g:ui_reference name="approver" id="approver" table="sys_user" completer="AJAXTableCompleter"/>
                </td>
            </tr>
            <tr>
                <td>
                    <g:dialog_buttons_ok_cancel ok_id="submitData" ok_type="button" ok_text="${gs.getMessage('Ok')}" ok="return continueOK();" cancel_type="button" cancel_id="cancelData" cancel="return continueCancel();" />
                </td>
            </tr>
        </table>
    </g:ui_form>
</j:jelly>

@Al-jhon 

are you sure you are sending the sysId of record correct to that UI page?

are you sure you are getting the approver sysId correctly?

First debug that and it will help

 

 

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

@Ankur Bawiskar , yes i debug using the alert and it gives correct sysid's that i need.
And i can't update the value on Approver field using UI Page' client script or process script.

But using flow designer i can update the approver value. I'm stuck with how to pass the value from dialog window to FD.

I will do more research.