Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Power Query
Answered

Generate Record Url / Link using Power FX Query

(1) ShareShare
ReportReport
Posted on by Microsoft Employee
Hi All , 
 
I am looking to generate current Record link and update in custom Column (X) in same Table form using Power FX query (Patch Function). This is getting doable with Record URL using Classic workflows / Power Automate but exploring a way out to do with Power FX Query. Please advise if this is doable with Power FX query and your help will be much appreciated. 
Categories:
  • Verified answer
    Gabriel G. Profile Picture
    724 Super User 2025 Season 2 on at
    Generate Record Url / Link using Power FX Query
    Hi again,

    @CU02071159-1, if you want a parent reference on the same table, you will need to add a column referencing himself. You create a new lookup field bind on the table himself named 'Parent'. Then, when you will create new record, you set that value to Self.Selected.Item

    It should works.

    I hope it helps!
    __________________________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • Verified answer
    stampcoin Profile Picture
    3,314 Super User 2025 Season 2 on at
    Generate Record Url / Link using Power FX Query
    Not sure if I understand you correctly: 
    What you want to build the deep-link to the current Dataverse record entirely in Power Fx and then write it back to a text (or URL) column with Patch().
    If so, the target should build a valid url.
     
    https://Environment_URL/main.aspx?pagetype=entityrecord&etn=table_name&id=record_GUID
     
    Assume that a minimal Canvas app:
    1. Connectors: Power Apps for Makers.
    2. Tables: Canvas Apps table, a test table from Dataverse.
    3. Screen, one screen with a form and a button.
    4. App OnStart:
     
    // Fetch the 'Environment ID' of current environment
    // Store the in the 'varCurrentEnvironmentID' variable
    Set(
        varCurrentAppUri,
        First('Canvas Apps').AppOpenUri //Canvas Apps table
    );
    Set(
        varCurrentEnvironmentID,
        Right(
            Match(
                varCurrentAppUri,
                "/e/.*(?=/a)"
            ).FullMatch,
            36
        )
    );
    // Use PowerAppsforMakers.GetEnvironments() and fetch all the environments under the tenant
    // Store Environments in to 'collAllEnvironments' collection
    ClearCollect(
        collAllEnvironments,
        AddColumns(
            Sort(
                PowerAppsforMakers.GetEnvironments().value, //the connector
                DataSourceInfo.DisplayName
            ),
            DisplayName,
            properties.linkedEnvironmentMetadata.friendlyName,
            Url,
            properties.linkedEnvironmentMetadata.instanceUrl
        )
    );
    // Filter 'collAllEnvironments' with 'varCurrentEnvironmentID' and fetch the current environment's URL
    Set(
        varCurrentEnvironmentURL,
        First(
            Filter(
                collAllEnvironments,
                varCurrentEnvironmentID in id
            )
        ).Url
    );
    
    
    5. Button's OnSelect =
     
    SubmitForm(Form1);
    
    Set(varInvoice, Form1.LastSubmit);
    Set(
        varInvoiceUrl,
        Concatenate(
            varCurrentEnvironmentURL,
            "/main.aspx?pagetype=entityrecord",
            "&etn=cr597_invoices", //the table logic name
            "&id=", varInvoice.Invoices //GUID
        )
    );
    
    Patch(
        Invoices, // The table
        varInvoice,
        { myurl: varInvoiceUrl } //myurl is the column store the url
    );
    Notify("Link written to column myurl", NotificationType.Success);
    
     
    with the link written into the column I can open it see below.
     
     
    forgot the reference link:
     
        
  • Suggested answer
    CU02071159-1 Profile Picture
    Microsoft Employee on at
    Generate Record Url / Link using Power FX Query
    Hi Gabriel ,
     
    Thanks for your response!
     
    I am using Power FX for Model Driven App Command Bar Button and looking to have Parent Record Link in Copied Record under a Custom Column (X) which will be displayed only in Cloned Record.  Also, I have used Patch function and its working fine for Copy and creating new record, but I am stuck to copy Parent Record Link under Custom Field in Child Record so looking a way out to get this done with Power FX query. 
     
     
    Thanks & Regards
  • Gabriel G. Profile Picture
    724 Super User 2025 Season 2 on at
    Generate Record Url / Link using Power FX Query
    Hi there,
     
    I'm not sure if I understand your request. Do you want to know ways to update a record using PowerFX ? Well, it depends on the app used..

    Since you are using PowerFX in canvas app, I suppose you don't mean update a record from canvas app. Am I right ?

    If you are using model-driven app, you can update a record using a new command button from command bar of your entity. Some day, you will be able to use low-code plugins, but for now it is still a Preview feature I think. Otherwise, without PowerFX, you can use realtime workflow, flow, plugin, custom workflow, javascript... 

    Real question is, what you want to do as an update process and from where you wanna start the process :).

    I hope it helps!
    _____________________________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Featured topics