Issues with Overriding of requested for on REQ and RITM with a particular logged in user.

Sonu Singh
Mega Expert

Hi All,

When User1 submits the catalog Request with Requested For as REQUser1,  then in REQ and RITM form Requested For is getting changed to User1

But if i impersonate user to any other user say USER2, then its working fine. whatever was mentioned requested for on the catalog form its getting populated same in REQ and RITM form.

This is occurring for a particular user. Can anyone please help to understand why it is happening.

 

Regards,

Ak

 

 

1 ACCEPTED SOLUTION

Do note that post was only about sc_request. So you also need to add a query for your sc_cart.
An extract from that post:

---

Business Rule
Table: sc_req_item
Insert = true
When: Async

Condition:

current.request.requested_for != current.variables.requested_for

Script:

(function executeRule(current, previous /*null when async*/) {

	var grREQ = new GlideRecord('sc_request');
	grREQ.get(current.getValue('request'));

	grREQ.setValue('requested_for', current.variables.requested_for);
	grREQ.update();
		
})(current, previous);

Works instantly.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Did you try clearing cache using cache.do and check?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

No, can u guide me where should i use cache.do

@Ankur Bawiskar 

I just tried it now, but it didn't helped me

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you share how/what you are trying with some screenshots? Did you also set something up for this or completely out-of-the-box?

Out-of-the-box there is a default value on the requested_for field on sc_request. This same field is shown on sc_req_item (out-of-the-box there is actually no requested for field on sc_req_item, it's dotwalked from the sc_request).

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn