OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums 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 8 years, 4 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #28695

    Tom Holland
    Participant

    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:

    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
    Replies
  • #28696

    Rodolfo
    Participant

    Hi,

    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”

    #28697

    Tom Holland
    Participant

    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,
    Tom

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

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top