is it possible to route to a form depending on group membership?
I have an idea management system.
Every user can create elements.
Every user can display elements, but not all of the fields, like name (if the current user is not the author of the element. --> Can do this with custom routing.
But in custom routing the user who are accept or decline the ideas also are affected by this custom routing!
Can i make the custom routing only for one formset? Or any other suggestions?
Can i place the custom routing information in a fd.rendered(function() within the specific form set?
TBut i think the Problem is, i can not do this on item level. How can i do this on item level?
User A is in group "visitors"
--> visitors can create ideas, edit own ideas and display them ("default form")
--> visitors can view every idea ("incognito form", where names are not displayed)
User B is in group "owner"
--> can do everything ("master-form")
--> set a user to approve the idea
User C is in group "visitors", "approver" (via flow-workflow)
--> visitors like above
--> approver can edit ONLY THE ITEM where the User B set the User C as "approver".
--> every other item is show in "incognito-form"
Is it possible to check on spRendered if a user is the approver and redirect them to a specific form?
I think this would be the easiest way to solve the problem.
You can check user membership as well as values on the form and route to a specific form.
For instance, check if a user is a member of the Visitors group and if he's created the item.
return web.currentUser.get()
.then(function(user){
return web.siteUsers.getById(user.Id).groups.get()
.then(function(groupsData){
var groups = [];
//Check if the user is a member of the desired groups and add them to the array
for (var i = 0; i < groupsData.length; i++) {
if(groupsData[i].Title == 'Site visitors') {
groups.push('Site visitors');
}
if(groupsData[i].Title == 'Site Owners') {
groups.push('Site Owners');
}
}
//Redirect to a Form Set if the user is a member of a group
if (groups.indexOf('Site visitors') > 0 && user.Id == AuthorId) {
return 'FormSetIdForSiteVisitors';
}
else if (groups.indexOf('Site Owners') > 0) {
return 'FormSetIdOfIncognitoForm';
}
});
});
I think this is getting too complex because i have to add a user to a group and delete them afterwards.
Maybe i just should redirect the user to the form he needs in order of field values.
I have different Sharepoint fields (Approver, Deployer).
I want to check something like
if currentuser.value == author.id --> go to default form
if currentuser.value != author.id && (fd.field('Approver').value == currentuser.value --> go to Form1
if currentuser.value != author.id && (fd.field('Deployer').value == currentuser.value --> go to Form2
Example:
User is the creator --> Default form
User is not the creator but the approver --> Form 1
User is not the creator but the deployer --> Form 2
.........
Sorry, I'm new in JS...
To check those values, can i usepeople picker and a few if else conditions?
Can you post an example?