RITM form has "Requested For" field as blank even if I fill the same in service portal form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 02:42 AM
RITM form has "Requested For" field as blank even if I fill the same in service portal form (Catalog item form).Please refer my attached snippets.
For "Requested For", I am using reference type variable
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 02:53 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 03:26 AM
This would auto populate the value in the form, but will not map it to the field on submit.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2019 02:38 AM
Hi Santhana,
Please write a Business rule On the sc_request table
After, insert, Update
Code:
function executeRule(current, previous /*null when async*/) {
var request = new GlideRecord("sc_req_item");
if(request.get('request',current.sys_id)){
var req_for = request.variables.u_requested_for;
if(req_for != undefined || req_for == ''){
current.requested_for = req_for;
}
}
})(current, previous);
Please mark reply as Helpful/Correct, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 03:24 AM
Since this is a requested item, mapping to the field doesn't happen automatically. What we have done in our system is, we added a business rule.
Business Rule: After - On Insert
You could try script something like this.
(function executeRule(current, previous /*null when async*/) {
//Get Location and Requested for values from Catalog item and populate on Requested Item.
var user = current.variables.requested_for;
//var location = current.variables.location;
//var requester = current.variables.requester;
//current.location.setValue(location); // Populate Location
if(user){
current.request.requested_for.setValue(user);
}
else{
current.request.requested_for.setValue(requester);
}
current.update();
})(current, previous);