Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums OroCRM OroCRM – How do I? Questions What is the correct API Lead Source syntax?

This topic contains 2 replies, has 2 voices, and was last updated by  Tom Holland 2 years, 2 months ago.

  • Creator
  • #57559

    Tom Holland


    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:

    Results in a successfully created Lead.

    When I do a GET on the created lead, I get:

    So then I post this data to try to create a Lead with “Direct” as source:

    Results in a 400 validation error saying:

    I have tried using integers such as

    and strings like

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #57560



    Check your table oro_enum_lead_source

    I would try to pass the value you see in “id” field. For example if you want to set “Demand Generation” it must be: “demand_generation”


    Tom Holland

    Thank you @Rodolfo !

    That was the ticket. Even though I had changed Demand Generation to Direct, the Id was still demand_generation.

    Interesting that varchar is used for Id vs. int. After looking at the db a bit, I see that there are also tables that don’t have an Id, just name and label although most tables do use integer Ids. I’ll keep that in mind in the future.

    Thank you again,

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.