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.

How can we edit the catalog item variable values after submission before approval?

prasanna11
Giga Guru

I have a requirement where approver must be able to tweak some values of request (variable values for that request) , before approving it. Is there a way to achieve it?

11 REPLIES 11

Supriya32
Kilo Contributor

Hi Prasanna,

Can you please tell me how you resolved this issue? That would be helpful.

Thanks,

Supriya

Mohana Rangan R
Mega Contributor
first write a Onload function 
2 glide sc req table and get the sys id of the RITM 
3 pass it to SI and check for state is requested  or u may put the approver into a group and check logged in user who is accessing the RITM is member of that grp .
4 return true or false and pass it to CCS and make the required fields visible or mandatory or read only .

hope the approver needs to manually open the RITM record and then update the var if required or he could edit the data in that var .
On load script 
var RITM ----GlideRecord('sc_req_item');
RITM.addQuery('number', g_form.getValue('number'));
RITM.query();
if (RITM.next())
{sysID = RITM.sys_id;
}
var ge = new GlideAjax('Non_Person_LAN_Login_ID_approver');
    ge.addParam('sysparm_name', 'tocheckmemberof');
ge.addParam('sysparm_id', sysID);
ge.getXML(setInfo);
function setInfo(response){
  alert("into setInfo function");
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'true')
{
g_form.setReadOnly('var name ', false);
}
}
}
 
 
SI part 
tocheckmemberof: function() {
var val = this.getParameter('sysparm_id');
var approval *******GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval', val);
    approval.addQuery('state', 'requested');
    approval.query();
    if (approval.next()&&gs.getUser().isMemberOf(if any approver grp name ))
       return true;
   else
return false;