3

We recently upgraded to CiviCRM 4.7.19 on Drupal 7.52 and for some reason the New Organization button isn't appearing when searching for an unknown organization for a contact's current employer. I can add an organization via CiviCRM > Contacts > New Organisation but our backoffice staff liked being able to add from the person contact page. I've checked the console and there are no errors flagged and isn't a CSS thing as the element holding the button exists but just doesn't have the button markup e.g. instead of:

<div class="crm-entityref-links"> <a class="crm-add-entity crm-hover-button" href="/civicrm/profile/create?reset=1&amp;context=dialog&amp;gid=5"><i class="crm-i fa-building"></i> New Organization</a></div>

the page only has:

<div class="crm-entityref-links"></div>

I've checked permissions and as far as I can tell everything is set ok. Is there a setting I'm missing?

enter image description here

Update

Looking at our l10n-js file I can see that the contactCreate object is not being populated:

CRM.config.entityRef = $.extend({}, {"contactCreate":[]...

Digging into the code I can see this is supposed to be created in Core/Resources.php (line 685):

'contactCreate' => CRM_Core_BAO_UFGroup::getCreateLinks()

Looking at CRM/Core/BAO/UFGroup.php I can see the getCreateLinks() function calls

public static function getCreateLinks($profiles = '', $appendProfiles = array()) {
    // Default to contact profiles
    if (!$profiles) {
      $profiles = array('new_individual', 'new_organization', 'new_household');
    }
    $profiles = (array) $profiles;
    $toGet = array_merge($profiles, (array) $appendProfiles);
    $retrieved = civicrm_api3('uf_group', 'get', array(
      'name' => array('IN' => $toGet),
      'is_active' => 1,
    ));

Running a similar API call on our install:

$result = civicrm_api3('UFGroup', 'get', array(
  'sequential' => 1,
  'name' => array('IN' => array("new_individual", "new_organization")),
));

I get no results, the reason is because the name is actually new_organization_5 not new_organization Still don't know how to fix

2
  • On my copy (running the master branch) I can create a new organization from this widget (while logged in as an administrator). I know that doesn't solve your problem but hopefully it's helpful! Commented May 17, 2017 at 16:17
  • 1
    can see it working on dmaster.demo.civicrm.org as well .. still not sure why are install is missing this
    – mhawksey
    Commented May 17, 2017 at 20:31

1 Answer 1

2

As you discovered, the system expects to have 3 reserved profiles: "new_individual", "new_organization" and "new_household". If you accidentally deleted or renamed those profiles (machine "name" field not the user-facing title) I suggest naming them back, or else creating new ones with those names.

1
  • Excellent - I've been struggling for months to work out why one of my sites was manifesting this issue. Now I've finally fixed it. I guess the next question is how a reserved profile got deleted.
    – Graham
    Commented Sep 10, 2017 at 16:44

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.