6

A couple of clients would like to use CiviCase and both of them have very unstructured cases, so a timeline or a sequence is not appropriate. So I have created a case without a timeline or sequence but... when an activity is added to such a case it defaults to a status of 'Scheduled'. Both of my clients want to normally record activities after the fact, so for them the status should default to 'Completed'. I don't see how this can be done in the UI. Can anyone either tell me how this can be done with the UI or in the code? If it can't be done in the UI then adding a default status for new case activities seems like a desirable feature.

8

Might be easiest to update the database is_default field. Works for me on a 4.6 site:

update civicrm_option_value set is_default=0 where option_group_id=26 and name='Scheduled';
update civicrm_option_value set is_default=1 where option_group_id=26 and name='Completed';

You may need to change the 26 but it's a stock option group. To confirm first can do:

select id from civicrm_option_group where name='activity_status';

or go to admin - system settings - option groups and see what the id in the link is. Ideally you'd be able to set default value on that screen but it doesn't seem to offer it.

  • Thanks - an interesting suggestion and one that should survive a release update, I guess. – Andy Clark Sep 25 '16 at 12:26
  • Yes, if you check after the update? The database file properties might change in an update. – ErikH - CiviCooP Sep 25 '16 at 12:51
  • Tried this idea and it works. I am surprised that the option_group_id would change between releases though - or am I not understanding something? – Andy Clark Sep 25 '16 at 12:57
4

You can use the buildForm hook on an activity to check if the activity belongs to a case (in which case case_id will not be empty I think) and then set the default status to Completed.

There is an example here, although it sets different statuses for different types it basically does the same thing. Copy and change I would say :-): https://github.com/PUMNL/nl.pum.casestatus And it is developed for CiviCRM 4.4...

  • Thanks for the amazingly fast response! Which was about 3 or 4 minutes... – Andy Clark Sep 25 '16 at 12:27
2

You can also use CiviRules: https://civicrm.org/extensions/civirules

You can set a trigger when a case activity is saved, that the status always changed to "Completed."

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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