Write Reference Field Value on catalog item to Reference Field on RITM

richelle_pivec
Mega Guru

I have a reference field (Request Submitted For (u_request_submitted_for)) on a catalog item, and I'd like to populate a Request Submitted For (u_request_submitted_for) field on the RITM with the value that team members put in on the catalog item. I've tried a few things to make this happen, but nothing seems to work. It will work if I want to take the reference field on the catalog item and map it to a string field on the RITM, but it does not work to map it to a reference field on the RITM.

We'd like to use the reference field so that we can run a report that says, Request Submitted By (requested_for) "Pivec, Richelle" or Request Submitted For (u_request_submitted_for) "Pivec, Richelle." Using a text field would technically work for reporting but it would confuse our team members as to why they are different field types. (Of course the catalog automatically puts in the Requested Submitted By (requested_for) value, but that comes from the Catalog itself and is not inside the catalog item.

Is this something that can even be done? I am beginning to suspect that one cannot write a reference field on a catalog item to a reference field on an RITM...

Thanks,

Richelle

1 ACCEPTED SOLUTION

I see your issue ... You have them switched where you are trying to set the values.

Your script

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

	// Add your code here
    if (current.variables.RequestSubmitted != "")
	current.RequestSubmitted = current.variables.u_request_submitted_for.toString();

})(current, previous);

What should work

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

	// Add your code here
    if (current.variables.RequestSubmitted != "")
	current.u_request_submitted_for = current.variables.RequestSubmitted.toString();

})(current, previous);

View solution in original post

9 REPLIES 9

Think you have issues with the names of things.  Can you send me a screenshot of the variable on the catalog item, and a screenshot of the dictionary record for the field on the RITM?  Then I can adjust the script to work.

richelle_pivec
Mega Guru

Yes, here they are...thank you again for helping me with this:

 

find_real_file.png

find_real_file.png

I see your issue ... You have them switched where you are trying to set the values.

Your script

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

	// Add your code here
    if (current.variables.RequestSubmitted != "")
	current.RequestSubmitted = current.variables.u_request_submitted_for.toString();

})(current, previous);

What should work

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

	// Add your code here
    if (current.variables.RequestSubmitted != "")
	current.u_request_submitted_for = current.variables.RequestSubmitted.toString();

})(current, previous);

Yes! That worked.

Thank you so much!

Richelle

 

richelle_pivec
Mega Guru

I did have them named the same thing in both places, but it started confusing me so I made the catalog item different. However, when I tried the straight up "Map to Field" option, the names were matching.

Thanks,

Richelle