Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

How to copy the the folder of the document to another using power automate

(0) ShareShare
ReportReport
Posted on by 154
1)An application should have a lookup for its parent application on the application table (on the same table).

2)Add Ribbon Button On Application. The document is visible only if the parent application contains data (when a user clicks on the button titled /document history/ and on lookup selects any record which has already been created, then copies the document and attaches it to the current record(only copy the document of the filer Property + Technical record this two.).

3)Call Power Automate -- > add documents from the parent application on click

4)Show form Notification  /Documents will be moved in the background. Please check after some time/.

5)Environment Variable to store Power Automate URL

(Note: I have a flow which is  to create a folder so i want when user selects the lookup which is application is created the copy that document to current on click of  button)
  • Verified answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    How to copy the the folder of the document to another using power automate
    Hi,
     
    You can add the following code to the custom button to call the flow.
    function onload(primaryControl){
        var formContext = primaryControl;
     
        // get current record guid.
        var GUID = formContext.data.entity.getId();
        GUID = GUID.slice(1,-1);
     
        const req = new XMLHttpRequest();
     
            // This URL comes from the connector in the flow / when an HTTP request is received / generated URL.
            var url = "<your URL>";
            req.open("POST",url,true);
            req.setRequestHeader("Accept","application/json");
            req.setRequestHeader("OData-MaxVersion","4.0");
            req.setRequestHeader("OData-Version","4.0");
            req.setRequestHeader("If-None-Match","null");
            req.setRequestHeader("Content-Type","application/json ");
            //Sends the GUID of the current record to the flow.
            var body=`{"GUID":"${GUID}"}`;
            req.send(body);
       
    }
     
    The Power Automate Flow is shown below.
     
    If the parent record does not exist, the flow is aborted.
     
    Gets the parent record and creates a folder for the current record.
    Expression: replace(triggerBody()?['GUID'], '-', '')
     
    Get the filer Property and Technical Audit folders of the parent record.
    Expression:toUpper(replace(outputs('Get_the_parent_application')?['body/crf6a_applicationid'], '-', ''))
     
    Copies files from the parent record's filer Property and Technical Audit folders to the current record's folder.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

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 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans