The CreatorCon Call for Content is officially open! Get started here.

Set requested for values based on catalog variable value

Kumar Nandan
Tera Contributor

Hi All

 

We have a catalog variable called Username and based on the value filled in it the requested for should get populate on the sc_request form.

 

Currently its setting to the current logged in user by default.

Please help me to set the requested for based on the value filled in Username field.

 

@Ankur Bawiskar  Please help me .

 

find_real_file.png

 

Regards

Nandan

4 REPLIES 4

Aman Kumar S
Kilo Patron

Hi @Kumar Nandan 

You can follow this no-code approach in the field:

Catalog Data Lookup Definition on any table, eliminating Catalog Client Scripting

Best Regards
Aman Kumar

Hi @Kumar Nandan 

Is your issue resolved?


Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi @Kumar Nandan 

requested_for field on sc_request is set to logged in user OOB

in the after insert BR on sc_req_item table do this

BR Condition: current.cat_item.name == 'Your Catalog Item Name Here'

Script:

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

	// Add your code here
	var req = current.request.getRefRecord();
	req.requested_for = current.variables.username; // give correct variable name here
	req.update();

})(current, previous);

Regards
Ankur

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

Hi @Kumar Nandan 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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