UI Action not working in Platform UI

Annette Kitzmil
Tera Guru

Hello,

I am working on ATFs and while doing so, I realized that the UI Actions that are working in the Workspace are not working in the Platform UI.  The Approve UI Action button is showing in the Platform UI, but the update when clicking the UI action button isn't happening  Below is an example of the <Approve> button UI Action and related code.  Can someone point me in the right direction as to why the update isn't happening in the Platform UI, but is working in the Workspace please?

 

AnnetteKitzmil_0-1717611488979.png

 

Condition AJAX Script being called from above screen shot:

    canViewApproveButton: function(current) {
        var bm_group = gs.getProperty('x_mtbr_ebs_rdep.redp.bank_managers.group');
        var pricing_group = gs.getProperty('x_mtbr_ebs_rdep.redp.pricing_team.group');
        var branch_num = current.opened_by.cost_center.account_number.toString(); // checks user costcenter has TCC
        if (branch_num == '1043') {
            if (((current.status == 'submitted' || current.status == 'resubmitted') && gs.getUser().isMemberOf(pricing_group)) || (gs.hasRole('admin') && (current.status == 'submitted' || current.status == 'resubmitted'))) {
                return true;
            }
            return false;
        } else if (((current.status == 'submitted' || current.status == 'resubmitted') && gs.getUser().isMemberOf(bm_group)) ||
            (current.status == 'bm_approved' && gs.getUser().isMemberOf(pricing_group)) ||
            (gs.hasRole('admin') && (current.status == 'submitted' || current.status == 'resubmitted' || current.status == 'bm_approved'))) {
            return true;
        }
        return false;
    },

 

UI Action Workspace Details:

AnnetteKitzmil_1-1717611530069.png

 

Code in Workspace Client Script:

function onClick(g_form) {
    g_modal.showFields({
            title: "Enter Approval comments",
            fields: [{
                type: 'textarea',
                name: 'work_notes',
                label: getMessage('Reason'),
                mandatory: true
            }],
            size: 'lg'
        }).then(function(fieldValues) {
            //call AJAX script      
        //alert(fieldValues.updatedFields[0].value);
            var ga = new GlideAjax('x_mtbr_ebs_rdep.RDEPUtilsAJAX');
            ga.addParam('sysparm_name', 'rdepApprovalUpdate');
            ga.addParam('sysparm_state', 'bm_approved'); // rejected
            ga.addParam('sysparm_comments', fieldValues.updatedFields[0].value);
           
            ga.addParam('sysparm_sysid', g_form.getUniqueValue());
            //alert(fieldValues.updatedFields[0].value);
            ga.getXML(reload);
        });
}

function reload() {
    g_form.reload();    
}
 
Related AJAX script being called:
rdepApprovalUpdate: function() {
        //  gs.info('RDEPUtilsAJAX');
        var sysId = this.getParameter('sysparm_sysid');
        //var statusCode = this.getParameter('sysparm_state'); //  
        var comments = this.getParameter('sysparm_comments'); // used for Approval notes
        var grRDEP = new GlideRecord('x_mtbr_ebs_rdep_retail_deposit_exception_pricing');
        grRDEP.get(sysId);
        var branch_num = grRDEP.opened_by.cost_center.account_number.toString();
        var statusCode = grRDEP.getValue('status');
        if (branch_num == '1043') {
            if (statusCode == 'submitted' || statusCode == 'resubmitted') {
                grRDEP.status = 'pt_approved';
            }

        } else {
            if (statusCode == 'submitted' || statusCode == 'resubmitted') {
                grRDEP.status = 'bm_approved';

            } else if (statusCode == 'bm_approved') {
                grRDEP.status = 'pt_approved';
            }
        }

        grRDEP.comments = comments;

        grRDEP.update();
        //   return grRDEP.sys_id;

    },
1 ACCEPTED SOLUTION

Annette Kitzmil
Tera Guru

OK, I think I figured out the why, from what I can tell, as long as the Client Script check box is "true", it will not work on the Portal view because it is server side.  So, I will need to script the update instead for the ATFs that I am working on that are using the Portal UI instead of the workspace.

View solution in original post

1 REPLY 1

Annette Kitzmil
Tera Guru

OK, I think I figured out the why, from what I can tell, as long as the Client Script check box is "true", it will not work on the Portal view because it is server side.  So, I will need to script the update instead for the ATFs that I am working on that are using the Portal UI instead of the workspace.