You need to sign in to do that
Don't have an account?
David Jobe
how to write apex code to match two different ojects
Hello,
I am making the transition from Admin to Developer, and I am working on building an Apex Class. Still very new at it. Very.
What I am trying to do is to build code that when a new Account is added, that the system goes and checks the Contracts Object to see if there is a matching Contract to that Account (sometimes Accounts will not have a contract). Normally, I would do this with Access beforehand, but the base files are getting to large for both contracts and accounts.
What I need is that the code pulls the new account, checks that it has something in the Contract Number Custom Field (Contract_Number__c). If it does, it pulls all the Contracts and does basically a VLOOKUP against the custom field Bg Contract Number (BG_Contract_Number__c). If it finds a match, it fills in the Account lookup field on Contracts.
Any help would be greatly appreciated.
I am making the transition from Admin to Developer, and I am working on building an Apex Class. Still very new at it. Very.
What I am trying to do is to build code that when a new Account is added, that the system goes and checks the Contracts Object to see if there is a matching Contract to that Account (sometimes Accounts will not have a contract). Normally, I would do this with Access beforehand, but the base files are getting to large for both contracts and accounts.
What I need is that the code pulls the new account, checks that it has something in the Contract Number Custom Field (Contract_Number__c). If it does, it pulls all the Contracts and does basically a VLOOKUP against the custom field Bg Contract Number (BG_Contract_Number__c). If it finds a match, it fills in the Account lookup field on Contracts.
Any help would be greatly appreciated.
Best Answer chosen by David Jobe
Ron Reed
Is there a 1-1 relationship from Contracts to Account? If so, this should work: