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 / Set or update context ...
Power Apps
Unanswered

Set or update context inside ForAll function of PowerApps

(0) ShareShare
ReportReport
Posted on by 147
 
I've a requirement, where I need to use updatecontext inside a ForAll function, I understand it's not supported.
Do you have any alternatives/ suggestion on this use case.
Please find the code below, any suggestion is really appreciated.
 
// I'm adding data into SharePoint List from a collection
ForAll (JobSheeWCollection,
Patch ('Job Sheet', Defaults('Job Sheet'),{
Title: Customer,
Mobile: Mobile,
Email: Email,
Address: Address,
MachineModel: Model,
JobType: InsType,
CustomerRemark: CustRemark,
EngRemark: EngRemark,
SLNo: SLNo,
TempID: ID,
JobID: "JOB No : 0" & Last('Job Sheet').ID + 1 } );
 
//Can't assign any variable here, from another collection
//UpdateContext( { sFileContent: Filter(SignatureList,FileContent in ID).FileContent } 😞 Not supported
Filter(SignatureList,FileContent in ID).FileContent; //Executes with no error
//Run a flow which accept 2 parameters (file name, file content), to upload file into sharepoint folder, and
//getting error in below line.
CreateSignature.Run( "JoobID:"& Last('Job Sheet').ID & ".png", JSON(Filter(SignatureList,FileContent in ID).FileContent)));
//Error
 
);
Thank you for your support. 
 
Thank You
Ananda
 
 
 
 
 
ReplyForward
 
 
 
 
 
 
 
 
 
Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @ananda ,

     

    Although it is not supported to define a variable in ForAll loop, you can collect data to collection, so use Collection to store and reference data. 

     

    However, what is the error in your case? I have some confusion with your code:

    1. What does the Filter code mean? What is SignatureList? Why does this mean that 'FileContent in ID'?

    2. You miss the JSONFormat in JSON function, it should be: JSON("Your Data",JSONFormat.IncludeBinaryData)

     

    Please share more information.

    Sik

  • Ananda Profile Picture
    147 on at

    Managed to execute the code without error, data saved, but images are not visible. now it's formatting issue.

     

    ForAll (JobSheeWCollection,
    Patch ('Job Sheet', Defaults('Job Sheet'),{
    Title: Customer,
    Mobile: Mobile,
    Email: Email,
    Address: Address,
    MachineModel: Model,
    JobType: InsType,
    CustomerRemark: CustRemark,
    EngRemark: EngRemark,
    SLNo: SLNo,
    TempID: ID,
    JobID: "JOB No : 0" & Last('Job Sheet').ID + 1 } );
    CreateSignature.Run("JOB No : 0"&Last('Job Sheet').ID &".png", "JOB No : 0"& Last('Job Sheet').ID &".png",
    Mid(JSON(Filter(SignatureList,JobId in ID).FileContent,JSONFormat.IncludeBinaryData),Find(",",JSON(Filter (SignatureList,JobId in ID).FileContent,JSONFormat.IncludeBinaryData))+1, Len(JSON(Filter(SignatureList,JobId in ID).FileContent,JSONFormat.IncludeBinaryData)) - Find(",",JSON(Filter(SignatureList,JobId in ID).FileContent,JSONFormat.IncludeBinaryData))-3) ));
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @ananda,

    Please share the flow steps, and why you need to define the JSON like that?

    Sik

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard