cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulBI
Resolver I
Resolver I

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

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 

18 REPLIES 18

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

PaulBI
Resolver I
Resolver I

Thanks for the quick response @jesudas .  

1) I do have a delegation warning, but I wasn't worried about that because I know what it refers to will stay under 2000

2) It does say what column in the error message, it just says "this column is not accessible in this context" so I'm not sure which one it is refering too.  And I didn't change anything between when it did and didn't work

3)I tried refreshing and deleting the connection and reconnecting and neither worked.

FYI

default row count is 500. hope you changed that to 2000

 

Also, can you please post your current code? 

I did thankfully.  Below is the code.  

 

ForAll(galWorkItems_1.AllItems,
//**** Task Title
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).Name <> lblWorkItemTitle_1.Text,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Task title changed to: " & lblWorkItemTitle_1.Text
            ,
            100
        ),
    updatedescription: "Task title changed to: " & ": " & lblWorkItemTitle_1.Text,
    Code:"8"}));
//**** Task Description
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).Description <> lblWorkItemDescription_1.Text,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Task description changed to: " & lblWorkItemDescription_1.Text
            ,
            100
        ),
    updatedescription: "Task description changed to: " & lblWorkItemDescription_1.Text,
    Code:"9"}));
//**** Task Category
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).Category.Name <> lblWorkItemCategory_1.Selected.Name,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Category changed to " & lblWorkItemCategory_1.Selected.Name
            ,
            100
        ),
    updatedescription: "Category changed to " & lblWorkItemCategory_1.Selected.Name,
    Code:"5"}));
//**** Task Milestone
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).Milestone.Name <> lblWorkItemMilestone_1.Selected.Name,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Milestone updated to " & lblWorkItemMilestone_1.Selected.Name
            ,
            100
        ),
    updatedescription: "Milestone updated to " & lblWorkItemMilestone_1.Selected.Name,
    Code:"3"}));
//**** Task Priority
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).Priority.Name <> lblWorkItemPriority_1.Selected.Name,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Priority updated to " & lblWorkItemPriority_1.Selected.Name
            ,
            100
        ),
    updatedescription: "Priority updated to " & lblWorkItemPriority_1.Selected.Name,
    Code:"4"}));
//**** Task Assignee
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).'Team Member'.Name <> lblWorkItemAssignedTo_1.Selected.Name,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Work item assigned to " & lblWorkItemAssignedTo_1.Selected.Name
            ,
            100
        ),
    updatedescription: "Work item assigned to " & lblWorkItemAssignedTo_1.Selected.Name,
    Code:"2"}));
//**** Task ETA
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).ETA <> lblWorkItemETA_1.Value,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Target date changed to " & lblWorkItemETA_1.Value
            ,
            100
        ),
    updatedescription: "Target date changed to " & lblWorkItemETA_1.Value,
    Code:"7"}));
//**** Task Status
If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).'Work Item Status'.Name <> lblWorkItemStatus_1.Selected.Name,

Patch(Updates,Defaults(Updates),{
    Projectupdated:gblProject,
    updatedworkitem: LookUp(
            'Project Work Items',
            Text(msft_projectworkitemid) = Label1.Text
        ),
    Name: Left(
            "Status Changed to " & lblWorkItemStatus_1.Selected.Name & ": " & lblWorkItemTitle_1.Text
            ,
            100
        ),
    updatedescription: "Status Changed to " & lblWorkItemStatus_1.Selected.Name & ": " & lblWorkItemTitle_1.Text,
    Code:"6"}))    
)

I am not sure if the below two lines are causing the issue

 

If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).'Team Member'.Name <> lblWorkItemAssignedTo_1.Selected.Name,

 

and

 

If(LookUp('Project Work Items',Text(msft_projectworkitemid)=Label1.Text).'Work Item Status'.Name <> lblWorkItemStatus_1.Selected.Name,

PaulBI
Resolver I
Resolver I

I had thought that too, but if I replace them with simple lookups the failure is still in the patch and patch defaults statements.  I've even taken the patch out of the lookup and still have the issue.

Ok. You have lots of patches going on here. Let's try to find the culprit. How about divide and conquer? 

 

//**** Task Title
//**** Task Description
//**** Task Category
//**** Task Milestone
//**** Task Priority
//**** Task Assignee
//**** Task ETA
//**** Task Status

 

start with just a lookup for "Task Title" and its patch. comment out remaining sections. Once this is working, add the next section to the working code. (comment out the rest of the sections)

 

by doing this, we will know which section is the culprit. once we know the section, we should able to identify the root cause. 

 

Also, not sure if you know how to use the "Stethescope" icon which is shown at top right? that could give you some clues. But, try my suggestion and see how we could solve together

PaulBI
Resolver I
Resolver I

I tried that and it starts right away with the first patch.  But if I isolate each one, each one by itself get's the same error as well. 
I haven't used the stethoscope before but I'll give it a shot.

OliverR-82
Continued Contributor
Continued Contributor

I was running into this same error "The specified column is not accessible in this context" for no apparent reason. The exact same formula was working fine on another table.

I came across this post  on this forum, and using the disambiguation  operator in the table name that is patched as suggested in the solution to that thread, seems to solve this problem. I thought I would post it here as well, maybe it will help other people who come across this thread.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,144)