Get the current logged in user properties in Nintex for Office 365
Task:
To load a request form with logged in users full name.
Forms Tool:
Nintex forms for Office 365
Control:
Text control for Name, Email or other properties you wish to display in the form
Make sure your SP is loaded prior to getting the current user details. If it isn’t included each browser behaves differently some displaying current user name and others not.
var pollSP;
NWF.FormFiller.Events.RegisterAfterReady(function(){
pollSP=setInterval(checkSPLoad,500);
});
function checkSPLoad(){
if(clientContext){
window.clearInterval(pollSP);
onSPLoad();
}
}function onSPLoad() {
var currentUser = clientContext.get_web().get_currentUser();
clientContext.load(currentUser);
clientContext.executeQueryAsync(function () {
alert(clientContext.get_web().get_currentUser().get_title());
var name = NWF$(“#” + nameVar);
var curUser = clientContext.get_web().get_currentUser().get_title();
name.attr(“value”, curUser);
},function(){ alert(“failed to load user”);});
}
That’s it! Preview the form and alert shows fullname(title property) of the current logged in user
Which is assigned to the textbox on load
To get email of the logged in user you can user
get_email() property.
var email = NWF$(“#” + emailVar);
var curUserEmail = clientContext.get_web().get_currentUser().get_email();
email.attr(“value”, curUser);
Users and Groups in @Nintex forms for Office 365 – Part 2 (Check if current user belongs to a group)
Reference: https://community.nintex.com/thread/11831
One thought on “Users and Groups in @Nintex forms for Office 365 – Part 1 (Get current user)”