This topic contains 2 replies, has 2 voices, and was last updated by Tom Holland 8 years, 4 months ago.
- Topic
Hello!
I’m having a problem setting the Lead Source on Leads that are created through the API.
I have altered the default source “Demand Generation” and defined “Direct”, “Web Form”, “Live Chat” and “Personal” as Lead Source Select items in the UI.
Using /api/doc and posting this data to /api/rest/latest/leads.json:
1234567891011121314151617181920212223{"lead":{"name":"Example LeadPerson","namePrefix":null,"firstName":"Example","middleName":null,"lastName":"LeadPerson","nameSuffix":null,"jobTitle":null,"phoneNumber":"123-321-1232","email":"email@example.com","companyName":null,"website":null,"numberOfEmployees":null,"industry":null,"notes":"Example of a Note","contact":null,"owner":1,"customer":null,"dataChannel":1,"campaign":null}}Results in a successfully created Lead.
When I do a GET on the created lead, I get:
123456789101112131415161718192021222324252627282930313233343536,{"id": 7,"name": "Example LeadPerson","namePrefix": null,"firstName": "Example","middleName": null,"lastName": "LeadPerson","nameSuffix": null,"jobTitle": null,"phoneNumber": "123-321-1232","email": "email@example.com","companyName": null,"website": null,"numberOfEmployees": null,"industry": null,"createdAt": "2015-12-18T18:53:55+00:00","updatedAt": "2015-12-18T19:01:02+00:00","notes": "Example of a Note","status": "New","contact": null,"address": null,"owner": {},"opportunities": {},"workflowItem": {"__initializer__": {},"__cloner__": {},"__isInitialized__": false},"workflowStep": "New","organization": "example.dev","customer": null,"dataChannel": "channel","campaign": null,"source": "Direct"}So then I post this data to try to create a Lead with “Direct” as source:
123456789101112131415161718192021222324{"lead":{"name":"Example LeadPerson","namePrefix":null,"firstName":"Example","middleName":null,"lastName":"LeadPerson","nameSuffix":null,"jobTitle":null,"phoneNumber":"123-321-1232","email":"email@example.com","companyName":null,"website":null,"numberOfEmployees":null,"industry":null,"notes":"Example of a Note","contact":null,"owner":1,"customer":null,"dataChannel":1,"campaign":null,"source":"Direct"}}Results in a 400 validation error saying:
12345"source": {"errors": ["This value is not valid."]}I have tried using integers such as
1"source":1and strings like
1"source":"Web Form"and other variations of syntax but it seems that any request that includes a source parameter fails validation regardless of if the value is valid in the UI and is returned as valid in a GET request.
What am I doing wrong?
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.