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.

Risk Assessment to be made mandatory before requesting for approva;l

Vishnu V Reddy
Tera Contributor

Hi all,

So, i am looking to make the risk assessment mandatory before requesting for approval?

What is the best way to do it? Please suggest ASAP.

3 REPLIES 3

pavanbangaru
Tera Contributor

Hi Vishnu,



Modify the UI action "request approval" and check for the risk value. If it is not filled then return false. SOmething like below:



function checkRiskValue(){


var riskValue = g_form.getValue('risk');



if(!riskValue){


alert("please take risk assessment to proceed forward");


return false;


}


}



Regards


Pavan



Mark Correct /Helpful /Like based on the effect of response.


preddy
Kilo Guru

Hi Vishnu,



Update the Request Approval UI action: try below code



if (typeof window == 'undefined')


    updateAndRedirect();



function updateAndRedirect() {


      var grAss = new GlideAggregate('task_assessment');


      grAss.addQuery('task',current.sys_id);


      grAss.addAggregate('COUNT');


      grAss.query();


      if(grAss.next()){


              if(parseInt(grAss.getAggregate('COUNT')) > 0)


                      current.update();


              else


                      gs.addInfoMessage('Please fill out the Risk assessment');


      }


      action.setRedirectURL(current);


}



Regards


Pavan



Mark Correct /Helpful /Like based on the effect of response.


Hi,

I need one more thing here,

 

I just want to open the risk assessment form with the message & after the risk assessment I want to open risk calculation 

How to do that?

Please help me..