2

We are working on a roll out which will include approx 100 instances of CiviCRM being created for an org. The organisation is Federal in so far that there is a central org and then a significant number of local branches.

Part of the project is to develop a data push for activities from the branch instances of CiviCRM to the head orgs instance so that data analytics can be done by the head organisation. The issue is that the ID's of the custom fields for the branch instances of CiviCRM are different to the head instance (and different between themselves).

We are proposing using Machine name instead of Activity ID for the API calls. Does the API support data pushed to it by machine name as opposed to ID?

2
  • so you have created 100 instance of civiCRM - why is that you can use a single code base and you can connect to multiple DB - did you try that will that be useful for you Commented Sep 11, 2015 at 21:14
  • please Explain me what you are trying to achieve - If I am not wrong - you are trying to access data from each instance using API - and you are trying to differentiate each API using machine name Commented Sep 11, 2015 at 21:19

2 Answers 2

1

If I understand right, the CustomField 'name' is unique in every CustomGroup. In my prototype I have two CustomFields 'Role' but they have two different 'custom_group_id'. When I try to add a 'Role' CustomField to either one of these CustomGroups, then it errors out with the message:

Field Label Custom field 'Role' already exists in Database.

But I can still add 'Role to any other CustomGroup where it is not used yet.

In the form I can only set the label, but at creation the 'name' is created from the label. When I rename the label, the 'name' is unchanged. This is the machine name of CustomField.

So before you push, you should do a query on both:

$result = civicrm_api3('CustomField', 'get', array(
  'sequential' => 1,
  'custom_group_id' => "Entity",
  'name' => "Role",
));

This will return the right id and will allow you to do your push. Then it is very useful to straight away to use the returned id through api chaining.

0

This sounds like a use case for multisites!

1
  • Could you say a bit more about this and explain how it would work? Commented Aug 25, 2016 at 21:26

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.