3

When I assign a case role to someone it seems like CiviCRM allows/requires me to search through the whole contact database. As there might be many matches for a search string it takes extra time to ensure that the one I assign is really the one I intended.

In my organization only a few persons are actually possible targets for such an assignment, as I assume is the case in most constituents, thus only a few in the contact database should be possible to select on e.g. assignment of case responsible.

Am I missing some configuration to make this happen? I know about permissions (which I so far have had no need for, "normal" contacts don't access our CiviCRM), are they related to this?

On essence, I want the contacts to be searched when assigning a case role to be limited, e.g by a group, so a match can be found quicker and more unambiguous. How do I do that?

1

The contact selector is an EntityRef field. If you'd like to "enforce" a certain group or other filter on this field, you can do so with a small amount of custom code on your site.

Modifying a form in CiviCRM depends on how the form is generated. Because this form is written in javascript, I recommend adding a custom js file to the CiviCase dashboard screen. It simply needs to add data to the two fields (edit_role_contact_id and add_role_contact_id) that specifies the group_id of your group.

You can either use a custom module/plugin on your website or create an extension to add your javascript file using CRM_Core_Resources from a hook. hook_civicrm_caseSummary might be a good one, you wouldn't be using it for exactly its intended purpose but it fires on the right screen.

  • Where do I read up on implementing such a custom addition? I am a seasoned programmer... – thoni56 Apr 27 '15 at 10:55
  • I had given some doc links already but just edited the post to add more. Happy coding :) – Coleman Apr 27 '15 at 14:12
  • Ok, partially there. What JS object should I add the data to? How do I find out? – thoni56 May 1 '15 at 10:29
  • Add it directly to the form elements in the dom. I gave you their names above. – Coleman May 1 '15 at 17:12
  • thoni56, did you get this working? If so, can you share what you did? I want to do the same thing, and having an example would save me a lot of time. Thanks! – Norris May 29 '15 at 7:37
2

As of CiviCRM version 4.6 the contact autocomplete (aka entityRef) field provides the sort of filters you are requesting.

Add role dialog

When the autocomplete box opens you'll see a "Refine search..." option, which allows you to limit results by group, tag, contact type, and other filters.

  • That helps. But as a general aid in finding and creating contact relations, it only works when you add a role, not modifying etc. Also the person doing it need to know which group or tag etc. to use. I was looking for a way to define that group in the case type or something similar. – thoni56 Apr 23 '15 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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