function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lokesh PatilLokesh Patil 

Trigger and Test class

Create a custom number field on Account and name it ‘Total Campaign Cost’
Create a lookup relationship on Campaign as Account.
Use Campaign ‘Actual Cost’ field for operations.
Each time a campaign status is marked as ‘Completed’ add the amount into the ‘Total Campaign Cost’ field of account.
Update Account Status:
If Total Campaign Cost on Account is greater than $10,000 : Platinum
If Total Campaign Cost on Account is > $8,000 & <$10,000 : Gold
If Total Campaign Cost on Account is <$8,000: Silver



Also, create an apex test class to ensure developed code can be deployed; adhere to best practices of the testing framework.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Lokesh,

Although, this could be done with a trigger have you checked with a simple OOB solution like flows or process builder as this scenario seems to be one that can be implemented with an OOB (out of the box ) tool implementation?

Trigger implementation: https://developer.salesforce.com/forums/?id=906F0000000MNCwIAO

Let me know in case if there are any issues or questions also in case if this comes in handy can you please choose this as the best answer so that it can be used by others in the future.

Regards,
Anutej