Skip to main content

Search

GetFirstValueForQuery and multivalue people picker fields

Answered

Comments

1 comment

  • Matthias_Walter

    Hi DieterJauslin,

    since a multi people picker field returns as array, you would have to add another forEach loop on it and make sure to skip null values if no person is set:

    var approvers = "";
    var approversObjs = [[@Functions.GetValuesForQuery('Lists/ConfigurationEntities', '<View Scope="Recursive"><Query><Where><In><FieldRef Name="Title" /><Values MultipleValuesDelimiter="," ProviderType="FormInput"><Value Type="Text">[[EHEntities]]</Value></Values></In></Where></Query></View>', 'EHSMBXAddress')]]

    approversObjs.forEach(function (approver) {
        if(approver!=null) {
            approver.forEach(function (singleApprover) {
                if (singleApprover.get_email() != "") {
                    approvers += singleApprover.get_email() + ";";
                }
            });  
        }
    });

    return approvers;

     

    Kind regards

    Matthias

    1

Please sign in to leave a comment.