0

I am using below CSR code to set peoplepicker value to multiple person. I have multiple users to be assigned to my peoplepicker field. The code works when i pass current user, but it do not work for other values.

function renderAssignedTo(ctx) {
 //get current user properties
 //var currentUser = $().SPServices.SPGetCurrentUser({fieldNames: ["Title", "Name"]});   //get current user properties
 if(ctx.results!=undefined)
 {
     ctx.CurrentFieldValue = [];
     for(var i=0; i<ctx.results.length;i++)
     {
         var currentUserEntry = createUserEntity(ctx.results[i].Name,ctx.results[i].Title);
         ctx.CurrentFieldValue.push(currentUserEntry); 
     }
 }       
 return SPClientPeoplePickerCSRTemplate(ctx);
}

Here ctx is having array of user name and title. Those values need to be set for peoplepicker field in NewForm.aspx which accepts multiple value.

I took reference of this post

1: Sharepoint 2013 JS Link return default field rendering and Sharepoint 2013 - EditForm, people picker new value not saving

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.