Populate extra fields with multiple people picker

Good day
I have an lookup field, than i put a multiple people picker in extra fields, and want to retrieve this multiple people field in my form. is it possible ?Another extra text fields works.The problem only with single\multiple Person. Set the field value:
fd.field('GroupPerson').value = fd.field('Problem').value.Grupa_x0020_de_x0020_specialisti

get an error:

P.S. as a resolution to make text fields from people picker, than populate in extra fields. Is it a direct way?

Dear @ixxxl,
That's because Person field is a complex field, like a Lookup field, it doesn't just store the name of the user, but also a lot of other information.

In Extra fields, use FieldName/Information you want to get, for example:
Grupa_x0020_de_x0020_specialisti/Name

In Expand, use only the field name:
Grupa_x0020_de_x0020_specialisti

Then, you can get these values, like this:

fd.field('LookupPeople').value.Grupa_x0020_de_x0020_specialisti[0].Name;
fd.field('LookupPeople').value.Grupa_x0020_de_x0020_specialisti[1].Name;

@Nikita_Kurguzov
Thanks, it works! one more thing, when i add field values

fd.field('LookupPeople').value.Grupa_x0020_de_x0020_specialisti[0].Name;
fd.field('LookupPeople').value.Grupa_x0020_de_x0020_specialisti[1].Name;

How can i know how much there are in that multiple people picker ? it can be one, can be more values. if i use [0] it takes only first one

something like we make previosly with multiple people picker

	 var selected =  fd.field('Problem').value.Grupa_x0020_de_x0020_specialisti.Name //fd.field
        var s = '';
        for (var i = 0; i < selected.length; i++) {
            s += selected[i].LookupValue + '; ';
        }

but here it doesn't work

Dear @ixxxl,
It's still a JavaScript array, so the same technique will work, simply adjust it like so:

var selected =  fd.field('Problem').value.Grupa_x0020_de_x0020_specialisti; 
var s = '';
for (var i = 0; i < selected.length; i++) {
    s += selected[i].Name + '; ';
}

@Nikita_Kurguzov
I tried, but it returns undifinied. the lengh=2

image

Dear @ixxxl,
You are still trying a different thing. It's not Name of the field, instead, you get Name from each individual record inside the field.

Try this instead, without the Name:
fd.field('Problem').value.Grupa_x0020_de_x0020_specialisti.length;

@Nikita_Kurguzov
image

@Nikita_Kurguzov
It works, thank you ! one more thing happened , it works with users ,but when i try to insert active directory group it alert's but doesn't populate people picker. with no errors. people picker is set to multiple and with inserting groups.manual it works
image

Dear @ixxxl,
In this case, replace Name in Extra fields and in JavaScript code with Title:
Grupa_x0020_de_x0020_specialisti/Title

var selected =  fd.field('Problem').value.Grupa_x0020_de_x0020_specialisti; 
var s = '';
for (var i = 0; i < selected.length; i++) {
    s += selected[i].Title + '; ';
}
1 Like

@Nikita_Kurguzov
Works perfect! thank you!

1 Like