You need to sign in to do that
Don't have an account?
URL Hacking for adding products to an opportunity
I'm finding when passing the parameters it fills it out correctly but seems to create almost another value. If I manually go and select the second value then the filter works, otherwise it's not seeing it correctly. My guess is its something like passing report filters where for the first filter you use pvo.
I click my button on the Products related list on an opportunity. The button contains the below url
Ex:
https://cs14.salesforce.com/p/opp/SelectSearch?addTo=006c00000079xsa&PricebookEntrycol0=Product Family&PricebookEntryoper0=contains&PricebookEntryfval0=Consulting&PricebookEntrycol1=Global Product&PricebookEntryoper1=equals&PricebookEntryfval1=false&retURL=%2F006c00000079xsa
Where
PricebookEntrycol0=Product Family
PricebookEntryoper0=contains
PricebookEntryfval0=Consulting
However I get multiple Product Familys and the filter doesn't work. If I manually go select the second "Product Family" in the drop down the filter works. Should I be using different values?
Thanks
Dahveed
For anyone looking for an answer, I found this out at the SF Users group. Props to C-level Management.
Instead of using the full URL use the below string which hooks it to the current opportunity when you select the button
/ui/opportunity/SelectSearch?relatedListId=PricebookEntry&addTo={!Opportunity.Id}
The parameters are
srtClmn
srtOrd
The filter fields where 0 is the row
PricebookEntrycol0
PricebookEntryoper0
PricebookEntryfval0
PricebookEntrycol1
PricebookEntryoper1
PricebookEntryfval1
The catch is you can't set literals except for the PricebookEntryfval field. You must use field name which aren't actually the SF API field names. Ex:
Product Name = PRODUCT.NAME
Product Family = PRODUCT2.FAMILY_ENUM
List Price = PRODUCT.DEFAULT_PRICE
Product Code = PRODUCT.CUSTOMER_PRODUCT_ID
Product Description = PRODUCT2.DESCRIPTION
Operators
equals=e
contains=c
I realise salesforce doesn't support this officially however it is common practice. It would be amazing to somehow get a list of all the filter field access names. Could I do a SOQL query on something to get the field filter names?
All Answers
For anyone looking for an answer, I found this out at the SF Users group. Props to C-level Management.
Instead of using the full URL use the below string which hooks it to the current opportunity when you select the button
/ui/opportunity/SelectSearch?relatedListId=PricebookEntry&addTo={!Opportunity.Id}
The parameters are
srtClmn
srtOrd
The filter fields where 0 is the row
PricebookEntrycol0
PricebookEntryoper0
PricebookEntryfval0
PricebookEntrycol1
PricebookEntryoper1
PricebookEntryfval1
The catch is you can't set literals except for the PricebookEntryfval field. You must use field name which aren't actually the SF API field names. Ex:
Product Name = PRODUCT.NAME
Product Family = PRODUCT2.FAMILY_ENUM
List Price = PRODUCT.DEFAULT_PRICE
Product Code = PRODUCT.CUSTOMER_PRODUCT_ID
Product Description = PRODUCT2.DESCRIPTION
Operators
equals=e
contains=c
I realise salesforce doesn't support this officially however it is common practice. It would be amazing to somehow get a list of all the filter field access names. Could I do a SOQL query on something to get the field filter names?
1. Is there a paramter to include in the URL to initiate the actual Search? The above passes the parameters ok, but then the user must press Search - I want to automate that.
2. What is the syntax for srtOrd? srtOrd=a does not work
Thanks!
https://sfdc-gyaan.rhcloud.com/tag/product/
This is my final url:
https://na18.salesforce.com/p/opp/SelectSearch?addTo=0061200000SZYtc&PricebookEntrycol0=PRODUCT2.FAMILY_ENUM&PricebookEntryoper0=k&PricebookEntryfval0=na,svc,accessories,P%20%26%20A
obviously, the ID should be replaced with {!Opportunity.ID}
I was able to add my button and it works like a charm. If you want to use mulitple criteria, you can use the comma, just like a report or list view filter. Works very well. Using a community partner portal and I don't want the external users to choose the wrong product. This helps a lot.
> srtOrd
Any more details on these paramters? I'd love to be able to automatically sort by a column other than the default..
Thanks!
(In Chrome)
Right click one of the field drop downs for filtering and inspect the code using the developer console. The actual <select> tag contains a list of <option>s that list all of the field values that you can use. I have copied most of the standard fields below. Enjoy :)
<option value="">--None--</option>
<option value="PRICEBOOK.NAME">Price Book Name</option>
<option value="PRICEBOOK.ACTIVE">Active (Price Book)</option>
<option value="PRODUCT.NAME">Product Name</option>
<option value="PRODUCT.CUSTOMER_PRODUCT_ID">Product Code</option>
<option value="PRODUCT2.FAMILY_ENUM">Product Family</option>
<option value="PRODUCT.DEFAULT_PRICE">Standard Price</option>
<option value="PB_ENTRY.USE_STANDARD_PRICE">Use Standard Price</option>
<option value="PRODUCT.ACTIVE">Active (Price)</option>
<option value="PRODUCT2.DESCRIPTION">Product Description</option>
<option value="PB_ENTRY.CREATED_DATE">Created Date</option>
<option value="PB_ENTRY.LAST_UPDATE">Last Modified Date</option>
<option value="CREATEDBY_USER.ALIAS">Created By Alias</option>
<option value="UPDATEDBY_USER.ALIAS">Last Update By Alias</option>
<option value="PRODUCT2.ACTIVE">Active (Product)</option>
You can find the available fields with the dev tools / inspect functionality in your browser, but for custom fields it's very simple: it's just the 15 character Salesforce ID of the field (starting with 00N). You can find this ID through the Tooling API, or by extracting it from the URL by navigating to the field in the setup.
/ui/opportunity/SelectSearch?relatedListId=PricebookEntry&addTo={!Opportunity.Id} opens in Classic.