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 / Forall patch new recor...
Power Apps
Answered

Forall patch new record returns that the column is not accessible in this context

(1) ShareShare
ReportReport
Posted on by 91

I'm a little stuck.  If I remove the forall it works perfectly but when I add forall it gives a failure that the column is not accessible.  The even stranger part is that I use the same gallery and forall/patch above with a different table but edit records instead of create new and have no problems.  I tried changing this to edit but I still get the error.  Any help is appreciated.

 

ForAll(galWorkItems_1.AllItems,
 Patch(
 'Project Activities',
 Defaults('Project Activities'),
 {
 Project: gblProject,
 // 'Work Item': Label1.Text,
 'Work Item':LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text),
 Name: Left(
 WorkItemUpdate_1.Text & ": " & lblWorkItemTitle_1.Text
 ,
 100
 ),
 Description: WorkItemUpdate_1.Text & ": " & lblWorkItemTitle_1.Text, 
 Code: "0" //code for custom update
 }
)
)

  I'm convinced I'm forgetting something simple but for the life of me can't see it.

 

Thanks 

Categories:
  • jesudas Profile Picture
    29 on at

    not sure what the issue is. I am just guessing here. Maybe accessing the lblworkitem is causing the issue

     

    how about a set statement before Forall

     

    Set(myVar, lblworkitemtitle_1.text);

     

    and then use this myVar inside the ForAll statement

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @jesudas If the label is inside the gallery, this will not work.

    @PaulBI what is gblProject?

    Is it a field in the Gal.AllItems? If Yes, create a label and set it to ThisItem.gblProject and use label.Text in your ForAll

    If it is a global variable, ignore the above (I am assuming you are adding work items to a project)

    BTW, which column gives the error of not being accessible?

  • PaulBI Profile Picture
    91 on at

    Thanks for the quick replies.  To answer the first question, @jesudas unfortunately lblworkitemtitle_1.text is inside the gallery.  For the second question @Anonymous gblProject is a global variable.  Attached is the full error message but it never calls out specifically which column is causing the issue. 

     

     

    2021-02-19_07h15_02.png
  • PaulBI Profile Picture
    91 on at

    I do have an update but not a fix yet.  So I found that if I collect the gallery and select a specific column out of it, the error is removed, but nothing is written.  Progress but still not able to make it work.  Any ideas?

     

    Snip.PNG

  • PaulBI Profile Picture
    91 on at

    Collected more information just now.  I changed the column to something that is unique for each row in the gallery.  If I change and update just one row it works.  If I update more than one (say 3), it recognizes that and will create 3 records but each record is identical (typically looks to be the last row I edited) and doesn't record the other two at all.  Hopefully this means something and I can start to figure out how to correct?

  • Verified answer
    PaulBI Profile Picture
    91 on at

    So it is definitely some issue with the table itself.  I plugged other tables in that worked.  I tried disconnecting and reconnecting the table but that didn't help.  I ended up making a second table to mirror this one and wrote to that one successfully and will have to go back and rewrite everywhere else I write to the old one to the new one...  Wish I could figure out what the preventing issue was but never figured it out.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Okay, so one thing to note here. You are using Forall on colChangedItems but are referring to Label1.text and other labels as well. These labels should not be in a Gallery. If they are in the gallery, they will always pick from the first gallery item.

    Your earlier method of looping over gallery items suggested something else. if you switched to collection, you should switch the values passed in the patch function accordingly.

     

  • PaulBI Profile Picture
    91 on at

    Yeah I was trying everything I could think of (collecting and using a collection, connecting and reconnecting datasource, etc) even if I deleted everything after the defaults statement it still errored out so the issue originates before pulling all those labels, etc in.  My added datasource hasn't had any issues since, doesn't make any sense but it's working.  

  • PaulBI Profile Picture
    91 on at

    Ok I really can't explain this.  The new table I created worked great from Wednesday to this afternoon.  Now it is giving the exact same error as the last one did saying that the column is no longer accessible...  Something is changing in the table that causes this error to happen, but I have no idea what could be doing it...

  • jesudas Profile Picture
    29 on at

    can you try these / answer these?

     

    1) do you have any delegation warning message?

    2) can you check the table structure to see if the column is available

    3) can you do a datasource refresh in PowerApps just to sync with your backend

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard