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

UI Actions FSM (Start Travel Start Work, Close Complete on wm_task) are not working in Worksapce

Research
Tera Guru

Hi All OOTB ui action of FSM  is working fine in native view but not working in configurable workspace view 

Can any one guide any script or what I am missing on it 

please refer this link: https://your instance/ sys_ui_action.do?sys_id=933bdef31b03200050fdfbcd2c071365&sysparm_record_target=sys_ui_action&sysparm...

or

Please check below OOTB ui action script

Research_0-1699776050889.png

 

Research_5-1699776257406.png

 

 

Research_1-1699776146129.png

 

Research_3-1699776178822.pngResearch_4-1699776224484.png

Please guide me with script 

Thanks.

9 REPLIES 9

Can you try this by adding it in Workspace client script section. what does this dialog box do "sm_open_task_upstream_work" in native side ? 

function onClick(g_form) {
    var gajax = new GlideAjax("SMTaskDependency");
    gajax.addParam("sysparm_name", "checkUpstreamTasks");
    gajax.addParam("state_flow_id", "b48e00ead7201100158ba6859e6103c7");
    gajax.addParam("sysparm_uuid", g_form.getUniqueValue());
    gajax.getXMLAnswer(ajaxResponse);

    function ajaxResponse(response) {
        if (response == 'true')
            showDialogWork();
        else {
            g_form.submit('start_work');
            var ajax = new GlideAjax('GeolocationAJAX');
            ajax.addParam('sysparm_name', 'checkTracking');
            ajax.addParam('sysparm_usersysid', g_user.userID);
            ajax.getXML(function(response) {
                var isUserTracked = response.responseXML.documentElement.getAttribute("answer");
                var result = isUserTracked.split(',');
                if (result[0] == 'true') {
                    navigator.geolocation.getCurrentPosition(
                        function(position) {
                            var ajax = new GlideAjax('GeolocationAJAX');
                            ajax.addParam('sysparm_name', 'storeGeolocationHistory');
                            ajax.addParam('sysparm_usersysid', g_user.userID);
                            ajax.addParam('sysparm_latitude', position.coords.latitude);
                            ajax.addParam('sysparm_longitude', position.coords.longitude);
                            ajax.addParam('sysparm_action', 'Start Work');
                            ajax.addParam('sysparm_task', g_form.getUniqueValue());
                            ajax.getXML();
                        });
                }
            });
        }
    }

    function showDialogWork() {
        g_modal.showFields({
            title: "Are you sure?",
            fields: [{
                type: 'fieldType',
                name: 'fieldName',
                label: 'YourField',
                mandatory: 'true'
            }],
            instruction: 'This action can\'t be undone.',
            size: 'md',
            cancelTitle: "Not now",
            confirmTitle: 'Start work',
            cancelType: "default",
            confirmType: 'confirm'
        }).then(function() {
            g_form.submit('start_work');
        });
    }
}

 

Research
Tera Guru

Hi @Dibyaratnam 
Dialog box will start work in word order task and calculate the duration

 


This is pop up I am getting

 

Research_0-1699793286382.png

 

But there is no check box  to proceed 

 

Thanks.

Dibyaratnam
Tera Sage

Can you share the screenshot and let me what exact calculation it's doing. Is there any field on the dialog box. That logic needs to be added.

Also if you see this section

 g_modal.showFields({
            title: "Are you sure?",
            fields: [{
                type: 'fieldType',
                name: 'fieldName',
                label: 'YourField',
                mandatory: 'true'
            }],

Here you can pass fields as per your requirement.

Research
Tera Guru

Hi @Dibyaratnam 

 

The moment we click on start work (ui action)

Below tab wil start calculating(native Ui)

Research_0-1699852431661.png

 

 

Thanks.

And how these fields are used. What's the purpose. Accordingly you can create this modal by using g_modal as I have pasted in the previous replies.