Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

campaign response

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

i want to add a compaign respense, but i can't insert a customer, 
this is my code :

Entity CR = new Entity("campaignresponse");
CR.Attributes["subject"] = "Demande " + origine_source + " " + date;
CR.Attributes["cor_compte"] = new EntityReference("account", accid);
CR.Attributes["description"] = description;
CR.Attributes["receivedon"] = date;
CR.Attributes["customer"] = new EntityReference("account", accid);

Guid regardingobjectid = campaign_0[0].Id;
CR.Attributes["regardingobjectid"] = new EntityReference("campaign", regardingobjectid);

m_service.Create(CR);

thank you.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: campaign response

    it wos a best way to insert data,

    Thank you very much

    Best regards,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: campaign response

    Thank you Fun the program works very well

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: campaign response

    Hi ,below is the sample code

    Entity party1 = new Entity("activityparty");
    party1["partyid"] = new EntityReference("account", accid);

    EntityCollection to = new EntityCollection();
    to.Entities.Add(party1);

    Entity CR = new Entity("campaignresponse");
    CR.Attributes["subject"] = "Demande " + origine_source + " " + date;
    CR.Attributes["cor_compte"] = new EntityReference("account", accid);
    CR.Attributes["description"] = description;
    CR.Attributes["receivedon"] = date;
    CR.Attributes["customer"] =to;

    Guid regardingobjectid = campaign_0[0].Id;
    CR.Attributes["regardingobjectid"] = new EntityReference("campaign", regardingobjectid);

    m_service.Create(CR);

    1030.10.png

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: campaign response

    Hi anna,

    The customer field in campaign response is a list, not a lookup.

    7433.9.png

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: campaign response

    Hi ,

    As promised yesterday, I am in middle on looking it

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: campaign response

    customer is a list group in my Dynamics CRM, do you think that's a good method to insert data like this : CR.Attributes["customer"] = new  EntityReference("account", account_id);

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    Temmy Wahyu Raharjo 2,914 on at
    RE: campaign response

    Please check weather you have a customization on CampaignResponse entity. Try to disabled it first then try to create again. Maybe the problem is not in this code.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: campaign response

    yes, i get a value of accid

  • Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: campaign response

    did you notice while debugging , did accid has value?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: campaign response

    I have no error, but the customer field is still empty

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans