I have this targetPageParamsAll() in the AEM page which would return the user groups as an array.
targetPageParamsAll = function() {
var userGroups = "everyone,test1,test2,beta1";
var userGroups = userGroups.split(",");
return {
"userGroups": userGroups
}
};
Attaching a screenshot on the available mbox parameter w.r.t userGroups below,
My requirement is to check whether the user belongs to a certain group and return that group name from the script. With the above highlighted, would I need to check each of these individual params(ranging from 0 to 16) and return for true cases.
Is it possible I can get the userGroup as an array instead(var userGroups = mbox.param('userGroups');) and check whether the user belongs to a particular group(eg:beta1)? Some recommendations on this would be appreciated. Thanks!
Solved! Go to Solution.
I suppose you could try passing the array as a stringified object, such as:
return { userGroups: JSON.stringify(userGroups) };
And then parse it as an array in the profile script:
var userGroups = JSON.parse(mbox.param('userGroups'));
I suppose you could try passing the array as a stringified object, such as:
return { userGroups: JSON.stringify(userGroups) };
And then parse it as an array in the profile script:
var userGroups = JSON.parse(mbox.param('userGroups'));
@jgrubbs The similar approach actually worked for me, but I need it as a list to create an exclusion in recommendation -
Will it work for my use case? I have posted it separately over here -
Any help would be appreciated, thanks!
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies