CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • setting "Employee of " relationships, current employer, and Shared address
Pages: [1]

Author Topic: setting "Employee of " relationships, current employer, and Shared address  (Read 727 times)

jimurl

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: drupal 6.22
  • MySQL version: 5+
  • PHP version: 5+
setting "Employee of " relationships, current employer, and Shared address
February 02, 2014, 10:17:24 am
I am setting employee/employer relationships in bulk, and I wanted to see if anyone had tread this before:

I can do a search on email address, and find all the Individuals with a particular domain, then use the Actions Menu to Add to Organization as employees.

However, creating this relationship does not have the effect of setting the "Is current Employer" checkbox in the edit relationships form. So on the view contact page, 'the current employer' field is blank even though the relationship was created.

AT the database level, it looks like two fields in the contact table are affected- employer_id and organization_name. Has anybody looked at ways to auto-populate these on the basis of an Employer/employee relationship.

Giving the employee a shared address, using their organization employers address does does appear to populate these fields. But I can't find a way to give a shared address to contacts in bulk.

It would be nice to have a little script that updated those fields in the contact table on the basis of active empl/employee relationship. Even nicer if it could populate a shared address as well. Has anybody seen or done something like this?

I looked at the import to do this; but those fields (organization_name and employer_id) are not available. They are available in the Search Builder, though.

Any thoughts?

JIm

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: setting "Employee of " relationships, current employer, and Shared address
February 02, 2014, 11:28:28 am
this isn't a solution for doing it in bulk, but worth knowing that WEbform-civicrm can handle the relationship, is current, and shared address all on one form, and with the autocomplete for the person concerned, might prove to be a reasonable fast solution - set the form to return back to the blank form upon submission to remove one more step.
not sure if that is clear enough, but since it isn't really a bulk approach may not be relevant enough to spell out further. The webform-civicrm documentation is very good.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

jimurl

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: drupal 6.22
  • MySQL version: 5+
  • PHP version: 5+
Re: setting "Employee of " relationships, current employer, and Shared address
February 02, 2014, 08:24:45 pm
Hi Pete,

Yes, I think you are right: the webform_civicrm integration module is awesome, and does deal with all three of these issues ( create relationship, set employer; and set work address all in one fell swoop), very efficient.

But, yep, I am looking to do this, in bulk, with existing contacts (import with 'overwrite, or update existing data' would work). Or some kind of script, using 'Scheduled Cron Jobs' functionality; maybe run it kind of like 'update addressee' scheduled cron job ( though I would probably choose it to execute manually only ...). Or, just a php script to run in a drupal page with 'evaluate php' filter.

If I come up with something usable by other groups, I will post it back here.

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: setting "Employee of " relationships, current employer, and Shared address
February 03, 2014, 08:34:29 am
I have a transform in Kettle for a Kintera migration I did that handles an import of current employers, setting both employer_id in civicrm_contact and creates the relationship as well.  I just looked it over to see how I did it and how it'd apply here.

If you're comfortable with the command line, check this out: http://civicrm.org/blogs/xavier/api_batch_tools.  If not, Eileen has an extension that puts a GUI on doing CSV import/export via API.  That will let you import to the employer_id field.

Of course, for that you'll need a list of employer_ids.  You can use the same tools to do an export of contact ids for relationship_type_id = 5 (employee/employer).  Get both contact_id_a and contact_id_b.  Then do an import (also using the API tool)
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • setting "Employee of " relationships, current employer, and Shared address

This forum was archived on 2017-11-26.