Restrict the saved search such that the user with different role will be able to view only desired set of results.

Scenario: The user needs to restrict the saved search results such that the user with the sales role would be able to view the sales orders with their name in the salesperson custom field in sales order. Also, the user with the sales manager role should be able to view the sales orders with the user location same as that of location of the salesperson in the custom field in sales order.

List>Search> Saved Searches
Edit the transaction saved search.
Criteria> Standard> Filter

Formula: CASE WHEN ({custrecord_jj_sales_person_ahap_39.entityid} = {user.entityid} AND {userrole}= 1045) THEN 1 ELSE (CASE WHEN ({userrole} = 1046 AND {custrecord_jj_sales_person_ahap_39.locationnohierarchy} = {user.locationnohierarchy})THEN 1 ELSE (CASE WHEN {userrole} NOT IN (‘1045′,’1046’ ) THEN 1 ELSE 0 END) END) END

Formula Numeric: equal to

Value: 1

Click Save

Functionality of the criteria: User name({user.altname}) is in the sales person({sales_person}) field and the user role({userrole}) is sales role(1045: internal ID of sales role)

User location({user.locationnohierarchy}) is same as that of location of sales person({custrecord_jj_sales_person_ahap_39.locationnohierarchy}) field and the user role({userrole}) is same as sales manager(1046: internal ID of sales manager role)

Please note that the user with all other will be able to view all the record data, i.e. there is no restriction for the rest of the user.

Leave a comment

Your email address will not be published. Required fields are marked *