current.canWrite does look where exactly in ACL?

ehgebla
Giga Guru

Hey everyone,

short question on Scripts together with ACL. We do have our update incident inbound action script that will update the current.comments whenever a mail is received and adds that mail.

This shall work everytime, regardsless if the user is the opener or in watchlist. Our user in watchlist CAN update the record in portal, but for some reason the script doesn't add the comments whenever a user in watchlist answers on the records.
I mean the mail do is in the history of the ticket, but the mail doesn't get copied to the additional comments as the script tells it to be. 

The received mail tells me: Update Incident : did not create or update incident using current


The script in question ends with 

if (current.canWrite())
        current.update();
}

so I was thinking it might has to do with the ACL's. However, I checked the incident table and write for incident as well as incident.comments is allowed for people in watchlist (which is why they also are allowed to update in portal, I suppose).
So how does the script decide who CAN write and updates?
What ACL will be triggered here?

Anyone has any idea? Maybe I am also overlooking something.

Regards

Elena
1 ACCEPTED SOLUTION

ehgebla
Giga Guru

We found what was the reason for it not working.
ACL needs table as well as field access.

In ACL we had write access on the record for incident.* but not for the table, just incident.

This caused the incident to update, but not to change the additional comments automatically. After creating the write ACL for the table alone, it started to work as expected.

Thanks everyone for helping me to figure it out. The debugger did the trick here to see what was the issue. 🙂
Still weird to me that it was able to update the incident via the portal though.

View solution in original post

5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

@ehgebla Since you are checking current.canWrite(), the write ACL on the respective table would be checked. If the user doesn't have the write access on the record, the ACL would get failed and the record would not get updated.

Hi Sandeep, it's on incident table and the watchlist user do have write access. Both to incident as well as incident.comments in ACL. It still fails.

@ehgebla According to definition 

canWrite()

Determines if the access control rules (which includes the user's role) permit updates to records in this table.
Returns
Type Description
Boolean Flag that indicates whether the user's roles permit writing of records in this table.
Valid values:
  • true: Writing permitted
  • false: Writing is not permitted

 

please use the ACL debugger to identify which ACL is failing.

shyamkumar VK
Kilo Patron

@ehgebla  , Basically ACL Validates Based on Logged In user and you current Script is Validating if Current user can Include Comments or not - Check if this ACL has some Roles like ITIL , Admin etc. so based on that roles validation ACL allows Access 

 

Note : ACL Works Same as native UI in portals , Workspaces everywhere.

 

Regards,

Shyamkumar 

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar