You need to sign in to do that
Don't have an account?

Urgent, please help with Lookup filter dialog result
We have following requirement:
1. Case object has 3 record types say "Product1 Record Type", "Product2 Record Type" and "Product3 Record Type"
2. There is a Lookup for Product in Case object
3. While searching for a product lookup as part of creating new Case object, only those Products shud be displayed that matches product name with current case record type.
For eg. Let us say I have already created products named "Product1" , "Product2" and "Product3" . I am creating a case object with its record type as say "Product1 Record Type" and for product lookup, it shud display only those products whose product name contains in the current case record, which in this scenario is "Product1" under Lookup filter dialog results.
Similarly, for case with "Product2 Record Type" shud display "Product2" under Lookup dialog results.
How to achieve this. I tried under lookup filter without any success. Please help.
1. Case object has 3 record types say "Product1 Record Type", "Product2 Record Type" and "Product3 Record Type"
2. There is a Lookup for Product in Case object
3. While searching for a product lookup as part of creating new Case object, only those Products shud be displayed that matches product name with current case record type.
For eg. Let us say I have already created products named "Product1" , "Product2" and "Product3" . I am creating a case object with its record type as say "Product1 Record Type" and for product lookup, it shud display only those products whose product name contains in the current case record, which in this scenario is "Product1" under Lookup filter dialog results.
Similarly, for case with "Product2 Record Type" shud display "Product2" under Lookup dialog results.
How to achieve this. I tried under lookup filter without any success. Please help.
Hi,
You can auto populate the picklist value usin pass the parameter to URL. but for override the new button url you need to override the button.
If you click on new case button currently it looks like -
https://ap1.salesforce.com/500/e?retURL=%2F500%2Fo&RecordType=01290000001ALJD&ent=Case
but if you want to pre-populate record type name (custom picklist) field then you need below url
https://ap1.salesforce.com/500/e?retURL=%2F500%2Fo&RecordType=01290000001ALJD&ent=Case&00N9000000Ck3K2=Test+Product+2+RT
00N9000000Ck3K2 - Record Type Name picklist field Id, you can get it using edit the picklist field and id will display in URL.
For add new parameter in new case url, Follow below steps.
Visualforce Page: CreateNewCase
Apex Class: CreateNewCase
Override New Case button:
**Record type name and piclist values need to be same.
Thanks and Cheers,
Jigar
All Answers
I have looked into your requirement and try to find a solution, but it looks like salesforce is not accessing record type details in any lookup field criteria. So I cannot find the solution.
But alternate is that you can use validation rule after select the product. Once product will selected and try to save the record at that time we can give validation error like "Invalid product" and also can provide information about which type of products need to select in the same message.
Thanks and Cheers,
Jigar
Most probably, yes we can achieve it using another custom fields but it has also some difficulties like below.
The solution is set record criteria with product lookup field. Edit product look up field and you'll see like below image.
So for setting the criterial there are two types, one is source field type(Case Record) and another is compatible type(Product Record).
We need record type name to compare with product name, so if need to select Case:Record Type Name in first option(above image - black box).
Here Record Type Name field is custom picklist field with case record type name values. for your requirement -
"Product1 Record Type", "Product2 Record Type" and "Product3 Record Type"
I know we need to auto populate the custom field of record type name to use here, but here the limitation is that we can use only picklist field but not other field like formula or text field. So if you are talking about formula field in your above comment to copy the record type name then it is not use over here.
https://help.salesforce.com/htviewhelpdoc?err=1&id=fields_lookup_filters.htm&siteLang=en_US, you can see the table for source and compatible target object types.
So currently I am manually selecting the picklist (record type name) values. Please review below snaps.
For First Record Type
For Second Record Type
So the bottom line is that we need to find a way which will auto populate the picklist value based on selected record type.
Thanks and Cheers,
Jigar
"So the bottom line is that we need to find a way which will auto populate the picklist value based on selected record type." What should be the way for this? I tried creating another custom field in the Case record and tried to populate it with that of its case record type in its before trigger but it is getting populated only after saving the case record which is not useful for lookup filter, please suggest any way for this?
Hi,
You can auto populate the picklist value usin pass the parameter to URL. but for override the new button url you need to override the button.
If you click on new case button currently it looks like -
https://ap1.salesforce.com/500/e?retURL=%2F500%2Fo&RecordType=01290000001ALJD&ent=Case
but if you want to pre-populate record type name (custom picklist) field then you need below url
https://ap1.salesforce.com/500/e?retURL=%2F500%2Fo&RecordType=01290000001ALJD&ent=Case&00N9000000Ck3K2=Test+Product+2+RT
00N9000000Ck3K2 - Record Type Name picklist field Id, you can get it using edit the picklist field and id will display in URL.
For add new parameter in new case url, Follow below steps.
Visualforce Page: CreateNewCase
Apex Class: CreateNewCase
Override New Case button:
**Record type name and piclist values need to be same.
Thanks and Cheers,
Jigar