1

I have a custom list in which I have applied JSLink on Person/Group field in NewForm.aspx, my code works fine to render the field but when I click on submit button, I am returning value. <userId>;#<LoginName> to SharePoint in statement like below:

formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
formCtx.registerGetValueCallback(formCtx.fieldName, function () {
return "1;#xxx yyy;";
});

But I am not getting any value stored after the item is saved.

How do I return the value to Person field?

Note : The field is single allow value.

2
  • 1
    is this a claims web application? Have you provided the claims token? Also, what's the health of your user profile service? Can you find the username in question on the user profile service?
    – Mike
    Aug 11, 2014 at 15:22
  • It is windows authentication web application. So, I tried to return value using, i:<userId>#.w|<domain>\<userLoginName>, but still not working.
    – users1100
    Aug 12, 2014 at 4:30

1 Answer 1

4

After searching for the issue for hours I found a solution which returns the data to SharePoint for Person or Group field.

Thanks to author of this post. From this post , I got the idea.

However in my case the only string to return to SharePoint is [{"Key":"i:<id>#.w|domain\\\\<UserLoginName>"}].

So, finally my piece of code to submit data from JSLink is:

formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx);
formCtx.registerGetValueCallback(formCtx.fieldName, function () {
// return '[{"Key":"i:0#.w|bitscape\\\\riyaz.kalva","EntityType":"User","IsResolved":true}]';
return '[{"Key":"i:0#.w|domain\\\\xxx.yyy"}]';
});

Thanks,

Hope this helps others too.!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.