Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Where to add action.setRedirectedURL(current) in client callable UI action.

Obito
Tera Expert

Hi all, My client callable UI action is being redirected to other page. I used action.setRedirectURL(current) but it is still being redirected to other page. Please refer below code.

 

function doIt() {
    if (confirm("Are you sure")) {
        //alert("You clicked yes");
        gsftSubmit(null, g_form.getFormElement(), 'populate');
    }
}

if (typeof window == 'undefined')
    updateRecord();

function updateRecord() {
    var inputs = {};
    inputs['table_name'] = 'incident';
    inputs['incident'] = current;
    // Start Asynchronously: Uncomment to run in background.
    sn_fd.FlowAPI.startFlow('global.Test Inc', inputs);
    action.setRedirectURL("https://dev223110.service-now.com/incident.do?sys_id=57af7aec73d423002728660c4cf6a71c");
    // Execute Synchronously: Run in foreground.
    //sn_fd.FlowAPI.executeFlow('global.[internal name of flow]', inputs);
}

 

 

5 REPLIES 5

Uncle Rob
Kilo Patron

The others have shown you THAT its a server side script, but not why.
The setredirect is in preparation for after the database transaction, and is thus not client side.