What's the best way to auto populate a field dependent on another field?

nmcl
Giga Expert

I'd like to implement something where by if a certain priority is set (e.g. P1) that the 'Major Incident' template is inserted.

So that the description and short description fields are populated with template text.

 

What's the best way to go about implementing this?

15 REPLIES 15

several points...



first a consideration.. do you want the user able to modify the record AFTER the template is applied and possibly overwrite fields the template set... if so you do NOT wan this done in a BR... if not remember ANY field filled in on the template will over write what the person has entered on save...



to make it not work if the previous priority was blank you can test vs "oldValue" in the first line where you see the function onchange line any field inside the () you can use ... so in an onChange oldValue, newValue, and isLoading are all available to you...



in the template do you set the priority or have a line on the template to set the priority.. that is the only reason it should blank the priority.


Thanks Doug.   To confirm my requirements...



The intention of this template is that in a Major Incident it applies example text in the short description and description fields so people can then over type with the current information.



I only want this template to apply if the previous priority was 'none'.   Therefore ensuring if an incident is escalated from P3 to P2 it doesn't apply the template again (as it would have already been populated).



I need the record to insert the template on changing of the priority field, else it will be missed (e.g. if entered on save).


then you are going to have to do this in a client script NOT a BR... br's apply after the record is updated or insert the before selection applies to the order of when the br runs it will NOT affect the form before the customer his save..



i would test for if (oldvalue == ''); to to filter out times when the priority was blank   if i recall that should filter those out but test it.


Vimal Priya
Giga Guru

Hi Nat


Create a business rule for the template.


Vimal Priya
Giga Guru

Hi Nat


using br , you can achieve your requirementbr1.JPG