web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Account Composite Address C# SDK

(0) ShareShare
ReportReport
Posted on by

HI All,

Just wondering if there's a simple answer I can't see....

I'm currently writing code using the C# SDK for Dynamics CRM 2016. 

This code updates the addresses from another source. 

I've tried setting Address1_xxxx fields on the account entity, and I've also tried setting them directly on the appropriate customeraddress entity.

In both cases, the "composite address" on the Account screen doesn't update.

I noticed that if i perform a similar update to a customeraddress entity that relates to a contact, that the contact screen does show the updated composite, even though it doesn't update the actual "composite" field in the database until the GUI triggers a save.

Is there something I can do to encourage the Composite Address to render properly on Account screens, or force it to update the database when the SDK Is making changes?

I'm guessing a fall-back solution might be some java-script on-load to manually re-populate the composite, but I feel like there's a proper answer to this?


Regards, Charles

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Charles Sceuber,

    Please refer the following threads. The same issue you are facing is rectified in the links below.

    community.dynamics.com/.../150607

    https://community.dynamics.com/crm/f/117/t/177432

  • Suggested answer
    Siraj M Profile Picture
    on at

    Hi Charles,

    I did an update on the address1_line2 field in account entity

    it in turn updated the composite address field 

    Entity account = new Entity("account");
    account.Id = new Guid("4A7295E3-7997-E611-8139-000D3A922D0E");
    account.Attributes["address1_line2"] = "test";
    _service.Update(account);

    I did not do any operation on customer address related to account

    Regards,

    Siraj

  • Suggested answer
    Alagunellaikumar Profile Picture
    6,212 on at

    Check your code to update the account entity with correct schema name "address1_line2" Because column name is case sensitive

  • Community Member Profile Picture
    on at

    Hi Guys, Thanks for all the replies.

    I copied Siraj's code and it worked fine, but its almost identical to mine, so this was weird - so i worked back by commenting out lots of code, and slowly re-adding it.

    If i comment out any one line, the composite addresses update. it doens't matter which of the below lines are commented out... 

    However, if i let all lines save, the actual data is saved and visible. If you check audit history  - there is simply no update to either of the composites, but as soon as any one line is commented out - the composites get updated. 


    This is a really curious bug/interaction that i'd like to solve but for now I guess i can just make two separate updates...


    Thanks for the help!

    I have finally isolated an issue. here are the code blocks:

    account["address1_line1"] = sa.street1;
    account["address1_line2"] = sa.street2;
    account["address1_line3"] = sa.street3;
    account["address1_city"] = sa.city;
    account["address1_postalcode"] = sa.postcode;
    account["address1_stateorprovince"] = sa.State;
    //account["address1_country"] = sa.country;

    account["address2_line1"] = ba.street1;
    account["address2_line2"] = ba.street2;
    account["address2_line3"] = ba.street3;
    account["address2_city"] = ba.city;
    account["address2_postalcode"] = ba.postcode;
    account["address2_stateorprovince"] = ba.State;
    account["address2_country"] = ba.country;

  • Alagunellaikumar Profile Picture
    6,212 on at

    Hi

    Thanks to hear. Could you please close thread and marked as verified?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans