The error "EmployeeSoftwares is not accessible in this context" usually occurs because this table might not be recognized in the context of the ForAll function or this table might not be properly added as a data source in your app. Try below solutions
1. Ensure EmployeeSoftwares is added as a data source in your app
2. Create a collection to store the selected software items. Assume you are working with a gallery named GallerySoftware, and it has a checkbox for selection.
ClearCollect(
SelectedItems,
Filter(GallerySoftware.AllItems, CheckboxSelected.Value)
);
3. Store the currently selected employee in a variable. For example, if the current employee is determined by the logged-in user
Set(
CurrentEmployee,
LookUp(Employees, Email = User().Email)
);
4. Use ForAll to loop through the collection and patch each selected software to the EmployeeSoftwares table. Use explicit field references to avoid ambiguity.
ForAll(
SelectedItems,
Patch(
EmployeeSoftwares,
Defaults(EmployeeSoftwares),
{
Employee: CurrentEmployee,
Software: ThisRecord
}
)
);