Answers.Body: <p>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:</p>
  
  <p>Field Label
  Custom field 'Role' already exists in Database.</p>
  
  <p>But I can still add 'Role to any other CustomGroup where it is not used yet. </p>
  
  <p>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. </p>
  
  <p>So before you push, you should do a query on both:</p>
  
  <pre><code>$result = civicrm_api3('CustomField', 'get', array(
    'sequential' =&gt; 1,
    'custom_group_id' =&gt; "Entity",
    'name' =&gt; "Role",
  ));
  </code></pre>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-24T17:44:32.843Z
Answers.LastActivityDate: 2016-06-24T17:44:32.843Z
Answers.UserDisplayName: ñull
Answers.Body: <p>This sounds like a use case for multisites!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T21:26:45.883Z
Answers.Text: Could you say a bit more about this and explain how it would work?
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-25T19:26:38.970Z
Answers.LastActivityDate: 2016-08-25T19:26:38.970Z
Answers.UserDisplayName: JohnFF
Body: <p>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.</p>
  
  <p>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).</p>
  
  <p>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?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-11T21:14:55.103Z
Comments.Text: 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
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-11T21:19:18.043Z
Comments.Text: 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
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Tags: <api><custom-fields>
Title: Custom field API and Custom field Machine name
ThreadText: # Custom field API and Custom field Machine name
  
  (Asked by: username_0 on 2015-09-11)
  
  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?
  
  **Tags:** api, custom-fields
  
  > **Comments:**
  > **username_1**: 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  
  > **username_1**: 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  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-06-24. Score: 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.
  
  
  ---
  
  ### Answer by username_3 on 2016-08-25. Score: 0
  
  This sounds like a use case for multisites!
  
  > **Comments:**
  > **username_4**: Could you say a bit more about this and explain how it would work?  
  
  ---
  
  