You need to sign in to do that
Don't have an account?
Sainath Venkat
trigger for auto number based on parent record salesforce
Is it possible to have a trigger to auto name child records based on Parent Record.
I have two objects which are having lookup relationship.
1) BuildCycle__c
2)ActionItem__c
Each build cycle can have multiple action items and I want to name all action items for a particular build cycle in sequence.
For example,
BUILDCYCLE Record1 has 2 action items and sequence should be
1) ActionItem1
2) ActionItem2
BUILDCYCLE Record1 has 3 action items and sequence should be
1) ActionItem1
2) ActionItem2
3) ActionItem3
Can anyone guide me on this how to achieve
I have two objects which are having lookup relationship.
1) BuildCycle__c
2)ActionItem__c
Each build cycle can have multiple action items and I want to name all action items for a particular build cycle in sequence.
For example,
BUILDCYCLE Record1 has 2 action items and sequence should be
1) ActionItem1
2) ActionItem2
BUILDCYCLE Record1 has 3 action items and sequence should be
1) ActionItem1
2) ActionItem2
3) ActionItem3
Can anyone guide me on this how to achieve
Please mark the answer as best answer in case this worked for you :)
Thanks for your reply and fr helping me out, actually I knew this but I am more concerned about bulkification,
Lets say I am inserting 50 records using data loader of which 25 records are related to 1 BULDCYCLE1 and 25 related to BUILDCYCLE2, in that case the code which you provided will not work actually.
Greetings to you!
Use the following code. It may helpful for you
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Hope you doing great and thanks a lot for helpng me out in this issue, your code working good but lets say for one build cycle I have 4 action items
BUILD CYCLE:1
1) Actionitem1
2) Actionitem2
3) Actionitem3
4) Actionitem4
now count is 4 and if I delete Actionitem3 and creates Actionitem5 then name should be Actionitem5 but now its creating Actionitem4 only, can you help me out in this issue here.
Here is my code