web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll Patch for mappi...
Power Apps
Answered

ForAll Patch for mapping table gives "specified column is not accessible in this context" error

(0) ShareShare
ReportReport
Posted on by 122
I have read about this issue on these forums, but I'm still stumped as to what I'm doing wrong in my app.
 
I have a table called Lobby and a table called Services. Lobby is a table for member check-ins to a lobby. Services is a table of potential services rendered to customers.
 
I have a mapping table called Lobby Service Requests for tracking any of the requested services made by a customer in the lobby.
 
This table has 2 Lookups: Lobby and Service, respectively.
 
In my app, I have a combo box that is loading all active Services into the Items.
 
When the Save button is clicked, my lobby member is saved in a Patch call that also saves the row in a variable called SubmittedLobbyMember.
 
Finally, I am trying to loop through the SelectedItems of my combobox and patch all of the new mapped records to the SubmittedLobbyMember record. Here is my block of code that give the error: "The specified column is not accessible in this context":
 
ForAll(RequestedServicesCombobox.SelectedItems,
   Patch('Lobby Service Requests',
      Defaults('Lobby Service Requests',
      {
         Lobby: SubmittedLobbyMember,
         Service: ThisRecord
      }
   );
);
I am desperate at this point and the solution is eluding me.  Any help anyone can lend would be greatly appreciated.
Categories:
I have the same question (0)
  • Suggested answer
    jrletner Profile Picture
    720 Super User 2025 Season 2 on at
    I'm not familiar with the schema or the column types or even your datasource, but in your code you are essentially passing an entire record (ThisRecord) to your column. Which I'm guessing is an ID column or Name column. If I'm wrong about that, can you explain your tables a little better?
     
    Try something like this instead.
     
    ForAll(RequestedServicesCombobox.SelectedItems,
        Patch('Lobby Service Requests',
            Defaults('Lobby Service Requests'),
            {
                Lobby: SubmittedLobbyMember,
                Service: ThisRecord.'Service Name' // Change 'Service Name' to the actual column name
            }
        )
    );
     
    Hope this helps get you down the right path.
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    It happens to me when the table you trying to refer have the same of a column inside the record you try to loop on. Powerapps thinks you try to patch a column instead of a collection... You can rename the column inside the tables referred in your combobox or simply drop the column blocking you, on your comboboxitems. You can also use the logic name of the table to make the reference.
    ​
    ForAll(DropColumns(RequestedServicesCombobox.SelectedItems, 'Lobby Service Requests'),
       Patch('Lobby Service Requests',
          Defaults('Lobby Service Requests',
          {
             Lobby: SubmittedLobbyMember,
             Service: ThisRecord
          }
       );
    );
    or 
    ​
    ForAll(RequestedServicesCombobox.SelectedItems,
       Patch(<logicname of table>,
          Defaults(<logicname of table>,
          {
             Lobby: SubmittedLobbyMember,
             Service: ThisRecord
          }
       );
    );
     
    I hope it helps to solves your situation!

    _____________________________________________

    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!
     
  • Verified answer
    Ravindra Jadhav Profile Picture
    342 Moderator on at
    Hii,
    In ForAll Function we need to Map the Columns as well, like ThisRecord.column name
     
    ForAll(RequestedServicesCombobox.SelectedItems,
        Patch('Lobby Service Requests',
            Defaults('Lobby Service Requests'),
            {
                Lobby: ThisRecord.Lobby,
                Service: ThisRecord.'Service Name'
            }
        )
    );
     
    Please Closed the Question, Mark it Solved 
     
    If my answer helped resolve your issue, please consider marking it as solved to assist others facing the same problem. Additionally, giving it a like would be greatly appreciated and motivates us to keep helping
     
    Thank You
    Ravindra Jadhav
  • Suggested answer
    mhomol Profile Picture
    122 on at
    From my understanding, you have to patch lookups with the Json you would get from a LookUp, which is why I have it looking the way I did.  Posting this and reading through your response did help me think of some other ways to try and tackle this though and here is what ended up working.  I cannot explain why. Essentially, I had to output the GUIDs for the selected items from the drop down then do a ForAll against that. This also meant that I had to do a Lookup for each guid, which seems silly, but it works.
     
    Clear(RequestedServiceIds);
    ForAll(RequestedServicesCombobox.SelectedItems,
       Collect(RequestedServiceIds, ThisRecord.'Service Category'); //This is a GUID
    );
    
    ForAll(RequestedServiceIds,
       Patch('Lobby Service Requests',
          Defaults('Lobby Service Requests'),
          {
             Lobby: SubmittedLobbyMember,
             Service: LookUp('Service Categories', 'Service Category' = Value)
          }
       );
    );
     
     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard