Users and Groups in @Nintex forms for Office 365 – Part 2 (Check if current user belongs to a group)

Get SharePoint groups name(s), the current logged in user belongs to. This can be used to set form fields as well as workflow variables to direct flow of the request process depending on the group current user belongs to.


To check if logged in user belongs to a particular group

Forms Tool:

Nintex forms for Office 365

Ensuring your SP is loaded prior to getting the current user and groups information as explained in Part 1 of this series.

var pollSP;
function checkSPLoad(){

function onSPLoad() {
var currentUser = clientContext.get_web().get_currentUser();
var spGroups = clientContext.get_web().get_currentUser().get_groups();
Function.createDelegate(this, function () { OnSuccess(spGroups);}),
Function.createDelegate(this, this.failed)
); }

function OnSuccess(spGroups) {
alert(“Groups loaded”);
try {
var isMember = false;
var groupsEnumerator = spGroups.getEnumerator();

while (groupsEnumerator.moveNext()) {
var userGroupNames;
var currentGroup = groupsEnumerator.get_current();
userGroupNames += currentGroup.get_title() +”\n”;
if (currentGroup.get_title() == “SPDirectorsGroup”) {
alert(“User is a member of SharePoint Group:” + currentGroup.get_title());
isMember = true;
alert(“User belongs to these SharePoint Groups:\n”+userGroupNames);
} catch (err) { alert(err);}

function OnFail() {
alert(“Failed to load groups”)

And you are set. Preview the form and you will see that SP Groups are loaded for currentUser;


and whether or not the user belongs to a particular group for your process direction, SPDirectorsGroup in this example.


ALL the groups the logged in user belongs to.


This is one way to retrieve Group and User info using Nintex forms for #Office365.

Users and groups in @Nintex forms for @Office365  – Part 3 (Get the division of current user on form load)


  1. I get an error on executeQueryAsync >>> 404 (Not Found)
    XMLHttpRequest.send @ ai.0.js:1
    executeRequest @ MicrosoftAjax.js:5
    executeRequest @ MicrosoftAjax.js:5
    invoke @ MicrosoftAjax.js:5
    executeQueryAsync @ sp.runtime.js:2
    IsCurrentUser_PlantasVerTodos @ enaex_CommonForms.js:279
    (anonymous) @ enaex_CommonForms.js:194
    EnsureScript @ init.js:1
    EnsureScriptFunc @ init.js:1
    onSPLoadThisNintexForm @ enaex_CommonForms.js:191
    checkSPLoad @ enaex_CommonForms.js:185
    ai.0.js:1 POST 404 (Not Found)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s