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

how do i search for a custom object record with the same field value as in an opportunity custom field?
Good afternoon all,
I am new to programming and could use a little help with something.
I have a trigger where I need to find and use a custom object record that has the same field value as the opp that fires the trigger.
The Opp have a custom formula field that shows the quarter when the opp was opened. (Q2-2019).
I need to use that value to find a record in a custom object that has that same value in one of it's field.
Note, there will never be more than one match.
But I have no idea how to do that.
Can anyone offer me some suggestions?
Thanks much,
Steve
I am new to programming and could use a little help with something.
I have a trigger where I need to find and use a custom object record that has the same field value as the opp that fires the trigger.
The Opp have a custom formula field that shows the quarter when the opp was opened. (Q2-2019).
I need to use that value to find a record in a custom object that has that same value in one of it's field.
Note, there will never be more than one match.
But I have no idea how to do that.
Can anyone offer me some suggestions?
Thanks much,
Steve
select APINameofFieldtoselect from your customobjectAPIname where fieldapiname = 'Valuetomatch'
select id from lead where abc__c ='I am here';
Check this trail for better understanding :https://trailhead.salesforce.com/en/content/learn/modules/apex_database/apex_database_soql
For Trigger : https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.