how to populate current login user in to people picker using JQuery

Advertisement
In this article we can able to see how to populate current login user in to people picker using JQuery.
we are having  a requirement, when  we are trying to create a new item, there is a column with people picker field in that
Open list items in New Window SharePoint
Concatenate two fields and update the value into another field in SharePoint using PowerShell 
Get current login user in SharePoint using JQuery

we have to auto populate the user using the below code.

<script type="text/javascript" src="/sites/DotnetSharepoint/SiteAssets/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript" src="/sites/DotnetSharepoint/SiteAssets/jquery.SPServices-2014.01.min.js"></script>

<script language="javascript" type="text/javascript">

$(document).ready(function()
{
ExecuteOrDelayUntilScriptLoaded(loadConstants, "sp.js");
});

function loadConstants() {
var userName = $().SPServices.SPGetCurrentUser({
fieldName: "UserName",
debug: false
});
$('h3:contains("HereFieldDislplayNameinNewForm")').closest('tr').find('div[title="People Picker"]').html(userName);
$('img[title="Check Names"]').trigger('click');


}
</script>

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Unknown

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

1 comments: