I’m currently facing a permission issue when using...
# ask-stanley-ai
m
I’m currently facing a permission issue when using a Client Script under the Employee Center role — specifically when trying to retrieve Department and Location from the Employee and Subsidiary records via a search.create() call. Since the Employee Center role does not have access to these records, the search fails with permission errors. My idea: Instead of using search.create(), I’m thinking of using a Saved Search marked as “Run Unrestricted”, and loading it via search.load() in the Client Script. Do you think this would work and bypass the permission issue for Employee Center users?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that your idea of using a Saved Search marked as “Run Unrestricted” and loading it via search.load() in the Client Script might not work as expected. This is because Client Scripts execute in the context of the current user, and thus are subject to the permissions of the user's role. In the case of the Employee Center role, it does not have permissions to run searches on certain records, which is likely causing the permission errors you're encountering. Even if the Saved Search is marked as "Run Unrestricted", the Client Script may still not have the necessary permissions to execute it if the user's role does not have access to the records being searched. One potential workaround suggested in the conversations is to store the information you need in a custom record and allow the Employee Center roles access to the custom record. Alternatively, you could have the Client Script call a Suitelet that can run as admin to perform the search. However, please note that these solutions may not be ideal depending on your specific use case and requirements. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86692369
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837534904
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833843291
Please provide your feedback on this answer.