User unable to create M2M entries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 08:48 PM
Hi All,
I'm facing an issue where a user is unable to add entries on clicking 'Edit' button in outages ('task_outage') related list available in incident form. I have created ACLs to allow the user to read/create/write/delete records in task_outage table.
I enabled session debugging 'Enable All' and found the message " User is not authorized to create new M2M entries for table task_outage" in the debug logs. If anyone has faced similar issue, please suggest resolution steps.
Thanks,
Udhay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 09:15 PM
Hi Udhay,
Make sure that the ACL at the table level is also granted. The name of that ACL will be the same as the table name, task_outage on this case and it needs to be a write acl. After that make sure the user has write access in the respective fields. You can always check the write ACL task_outage.*. Just be aware that individual ACLs may overwrite that ACL so you need to make sure those are properly designed/written so that your user has access.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 10:22 PM
Hi Berny,
I have created ACLs on 'task_outage' table for Create/Read/Write/Delete. Please refer the below ACL script.
answer = validate();
function validate(){
var result = false;
if(gs.hasRole('role1') || gs.hasRole('role2')){
result = true;
}
else{
var groupName = parent.assignment_group.name;
var groupName1 = current.task.assignment_group.name;
if(gs.getUser().isMemberOf(groupName) || gs.getUser().isMemberOf(groupName1)){
result = true;
}
}
return result;
}
When the logged in user has 'role1'/'role2', 'Edit' button is visible in the 'outages' (task_outage) related list of the incident form and he/she is able to add/remove outages. But when the logged in user is member of incident's assignment group then, he/she is able to add/remove entries in the slushbucket. But the changes are not saved. i.e if the user is able to add an outage in the slushbucket by clicking on '>' icon but it is not saved.
On debugging i found the message " User is not authorized to create new M2M entries for table task_outage" and also script part of the 'Create' ACL failed.
Thanks,
Udhay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 11:12 PM
In the error logs i saw the message 'parent is not defined', so I made a little modification to my code and issue got solved
answer = validate();
function validate(){
if(gs.hasRole('role1') || gs.hasRole('role2')){
return true;
}
else{
var groupName1 = current.task.assignment_group.name;
if(gs.getUser().isMemberOf(groupName1)){
return true;
}
else{
var groupName = parent.assignment_group.name;
if(gs.getUser().isMemberOf(groupName))
return true;
else
return false;
}
}
}