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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Patch function on regarding field

(0) ShareShare
ReportReport
Posted on by 25
Hi guys,
I'm currently working on a PowerApp connected to our Microsoft Dynamics CRM system. I want to create a note related to a lead.
These two entities are connected through the regarding field. The regarding field can connect lots of entities with a note. I want to connect it to a lead.

When I look at the table in the Power Apps Table function, I can't see what I need to write in there to really connect to the lead entity.
The regarding field is a polymorphic field and a lookup field in Dataverse.
What do I need to post in the Patch function so the regarding field gets assigned properly?
Below is my current function:
 
Patch(
    Notes, 
    Defaults(Notes),
    {
        Title: "Test Note",
        Description: "This is created from a PowerAPP",
        Regarding: {
            '@odata.type': "#Microsoft.Dynamics.CRM.lead", // Typ der Entität
            id: GUID("d5182447-4d6c-ef11-a670-0022487eddc5") // ID des Leads
        },
        isdocument: false // Setze den Wert für das isdocument-Feld
    }
)
 
With this function I don't get any errors, but when I look at the record in the table, the regarding is empty 
I have the same question (0)
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Patch function on regarding field
    Hi,
     
    Use this and mark me varified if this helps you

    The issue you're encountering with the Regarding field being empty in the record, despite no errors being thrown, might be related to how the data is being passed into the Regarding field, especially since it's a polymorphic lookup field in Dataverse.
     
    Patch(
        Notes, 
        Defaults(Notes),
        {
            Title: "Test Note",
            Description: "This is created from a PowerAPP",
            Regarding: {
                '@odata.type': "#Microsoft.Dynamics.CRM.lead", // Entity type for Lead
                id: GUID("d5182447-4d6c-ef11-a670-0022487eddc5"), // Lead GUID
                logicalname: "lead" // Logical name of the entity (Lead)
            },
            isdocument: false // Set the value for isdocument field
        }
    )
     
     
    Ensure the Lead ID is correct: Double-check that the GUID you provided ("d5182447-4d6c-ef11-a670-0022487eddc5") corresponds to an existing Lead record in your environment.
  • Verified answer
    MH-09121531-0 Profile Picture
    25 on at
    Patch function on regarding field
    It worked like this. I first saved the Lead I want to set the regarding into a variable, so I get the Record Data Type.
     
    The patch function looks like this: 
     
    Patch(
        Notes, 
        Defaults(Notes),
        {
            Title: "Fair-Photo",
            Description: "This is created from a PowerAPP",
            Regarding: LastLead,
            'Is Document': true,
            'Mime Type': "image/png",
            'File Name': "Fair-Picture",
            Document: Left(Last(Split(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData), ",")).Value, Len(Last(Split(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData), ",")).Value) -1)
        }
    )
     

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard