Reset group approval UI ACTION

set the UI action as 'client'

script:

function trigger_new_approval_ritm(){
                var res=confirm(getMessage(ritm.changeapprovalgrp'));
                if (res){
                                alert(getMessage(‘ritm.approvalgroup.resendemails'));
                                gsftSubmit(null, g_form.getFormElement(), 'resend_email'); //--MUST call the 'Action name' set in this UI Action
                }
}

if (typeof window == 'undefined'){
                resend_approval();
}
function resend_approval(){

                var grRITM=new GlideRecord('sc_req_item');
                if (grRITM.get('sys_id', current.parent)){


                                var grApprGrp=new GlideRecord('sysapproval_group');
                                grApprGrp.newRecord();
                                grApprGrp.parent=current.parent;
                                grApprGrp.assignment_group=current.assignment_group;
                                grApprGrp.short_description='approval re-generated by '+ gs.getUserName();
                                grApprGrp.approval=current.approval;
                                grApprGrp.insert();

                                current.approval='not_required';
                                current.update();
                               
                                var wf = new Workflow().getRunningFlows(grRITM);
                                while(wf.next()) {
                                                //--RITM workflow picks this up and handles setting the old group approval back
                                                new Workflow().broadcastEvent(wf.sys_id, 'ritm.grpapproval.changed');
                                }
                                action.setRedirectURL(grRITM);

                }
                gs.addInfoMessage(gs.getMessage('ritm.approvalgroupchanged') + ' ' + gs.getUserName());
}

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue