Hello!
We recently implemented a "Reject with Note" feature on our expense reports. Our approval process works using a workflow. Currently, when a user rejects an expense, they get the following popup:
Once they press "Reject", a script in the background will grab whatever is in that box and from there, edit the expense report by:
- Clearing the "Next Approver" field
- Enabling a custom text field
- Placing the "Rejection reason" (text from the box) into that custom text field
- Changing the status of the expense to "Rejected"
This is done by the following code, coming from a Client SuiteScript:
The issue that we are running into is that from a custom role, after they press "Reject" and its supposed to do the record editing, we get the following error in console:
The part that I am unsure of is that that custom role has been given full access to expense reports, but the error still pops up, however, it won't say exactly what permission it needs in order to fix it, so I'm at a bit of a loss.
Some things to note:
- The code runs with no issues when the person approving is the supervisor of the person who submitted the expense report. In our scenario, we route the next approver depending on if its a project-related expense. If it is, then the next approver is the Project Manager of that project, so it is not always that employee's supervisor who need's to approve/reject their expense. When it is NOT the supervisor, but the project manager, that is when we run into the issue.
- We also changed the setting below to "none - no defaults" under Manage Roles, which fixed the issue and the user is able to reject without any errors, but the problem that arises from that is that their "Time entries to approve" now have the entire company's time entries that need approval, not just their subordinates.
My question is, how can I determine what is that is causing the insufficient permissions error to try and troubleshoot it? We used to have everything done through the workflow before but this didn't allow a method for a rejection note to be appended with the rejection.
Thanks!