Can't assign a lead to a user via API on creation

Hi all,

I'm looking for a little help with the SugarCRM API.

I'm trying to create a lead, using the API, and would like to assign that lead to a specific user.

This is the data I'm currently passing:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
first_name: "TEST",
last_name: "TEST",
email: [
{
"email_address":"test@test.com",
"primary_address":"1",
"invalid_email":"0",
"opt_out":"0"
}
],
assigned_user_id: 'some active user id'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This is the endpoint I'm hitting:

/rest/v11_8/Leads

From what I've read elsewhere on the forum, adding the assigned_user_id field should be sufficient to assign the lead to the specified user, however it seems to randomly assign them to another user.

Is there anything else I need to check?

Any advice appreciated.

Thanks

  • I tested it on a demo instance and it seems to work. Only thing I needed to is to change the json a bit since it wasn't valid. See code below with the valid json.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    {
    "first_name": "TEST",
    "last_name": "TEST",
    "email": [
    {
    "email_address":"test@test.com",
    "primary_address":"1",
    "invalid_email":"0",
    "opt_out":"0"
    }
    ],
    "assigned_user_id": "seed_wayne_id"
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi ,

    We are currently doing a similar task.  We will create the lead but then use Process Definition to assign to the right person (or might use Group user).   Maybe process Definition would help you too?