Requested for not populated in catalog item

Anna_Servicenow
Tera Guru

We have catalog item that doesn't have 'requested_for' (default one referring to user table), but another one with same name and its a choice (user or group).

 

Now, In the Request,RITM and SCTASK, the requested for is not populating on submitting Request. How can I fix this ?

11 REPLIES 11

ChiranjeeviR
Kilo Sage

Hi @Anna_Servicenow ,

 

Try dong this from the REQ through a before Business Rule. I have detailed the business rule below:

Name: Populate Requested for Field
Table: Request [sc_request]
Active: true
When: before
Insert: true
Condition: [leave blank]
Script:

var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request', current.sys_id);
grRITM.query();
while (grRITM.next()) {
if (!JSUtil.nil(grRITM.variables.open_for)) {
current.requested_for = grRITM.variables.open_for;
}
}

If my response helped please mark it correct and close the thread

ChiranjeeviR_0-1721046126196.png

Thanks & Regards,
Chiranjeevi
ServiceNow Developer | | ITSM | | ServiceNow Discovery | | Event Management | | Service Mapping | | CMDB

Please mark as Correct Answer/Helpful, if applicable.

swathisarang98
Giga Sage
Giga Sage

Hi @Anna_Servicenow ,

 

By default once the request is raised you will get Requested for and opened by with the user who raised the request but still if you want to show Requested for in the variable section You can create a reference type field and reference it to User table and create a onload client script and get the current logged in user and set the value to new field and if you dont want user to change it while raising request make it as read only 

 

Field:

swathisarang98_0-1721046642869.png

Catalog client script:

swathisarang98_1-1721046664057.png

Result:

swathisarang98_2-1721047088012.png

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang