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 / Patch function on rega...
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 
Categories:
I have the same question (0)
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    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
    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

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 101 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 70

Last 30 days Overall leaderboard