@Kashif1
Your formula will not provide what you need.
You can use the UpdateIf function to update a list conditionally. However, it has very poor performance.
So, consider the following to replace your formula:
If(
IsBlank(First(Office365Users.SearchUser({searchTerm:Gallery2.Selected.'Mail address'})).DisplayName),
Patch(CCH_BLR_RESOURCE_LIST,
ForAll(
Filter(CCH_BLR_RESOURCE_LIST,
'Name Requester' = Gallery2.Selected.'Name Requester'
) As _item,
{ID: _item.ID,
LMName:"Inactive"
}
)
),
Patch(CCH_BLR_RESOURCE_LIST,
ForAll(
Filter(CCH_BLR_RESOURCE_LIST,
'Name Requester' = Gallery2.Selected.'Name Requester'
) As _item,
{ID: _item.ID,
Organization: Office365Users.ManagerV2(Office365Users.ManagerV2(Gallery2.Selected.'Mail address').mail).department
}
)
)
)
It too is not that performant and can be simplified to the following:
With({_items: Filter(CCH_BLR_RESOURCE_LIST, 'Name Requester' = Gallery2.Selected.'Name Requester') },
If(
IsBlank(First(Office365Users.SearchUser({searchTerm:Gallery2.Selected.'Mail address'})).DisplayName),
Patch(CCH_BLR_RESOURCE_LIST,
ForAll(_items,
{ID: ID, LMName:"Inactive"}
)
),
Patch(CCH_BLR_RESOURCE_LIST,
ForAll(_items,
With({_dept:
Office365Users.ManagerV2(
Office365Users.ManagerV2(Gallery2.Selected.'Mail address').mail
).department
},
{ID: ID, Organization: _dept}
)
)
)
)
)
I hope this is helpful for you.