Populate Values from reference type

Shri8
Tera Contributor
 
1 ACCEPTED SOLUTION

Hello @Shri8 ,

 

Try to update the line as or try without toString() function.

var temp=g_form.getValue('you_glide_list_field_name').toString() +','+newValue; 

 Kindly let me know if there is any issue.

View solution in original post

8 REPLIES 8

Brad Bowman
Kilo Patron
Kilo Patron

This sounds like a disaster.  Why would you want to do this instead of just having one list field, allowing the users to select all of the group values?  A reference field is meant to select one value, and whatever value is populated when the record is saved is the one that's stored in the field.  Your proposal is doing something that is not intended, so therefore should be questioned.  It can easily be done with an onChange Client Script, copying the newValue of the reference field (which will be a sys_id) and appending a comma before or after it to the existing value of the list field, but if your list field is hidden there's no way to remove a selected value.   

Jim Coyne
Kilo Patron

I agree with @Brad Bowman  in that this seems like it could be quite messy.  Technically it "can" be done, but the bigger question is "should" it be done.

 

What is it you are actually trying to do?  I don't mean "copy reference field to list field".  I mean what is the true use case here?  Are you trying to track all the Groups that have been assigned the ticket?

Sunny3008
Tera Guru

Hello @Shri8 ,

 

You can achieve requirements using the following method.

 

 Create an Onchange Client script on the reference field and write the following script in it. With following script every time when change the value and save the record changed value get added in glide list field.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   var temp=g_form.getValue('you_glide_list_field_name').toString+','+newValue;
   g_form.setValue('you_glide_list_field_name',temp);


   //Type appropriate comment here, and begin script below
   
}

 Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

That would actually keep adding the Group from the reference field EACH time it is changed, not just when it is saved.  So if the user selects Group A, changes it to Group B, changes again to Group C and then saves the record, all three of those are going to be added to the list field. 

 

I think we need to understand the real use case first before suggesting any solution, if in fact it really should be done.