Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Unanswered

​Power automate flow won't run officescript in 'Run Script' action when started by partner.

Posted on 2 Dec 2024 13:51:35 by 392
I developed a script that fills two tables in an excel file via an office script via power automate flow, launched via a button in a power apps app.
This solution works pretty fine and a lot faster than our previous solution that relied on a refresh of some queries.
 
I understand that the power automate flow runs as the person who clicked the button in power apps and also this info is added to the excel via the script.

But when a partner runs the power automate flow the run script action return this:
{
  "message": "The server experienced an issue and couldn't run the script. Please try again in a few moments.\r\nclientRequestId: e9990f40-3ceb-4fd2-ac75-92ac28b2e746",
  "logs": null
}
The office script is integrated in the excel file, so no sharing issues.
Partner can access and modify the excel file, can even run VBscripts, etc, so no permission issues.
The parameters provided to the office script, are identical when the partner runs the flow, compared to when I do it. 
 
The only thing that comes to mind is, is there some hidden setting to prevent 'others' outside organisation, from run an office script?
And if so, why not an error message that hints to this?
 
 
 
  • MichelH Profile Picture
    MichelH 392 on 04 Dec 2024 at 09:44:24
    ​Power automate flow won't run officescript in 'Run Script' action when started by partner.
    Too bad, adding the onedrive part to the flow, adds onedrive connector to the existing app.
    Partner now gets a screen to refresh the onedrive connection but the allow button never gets enabled, no errors are shown.
     
    Back to the drawing board.
  • MichelH Profile Picture
    MichelH 392 on 03 Dec 2024 at 16:38:08
    ​Power automate flow won't run officescript in 'Run Script' action when started by partner.
    Thanks again Anchov

    I tried both 'Run Script from SharePoint Library' and  'Run Script'.
    I can see on SharePoint that the Partner can even edit the script, but the flow says:
    "message": "Script not found. It may have been unshared or deleted.
    But probably I can create the script in the partner's onedrive when they run the flow.
    After all the SharePoint file containing the script  is 100% available to the partner so I will try that now.
    That works!

    The scriptId is different for every user, so I had to make the script dynamic.
    But it is made up from the file part of the id I get from the create file, preceded by ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F 

    Also the ScriptParameters now need to be given a one JSON: 
    {
       "Data1" : "@outputs('JSON2StringD1')",
       "Data2" : "@outputs('JSON2StringD2')"
    }
    Testing with partner tomorrow.
  • Anchov Profile Picture
    Anchov 1,970 on 02 Dec 2024 at 16:32:03
    ​Power automate flow won't run officescript in 'Run Script' action when started by partner.

    Have you considered using the "Run Script from SharePoint Library" action instead? You can find more information here: 

    Run Office Scripts from a SharePoint Library.

    This action allows you to specify the script's location in a shared library, unlike the standard "Run Script" action, which always points to the user's personal OneDrive. Using a shared library ensures that the script is accessible to multiple users without requiring them to save copies in their individual OneDrives.


  • MichelH Profile Picture
    MichelH 392 on 02 Dec 2024 at 15:45:42
    ​Power automate flow won't run officescript in 'Run Script' action when started by partner.
    Thank you Anchov,

    I think I was misguided by what I see here, where it pretends you can put the office script in the file, "and all is fine" but that is not what is happening.
     


    While I can share the script, it will still be impossible for the flow to run it, because each user will have another scriptId.
     
                "scriptId""ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01HDFdbJW575I1G3FWZDGZRFE5WJEYFMVC",
     
    Am I wrong to assume this simply cannot be made dynamic ?
     
    Partner is a group of people that probably will all have another onedrive.

    I initially tried sharing the script on the same SharePoint where the excels are, and that also did not work, even if partner could edit the script.
  • Anchov Profile Picture
    Anchov 1,970 on 02 Dec 2024 at 15:08:21
    ​Power automate flow won't run officescript in 'Run Script' action when started by partner.
    Office Scripts are stored in the script originator's OneDrive under the Documents\Office Scripts folder. The script currently works for you because the Power Automate action references your personal OneDrive's Office Scripts folder. However, it won't work for your partner because the script is not stored in their own OneDrive's Office Scripts folder.

    To enable your partner to use the Power Automate flow with the Office Script, they need to save a copy of the script in their own OneDrive, specifically in the Documents\Office Scripts folder. Additionally, ensure the script has a unique name to avoid any conflicts.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,372

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,900

Leaderboard