Typically searches that are created for use in the script are marked as “public”, creating unnecessary security issues as any role with access to the underlying object can see the report. We wanted to reduce the potential exposure of a public search while still making the search available to the scripts.
In order to make the saved searches available to be used by scripts while not marked as ‘public’, here are the steps:
1. Open the saved search and uncheck the “public” field.
2. Under the Audience tab, select the “Administrator” role.
3. Save the saved search and access will now be equal to “Shared”.
4. On the script’s deployment record, make sure that the field “Execute As Role” is set as “Administrator”.
5. If using a script parameter for the saved search, make the script parameter field type as “textfield” instead of list field. On the field, put the saved search id.
Note: This will not work for scripts without “Execute As Role” field (E.g. client script).
Authored by: Mary Joy