SuiteScript's flexibility empowers users to efficiently manage records by loading and modifying them while creating or editing other records. For instance, during the process of saving a new sales order, developers can utilize the record.load() function to access the current user's employee record, ensuring their authorization. Alternatively, they might employ the record.create() function to generate a new record within the afterSubmit function of a User Event Script.
In scenarios where the "Execute as Administrator" checkbox is unchecked in the Script Deployment record, and the user's role lacks permission to access the specific record type being loaded or created in the background, SuiteScript will issue an "INSUFFICIENT_PERMISSION" error.
To address this error, there are several solutions:
- Enable the "Execute as Admin" checkbox on the Script Deployment Record to grant administrative privileges.
- Enhance the script by adding permissions related to the record being loaded into the role encountering the error.
- Utilize the search.lookupFields() function if editing the record is not required, as this will not trigger the error.
Have you encountered this error before? Let us know how you resolved it in the comments!