function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tolby HuntTolby Hunt 

Opportunity Lookup filter help

I want ot create a lookup filter for my opportunity. I have a field that has an ID as a text that i want to compare to an ID on a custom object and fill in the lookup to what object it found with the same ID. Any way to do this?
jigarshahjigarshah
I believe you will need an Apex trigger to do this. Although you could use a workflow or a process builder to retrieve the related record Id, you cannot use them to update a Lookup field.

Hence an Apex trigger to compare and update the respective loookup field would facilitate your requirement.

If you can provide more details around the object and the fields in consideration, I can help you build the trigger.
Tolby HuntTolby Hunt

Yes please! I have my Lead that has the text field of   

AF1__c

that field is populated on creation and then passed to the opportunity when it is converted.
so i guess i will actually need it on the lead.

So, once the lead is created, AF1__c equals a text string, then if that text string equal to the field

Affiliate_ID__c      in my object Affiliate__c

I want to have the field in the lead named

Affiliate_Name__c 

to be updated to the Affiliate object which has the matching IDs. If you have more questions feel free to reply more.

Thank you so much!

jigarshahjigarshah
How and when is an Affiliate__c created? What is the relationship between Lead and Affiliate__c?
Tolby HuntTolby Hunt
Sorry i made a mistake in what i said earlier. I will explain again in more detail.

I have an opportunity that
when AF1__c isChanged it creates an Affiliate__c object with that(AF1__c) as the Affiliate_ID__c in my object Affiliate__c
But i have another field in my opportunity called Affiliate_Name__c that i want to equal the object of the
affiliate pertaining to the Affiliate_ID__c on my opportunity. All of these fields happen on lead and opportunity