将contact/Lead导入到SalesForce Campaign

Salesforce平台可以将contact或者lead导入到Campaign中
即给该Campaign 添加Campaign Members,如下图所示:


将contact/Lead导入到SalesForce Campaign_第1张图片

使用REST API 可以将联系人导入的同时,将其加入指定的Campaign,好不容易调研出来,一定要记录下来,啊哈哈哈~~~~

step1

用户输入要将该联系人加入的Campaign Name

step2

根据Campaign Name查询该Campaign是否存在

  1. 若存在,则根据Name获取CampaignId
  • 请求:GET
    https://yourinstance.salesforce.com/services/data/v29.0/query?q=SELECT+Id%2CName+FROM+Campaign+ORDER+BY+Name+ASC

  • 返回:
    {
    "attributes": {
    "type": "Campaign",
    "url": "/services/data/v29.0/sobjects/Campaign/7010O00JulqAC"
    },
    "Id": "7010O00JulAC",
    "Name": "test campaign"
    }

  1. 若不存在,则创建一个相应Name的Campaign,并获取CampaignId
  • 请求:POST
    https://yourinstance.salesforce.com/services/data/v29.0/sobjects/Campaign {"Name":"yonghu create"}
  • 返回:
    {"id":"7010O00JumPQAS","success":true,"errors":[]}}

step3

导入过程中要先创建accountId(公司唯一标识),然后将该accountId作为参数去上传contact

POST https://yourinstance.salesforce.com/services/data/v29.0/sobjects/Account

POST https://yourinstance.salesforce.com/services/data/v29.0/sobjects/Contact

用户导入Cantact或者Leads完成后,获取其ContactId或LeadId
并通过CampaignId与用户指定的Campaign Name建立联系,成为其Campaign Member

  • 请求:POST
    https://yourinstance.salesforce.com/services/data/v29.0/sobjects/CampaignMember {"CampaignId":"701200004nAAQ","LeadId":"00Q0O007IyBUAK","ContactId":"0030O002UMQA3"}

  • 返回 Campaign Member ID:
    {"id":"00v0O000QAN","success":true,"errors":[]}}

至此,就将cantact/lead导入Campaign啦!

REST API:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_what_is_rest_api.htm

Campaign参考字段:
https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_Campaign.htm

添加Campaign Member参考字段:
https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_CampaignMember.htm

你可能感兴趣的:(将contact/Lead导入到SalesForce Campaign)