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

How Can I autopopulate 'Location' Reference field with same value as shown in Space Reference field

WazzaJC
Tera Expert

How Can I auto-populate 'Location' Reference field with same value as shown in Space Reference field

Hi Guys,

 

I have built a few Reference fields, Building (u_building), Floor (u_floor) and Space (u_space) field on my Incident Form (see screenshot attached). These are all Reference fields.

 

These are all driven/referenced directly from the Location (cmn_location) table.

 

I also have the standard 'Location' field, which also references the Location table.

 

How can I write either a script or business rule, so that when the Space (u_space) field gets populated with a location value, at the same time the Location (location) field will then also get updated with the same location value, that is referenced within the 'Space' (u_space) field ?

 

I assume this is either a Business Rule or perhaps onChange Client Script?

 

Please see my screenshot attached, showing the relevant fields.

 

I would appreciate any help/guidance with achieving this.

 

Many Thanks.

20 REPLIES 20

Hi Sai,

This script does work, the Location field populates accordingly, however when I submit the Incident, the value does not get saved in the Location field - why is this ?

So it seems when the Incident submit/saves, when I then go open up the Incident, the Location field is empty/blank - so for some reason, the value that populates from the script, does not get retained in the Location field ?

Please advise. - I have attached a screenshot showing the full onChange Client script.

However for some reason, when the Incident form submits, the value does not get retained/saved in the 'Location' field?

Thanks, Warwick

Yes your understanding is indeed correct Daniel. I will give this a try. Thank you.

Sai Kumar B
Mega Sage

@WazzaJC 

Open the 'Location' dictionary record and in the Default value tab just paste the following line and give it a try - The below line will populate the location field with the current space field value on the incident form. 

SaiKumarB_1-1686299197370.png

 

 

 

 

 

 

This only works on Submit or Save of the form, not directly on change of the field. When both fields are visible, this behaviour is no good user experience. Use Client Script instead.

Ok thank you Daniel, much appreciated.