8

Can you change your default 'Activity Status' for adding a new activity? We use completed far more than scheduled...

2

5 Answers 5

4

Yes, if you have access to your database, otherwise I don't think so.

You can edit your database. Look for the table called civicrm_option_value and search for WHERE label LIKE 'Scheduled' and WHERE label LIKE 'Completed' and change the values of is_default to 1 or NULL

Here are the exact commands you can run:

UPDATE civicrm_option_value cov JOIN civicrm_option_group cog ON cov.option_group_id = cog.id SET cov.is_default = NULL WHERE cov.name = 'Scheduled' AND cog.name = 'activity_status';
UPDATE civicrm_option_value cov JOIN civicrm_option_group cog ON cov.option_group_id = cog.id SET cov.is_default = 1 WHERE cov.name = 'Completed' AND cog.name = 'activity_status';
0
2

Yes, sorta! If you don't want to operate on your database directly you can configure some rules to make it work. Instead of actually changing what the default status is, you create a rule to set the status according to your wishes.

Use the CiviRules extension: https://civicrm.org/extensions/civirules.

Create a new rule and for the Trigger select "Activity is added". Add any Conditions you want. And give this rule the Action "Update activity status" which can then be whatever you want.

With that rule in place any time you create an activity its status will get overridden to be whatever you configured it to be.

If you don't want the default status to be overridden all the time but only some of the time, then you can add conditions to that rule to specify when the status should be set. If you wanted you could make various rules to automatically set the status differently in various situations.

2

Here's another way to do it using api explorer. Just replace "yoursite" with your site, and this link will take you to the explorer with the necessary fields all filled in. Just click execute. It's smart enough it will at the same time remove default from the old status.

https://yoursite/civicrm/api4#/explorer/OptionValue/update?where=%5B%5B%22name%22,%22%3D%22,%22Completed%22%5D,%5B%22option_group_id:name%22,%22%3D%22,%22activity_status%22%5D%5D&values=%5B%5B%22is_default%22,%22true%22%5D%5D

1
  • Fiddly but fast and effective! Jan 25 at 11:25
1

I wrote a small extension that makes it possible to change the default activity status in the database, without having to do a change directly in MySQL. Admittedly, it's not really simpler than doing it directly in SQL, but I plan on making it available directly from the CiviCRM "Manage Extensions" screen.

It can be downloaded from CiviCRM's extension directory: activitystatus.

0

I modified in my custom templates library CRM/Activity/Form/Activity.tpl, adding a small jQuery script at the bottom of the file.

It looks like so:

{literal}
<script>
CRM.$(function($) {
     $('select#activity_type_id').change(function() {
         $('tr.crm-activity-form-block-status_id').hide();   // hide status ID
         $('#status_id').val('2');   // value from status ID selector
     }
}
</script>
{/literal}

It hides the selector after changing Activity Type, and sets the status value to 'Completed'.

Hope, helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.