You need to sign in to do that
Don't have an account?
Mohd Nabeel
Can someone please tell me how can i achieve this task. i am very confused in this. How can i do this
Create two field on Account: 1 - Amount X (Number), 2 - Amount Y (Number).
Create a two fields on Contact: 1 - Amount Type (Picklist: Amount X, Amount Y), 2 - Amount (Number)
You have to rollup amount in the correct field on account record and it depends on the Amount Type field on Contact.
I also need to bulkify this code.
Create a two fields on Contact: 1 - Amount Type (Picklist: Amount X, Amount Y), 2 - Amount (Number)
You have to rollup amount in the correct field on account record and it depends on the Amount Type field on Contact.
I also need to bulkify this code.
I have gone through your requirements and created a trigger -
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
I was trying the above code to do with the handler class but it is giving me an Exception 'Attempt to de-reference a null object'on line 27 and 30.
You have three number fields, AmountX, and AmountY on Account and Amount on Contact.
Please set the default value of these fields to zero.
Like this -
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Add these two lines in your code just below line 12 which is "for(Account acct: accList){"
acct.AmountX__c = 0;
acct.AmountY__c = 0;
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Please modify the lines I gave you with this code -
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
I have resolved my error, actaully i have realised that instead of comparing a Number with zero i was comparing it with the Null value may be thats why it was giving me that error. So, i have just changed my code to "if(amtX != NULL)" to if(amtX != 0) without adding those lines after the for loop which you have suggested.
and it is working fine.
Thanks for ur help Sir.