You need to sign in to do that
Don't have an account?
Please implement a trigger on inserts of new records of custom object
We have to implement following things on the insert of new records :
- If Practice ID on the new record is populated:
Try to find an existing account where Context ID(Text field) on the account contains the value of Practice ID(Text) on the Custom Object.
If the value in Practice ID is less than 5 digits, add zeroes to the left of the Practice ID when comparing.
For example, if Practice ID is 123, try to find an account where Context ID contains ‘00123’.
Note: The value in Practice ID on the Custom object shouldn’t be modified.
After: If we are getting any matching Accounts then create some records like create contact related to Account etc.
Can any one help me to achieve this functionality?
Thanks,
Amit
Hi Amit,
Please try this trigger + apex class. Please note that in order to keep this simple for demostration purposes, this is not "Blukified"
Create Apex Class - Your Name | Setup | Develop | Apex Classes: New
Then goto Your Name | Setup | Create | Objects | MyCustomObject | Trigers | New
Let me know how you go :-)
All Answers
Hi Amit,
Please try this trigger + apex class. Please note that in order to keep this simple for demostration purposes, this is not "Blukified"
Create Apex Class - Your Name | Setup | Develop | Apex Classes: New
Then goto Your Name | Setup | Create | Objects | MyCustomObject | Trigers | New
Let me know how you go :-)
Hi zachbarkley,
Thanks for your help.
This is my exact requirement but i am not able to understand R.id in above code.
Can you please let me know?
Thanks,
Amit
Hi Amit,
My appologies, R.Id should be upRec1.Id. It's comparing the old vales to the new values to see if it did indeed had an old record. If it didn't have an old record, it then decides that it's a new record.