简体   繁体   中英

How to set leadsource in Dynamics crm using api?

I have a WordPress website and I am using a Gravity Forms CRM addon to create lead in CRM. I need to set lead source which is a dropdown in crm lead. while sending data to crm (via api) I am getting an error:

System.ArgumentException: Incorrect attribute value type System.String Parameter name: leadsourcecode

I tried sending text and number as well but not working.

The leadsourcecode field receives a Edm.Int32 accourding to WebAPI documentation . The following is an example of a create request setting the Lead Source to Advertisement(1):

POST /api/data/v9.0/leads
odata-maxversion: 4.0
odata-version: 4.0
accept: application/json
content-type: application/json

{
 "subject": "test api 2",
 "leadsourcecode": 1
 }

You can also review the default options for the field in the same lead entity documentation I mentioned before:

Value Label

1 Advertisement

2 Employee Referral

3 External Referral

4 Partner

5 Public Relations

6 Seminar

7 Trade Show

8 Web

9 Word of Mouth

10 Other

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM