Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7
-
Fix Version/s: None
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
The code generated for JavaScript when trying to get a custom value is not correct. It puts the return into brackets which causes the javascript to have an error.
Here is the generated code:
CRM.api3('Contact', 'getvalue',
{ "sequential": 1, "return": ["custom_102"], //custom_fieldId "id": 2 // contact id }).done(function(result)
{ // do something });
Here is the error:
Object
{ invalid_field: Array[1], is_error: 1, error_message: "field Array unset or not existing" }
error_message : "field Array unset or not existing"
invalid_field : Array[1]
0 : "custom_102"
See this post:
http://civicrm.stackexchange.com/questions/14666/getting-a-custom-field-value-on-a-contact-with-javascript-api