How to populate reference field on the RITM from a reference variable?

Mjennings
Tera Expert

Hello, 

I have a reference field on the RITM u_portfolio as well the field is found in the variables. What I need is when someone submits a request that I can pull the variable and set the portfolio RITM field. multiple requests and workflows will need to complete this same action. I have tired a couple things with run script in Workflow that are current.portfolio = current.variable.business_line; but that did not work. 

 

Thank you, 

2 ACCEPTED SOLUTIONS

I hope these screenshot can help. but you are correct. I have attached a screenshot of the Variable, and the RITM field. also on the last Screenshot you can see the "Line Of Business2" field is populated, but the "Portfolio2" field is not. Thank you!
Referenced VariableReferenced Variable

Mjennings_0-1706533311147.png

Mjennings_3-1706533602868.png

 

 

Line of business 2 values shown in the portfolio2 fieldLine of business 2 values shown in the portfolio2 field

 

View solution in original post

Hello @Mjennings ,

 

In the last screenshot - The field portfolio2 is showing in dropdown. Might be both fields are of different type thats why it is not populating value of variable. Please check the type of variable and field. 


And then change your code with below 

current.u_portfolio2= current.variables.line_of_business2

 

If you find it helpful please mark my answer as accepted solution and helpful. 

 

Regards,

Vaishnavi Shinde 

View solution in original post

9 REPLIES 9

Fixed, but, Still not working

Vishal Birajdar
Giga Sage

Hello @Mjennings 

 

Your logic looks good only thing is that it should be like this  'current.variables.business_line'

 

Try below code in your workflow :

current.portfolio = current.variables.business_line;

 

**Add some logs in script to debug if you are getting values properly...!!

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Fixed, Still not working

Both variable and field on ritm form refer to same table....??

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Yes, both are pulling from u_portfolio_items

Mjennings_0-1706557626210.png