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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CDS to Create an Addre...
Power Apps
Unanswered

CDS to Create an Address in Dynamics 365 Online

(0) ShareShare
ReportReport
Posted on by 34

Has anyone tried to use the CDS to Patch into the OOB Addresses entity?

I'm not sure how to target the parent Contact record.

The PowerApps is launched using a button and some JavaScript from Dynamics that passes the GUID of the Contact.

When the PowerApp launches it creates a Collection using the current address information.

The user then updates the address 1 fields on the Contact using a form in the PowerApp. They hit submit which uses a simple SubmitForm to update the Contact. OnSuccess of that form submission, the code below runs to Patch the Addresses entity with the old address information.

You'll notice I have three lines commented out. Originally this was built using the Dynamics 365 connector that is not available in the GCC - we're working to migrate this app to the GCC. With these lines commented out it successfully creates the new address record, but it's not tied to the Contact.

Any help is appreciated!

Code below:

ForAll(ContactInfoBefore,
Patch([@Addresses],
Defaults([@Addresses]),
{
 //_parentid_type: "contacts",
 //parentid: contactid,
 //addresstypecode: address1_addresstypecode,
 primarycontactname: address1_primarycontactname,
 line1: address1_line1,
 line2: address1_line2,
 city: address1_city,
 stateorprovince: address1_stateorprovince,
 country: address1_country,
 county: address1_county,
 postalcode: address1_postalcode,
 po_status: 'Status (Addresses)'.Previous,
 po_startdate: po_address1startdate,
 po_enddate: DateAdd(
 Now(),
 23,
 Hours
 )
}
)
);  

 

I have the same question (0)
  • BenDenBlanken Profile Picture
    97 on at

    Hi,

     

    Yesterday I answered a similiar question here.

    The parentid you are trying to enter is a polymorphic field. In this case of the type customer. In fields like this you can add an account or a contact. Sadly the CDS connector does not allow us to enter this field directly (yet). We need to

    use Relate to set the customer field.

    See this screenshot below, where ModelDrivenFormIntegration.Item is a Case entity. The "Tasks" is the relationship name.

    OnSelectScript.jpg

     

    Let me know if this helps!

  • dtedwards Profile Picture
    34 on at

    I am doing this within a ForAll() function, so I can't use Set().

     

    I put the Relate() function into where you have Set(). I'm thinking this should do the same thing.

     

    Now I'm getting an error on the Patch(): "The requested operation is invalid. Server Response: Parent id not set for address type 1071"

     

    Seems like 'Parent' is required, but since 'Parent' is Polymorphic I can't set anything to it...

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard