Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
Expand all | Collapse all

Patch CDS data in Canvas App not working

  • 1.  Patch CDS data in Canvas App not working

    Posted Nov 11, 2019 07:12 PM
    Hello all,

    Does anyone know the correct formula to patch data from CDS in Canvas App?  I can successfully patch Sharepoint data, however, I cannot patch CDS data.  Below is the formula I am using (date picker as the example).

    Patch Date record:
    Patch(Demos,Defaults(Demos),{'Date and Time of Demo ':DatePicker.SelectedDate})

    I'd also like to patch the attendee record chosen.  I don't believe I have the correct format for either patch formulas.  Any advice would be greatly appreciated.  Thank you!

    Patch Attendee record:
    Patch(Demos,Defaults(Demos),{'ThisItem.'TSM 1 '.'Full Name'.Selected.Choice})

    Thank you!


  • 2.  RE: Patch CDS data in Canvas App not working

    Top Contributor
    Posted Nov 12, 2019 02:28 AM
    Hi Alison,

    I am not a CDS user, but was interested in your issue. You are correct in that your code should create a new record in SharePoint.

    I am assuming you are trying to create a new record in CDS - there is a good article here that may help you.

    Also another one on existing records (see answer 4) shows some variations thta may assist.

    Good luck.

    Warren Belz
    Ventia Utility Services Pty Ltd
    Rockhampton Qld Australia
    +61 409 315 509

  • 3.  RE: Patch CDS data in Canvas App not working

    Posted Nov 12, 2019 10:14 AM
    Your formula looks correct but since you're creating a new record the problem could be you're only passing one field which is the date and most CDS entities have a Primary field which is usually required and so if you're creating a new record you have to include it and any other required fields on the entity
    As an example if I'm creating a new Task record in CDS and I want to to set the Due date for the Task, if I use the following formula, it will not work because the Subject field is the primary field on the Task entity and is also required

    Patch(Tasks, Defaults(Tasks),{'Due Date': DatePicker1.SelectedDate})

    The correct way to do a new record would be something like this

    Patch(Tasks,Defaults(Tasks),{Subject:TextInput1.Text,'Due Date':DatePicker1.SelectedDate})

    Edrei Mpanduki
    CRM Technical Analyst
    Scottsdale CA