Autopopulate logged in User's info
Posted: 06 Oct 2016
I am using the following Javascript to Autopopulate the User's information into the form
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
fd.field('User_x0020_who_x0020_needs_x0020').value(user.get_loginName());
fd.field('User_x0027_s_x0020_Official_x002').value(user.get_email());
});
}), "SP.js");
I would like to inlcude other information such as the User's Work Phone and User Name, see image below from SharePoint
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
fd.field('User_x0020_who_x0020_needs_x0020').value(user.get_loginName());
fd.field('User_x0027_s_x0020_Official_x002').value(user.get_email());
});
}), "SP.js");
I would like to inlcude other information such as the User's Work Phone and User Name, see image below from SharePoint