AutoPopulate a reference field based on another reference both fields referring same table

Community Alums
Not applicable

Need to auto populate application business unit which is a reference field referring (cmdb_ci_business_app) depending on the business application field which is also a reference field also referring to (cmdb_ci_business_app) table on a catalog form.

Variable 1: Business Application (Reference - cmdb_ci_business_app)

variable 2: Application business unit(reference-cmdb_ci_business_app)

tried the autopopulate option on the variable it is populating on form level but on ritm its clearing the value.

written a script include and onchange client script also

able to get the value from script include but not able to set on the field . Its setting the value and clearing immediately 

please help

1 ACCEPTED SOLUTION

@Community Alums 

For this case you can use 2nd variable as string type and populate the Business unit via onChange client script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

15 REPLIES 15

Community Alums
Not applicable

@Ankur Bawiskar Both variables are referring to same table. But both are not displaying same value where as variable 1 would be displaying the value of name and variable 2 the business unit of that name.
FYI please refer below screenshots.

Sandy11971_0-1735548803356.png
VARIABLE 1: This would be displaying the Business Application Name value.
Sandy11971_1-1735549232153.png

VARIABLE 2: This is referring to same table but this needs to show the "BUSINESS UNIT" value of the business application selected in the variable 1.

Sandy11971_2-1735549621545.png

Thank you so much for all the guidance throughout

 

@Community Alums 

please share screenshot of 1st variable Type specifications section

Example: I have 2 variables both refer to sys_user

In 1st variable I select Abel Tuter and based on that in 2nd variable you wish to see that user's location

When you set value to 2nd variable it's a user sysId

So how can you see location there

It will always show user when you select any user record

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

Community Alums
Not applicable

Sandy11971_0-1735568125682.png

Please see the attached picture @Ankur Bawiskar 

@Community Alums 

For this case you can use 2nd variable as string type and populate the Business unit via onChange client script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Community Alums
Not applicable

Thank You for all the assistance