You need to sign in to do that
Don't have an account?
Dave The Rave
Ideally with DML code and 'update' command. I have an idea of DML but do not know who to select records from 2 objects related to each other.
Thanks, Dave
Add counter field to records on custom object (related to contacts)
- I have 2 objects: Contact and Rlayer__c
- Each contact can have 1 or more records on Rlayer__c
- I would like to create a counter field on Rlayer (now, and then when a record is created on Rlayer.
- So the first record related to the contact on Rlayer WHERE sportsclub__c = 'Windsor' = should have a field count__c = 1
- The 2nd record on Rlayer related to the contact on Rlayer WHERE sportsclub__c = 'Windsor' = should have a field count__c = 2
- The 3rd record on Rlayer related to the contact on Rlayer WHERE sportsclub__c = 'Windsor' = should have a field count__c = 3
Ideally with DML code and 'update' command. I have an idea of DML but do not know who to select records from 2 objects related to each other.
Thanks, Dave
Please check below sample class:
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Try a trigger like below.
Best regards
Sampath