+ Start a Discussion
Samuel Gonsalves 8Samuel Gonsalves 8 

Can we automate the status of an account?

Hi All,

1. We would like accounts which have not had any opportunity against it to be automatically move to inactive.
2. If they have not created any opportunity in 12 months or more they should be marked as inactive.

can anyone please help me to achieve this

Hi Samuel,

This can be achieved through point-and-click itself. here is how.

1.) Create a rollup summary field on Accounts to count the number of opportunities under the account. (https://help.salesforce.com/HTViewHelpDoc?id=fields_defining_summary_fields.htm&language=en_US)
2.) Create a workflow rule on the Account object to fire if the rollup summary field value is zero, with a "time-based" Field Update action to update the "Active" field, with a time trigger of "12 months after Creation Date". (https://help.salesforce.com/HTViewHelpDoc?id=creating_workflow_rules_configure_actions.htm&language=en_US)

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Samuel Gonsalves 8Samuel Gonsalves 8
Hi Shashank,

Thanks for a quick reply. I was aware of the 1st part .
Regardin 2nd part u mention that if the role uo summary field is zero then run the trigger and update but in my example whether it is 0,1,2 etc but if a new opp is not created in 12 months interval it should automatically update the as "inactive"

can u please help me out how i can achieve this
To handle that, you have to edit the rollup summary field to count only opportunities whose created date is LESS THAN 12 MONTHS. This can be done by selecting "Filter Criteria" in the rollup summary field settings.
Samuel Gonsalves 8Samuel Gonsalves 8
Thanks shashank...for your quick reply.

You are right but in this case the 1st point will became invalid. I want both to work. Can u please suggest.
Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)

If your requirement is like you should have atleast one opportunity on account in every 12 months then Only one rollup summary field with filter criteria as createddate <= 12 months will suffies your requirement.

If you want to make sure either of the criterias are satisfied then you can write a trigger on opportunity which will update a custom field on account with count of opportunity and you can have rollupsummary field to store opportunity count created in last one year. Your workflow will be evaluated in either of the case mentioned here to update account status.

Nilesh Jagtap.
Samuel Gonsalves 8Samuel Gonsalves 8
Hi Nilesh,

can you please help me out with the trigger along with the steps to fullfill this requirement. M new to triggers

Thanks in advance.