Change request - Request Approval- Service Operations Workspace

Shubham Zanwar
Tera Expert

After the form is filled and save if we click on the 'Request Approval' button on the form it will ask to do the 'Risk Assessment' in the related list. If Risk assessment is done only then it will change state to assess after clicking the Request approval button. 

It is working fine in the Default view but it is not working in the Service Operations Workspace.
 Here is the UI action code for thew Request Approval button:

function onClick(g_form) {
 var riskAssessment = new GlideAjax('Risk_Assessment');
    riskAssessment.addParam('sysparm_name', 'riskCompleted');
    riskAssessment.addParam('sysparm_current', g_form.getUniqueValue());
    riskAssessment.getXMLAnswer(getResponse);
    function getResponse(response) {
        var res = response;
        if (res === 'true') {
            g_form.setValue("state", "-4");
            gsftSubmit(null, g_form.getFormElement(), 'state_model_request_assess_approval');
        } else {
            g_form.addInfoMessage("Please complete the Risk Assessment before moving to Assess State. Click on the Risk Assessment in the Related Links below");
        }
    }
}
if (typeof window == 'undefined') {
    updateAndRedirect();
}
function updateAndRedirect() {
    current.update();
    action.setRedirectURL(current);
}
 
 
Working fine :- If the Risk assessment is not done its perfectly showing the error/info message as you can see in the code.
 
What we need to do is, If the Risk assessment is done its not changing its state to Assess.  
 
Please suggest me a solution for this.
Thank you!
0 REPLIES 0