Scenario Overview
To enhance the user experience when creating an Opportunity we want to only show the Accounts that are either owned by the current user or a team they belong to when the user clicks the search button for the look up field.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A formula of type 'ClientSide - Perform Action' is created and set to run on the Onload event of the Opportunity form
- When the form is loaded the Account lookup field is prefiltered according to the filter parameter specified by a fetch-xml fragment (we only used the filter part of a fetch-xml query)
North52 Decision Suite Steps
The following set of steps outline how to create this Formula:
- Create a new formula of type 'Client - Perform Action'
- Set the Event picklist to 'Create & Update'
- Set the Source Entity to 'Opportunity'
- Set the Source Property to 'OnLoad' for each form you wish the filter to apply (CTRL-Click to select multiple)
- Copy and paste the formula below into the formula
- Click Save
- Update the formulashortcode parameter in your formula to match the Short Code of your formula
- Click Save
- From the N52 Commands menu select 'Publish formula'
Formula
/* filter the Account lookup field so that only Accounts owned by current user or a team they belong are shown */
AddPreFilterLookup('parentaccountid',
'd0H',
'<filter type="and"><condition attribute="ownerid" operator="eq-useroruserteams"/></filter>',
'account')
This formula can be easily modified with your own filter criteria and/or to target a different lookup field