3

I have a lookup filter on a lookup field from one Custom Object to another; both objects are within a managed package.

Let's assume we have one Object A, with a lookup field lookup__c and another Object B with record types: simple and advanced.

In the lookup filter on lookup__c I select "B : Record Type" "equals" "value" and then select "simple" using the spyglass icon.

Am I right that, despite saying that it is using the Record Type name for this filter under the hood salesforce is using the Record Type ID? In which case when this package is released into an org, the record type ID will be different and the lookup filter will no longer function?

What is the best way to get around this issue? Should I base the filter on the developer name? Or is there a better way?

Thanks!

1 Answer 1

1

If you are deploying ObjectA__c and ObjectB__c, that would inherently deploy Lookup__c (and the Lookup Filter) and also the Record Types within your package.

That would mean that the Lookup filter should continue to work in target orgs where your managed package is deployed.

This is the metadata for such a lookup filter, this would be deployed to your Target org so if doesn't work in Target, it should also not work in Source. I think something else is at play.

    <lookupFilter>
        <active>true</active>
        <filterItems>
            <field>ObjectB__c.RecordTypeId</field>
            <operation>equals</operation>
            <value>simple</value>
        </filterItems>
        <isOptional>false</isOptional>
    </lookupFilter>
5
  • Thanks for your answer. I realise that the all of the config will be deployed, but it seems that salesforce is using the record type ID in the filter, which is different in the target org. e.g. in the source org, the record type for simple has id of 012d00000015CNM, whereas in the destination org the id is 01258000000I5iS. I think this what salesforce is using under the hood; it's just displaying "simple"
    – Jazzer
    May 24, 2016 at 15:36
  • But I doubt it is storing the ID in the filter definition.....perhaps I'm misunderstanding, but for obvious reasons testing this myself is tricky. Can you confirm you've tested, and it doesn't work? Perhaps if you could show your metadata for ObjectA__c? May 24, 2016 at 15:42
  • I suppose that is the crux of what I'm asking. Does salesforce store the ID in the filter definition that is then packaged and deployed, or does it store the name that is then converted to an ID in the destination org. From my testing, all I can tell is that it does not show the records that I am expecting to see, despite their Record type names being identical. Since the field (and therefore filter) is managed, I cannot see any more information than that. ObjectA__c has 99 custom fields, not sure I can post all of that metadata in one go :( Is there anything in particular that you'd want?
    – Jazzer
    May 24, 2016 at 15:46
  • So, I think something else is at play then - if you look at the metadata now posted in my answer, it clearly shows the name of the Record Type so I would imagine if it wasn't going to work, it wouldn't on the source org either May 24, 2016 at 16:26
  • I'll look into it in the morning. Thanks for your help!
    – Jazzer
    May 24, 2016 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .