@nmlsanmiguel
If vHandlingUnit is returning blank, there might be a few different issues:
1. Mismatched User Name: Ensure the user's full name matches exactly between Power Apps (User().FullName) and your SharePoint List ("Luzon NAFS Users"). This includes any spaces, punctuation, or case sensitivity. You could add a text label in your app with User().FullName to verify what Power Apps is recognizing as the current user's full name.
2. Incorrect Field Names or Types: Verify that 'User Name' and 'Handling Unit' are the correct internal names of the SharePoint List columns. SharePoint sometimes changes spaces to x0020 for internal names, which could cause the issue. Also, check if 'Handling Unit' is a text field and 'User Name' is a Person or Group field.
For more details how to check this internal field name, follow the steps below
You can follow the steps below to find the internal field (column) name in SharePoint:
a. Navigate to your SharePoint list.
b. Click on the gear icon in the top-right corner to open the settings menu and select "List settings."
If you don't see the "List settings" option, you may not have the necessary permissions. In this case, you'll need to contact your SharePoint admin for assistance.
c. In the "Columns" section, you'll see a list of all the columns in your list. Click on the name of the column for which you want to find the internal name.
d. Look at the URL in your browser's address bar. The internal name of the column is the text after the Field= at the end of the URL.
For example, if your URL ends with Field=User%20Name, the internal name of the field is User Name.
Remember, SharePoint replaces spaces with %20 in the URL, so you'll need to replace %20 with a space when using the internal name in Power Apps. If the internal name of your column doesn't match what you're using in Power Apps, you should update your Power Apps code to use the correct internal name.
This should help you verify whether you're using the correct field names in your Power Apps code.
NOTE:
SharePoint uses a specific encoding scheme for special characters and spaces when creating internal field names.
For instance, when a column is created with a space in its name (e.g., "User Name"), SharePoint replaces the space with the hexadecimal representation of the ASCII value for a space, which is "20", but it prefixes it with "x" and postfixes with "". So a space becomes "x0020" in the internal field name.
This means the internal field name for "User Name" would be "User_x0020_Name".
And it would be User_x0020_Name that you need to use in your Power Apps Canvas App in that case.
However, the method I just described for finding the internal field name through the field settings URL decodes this special character representation back into its regular form (a space in this case).
So, even though SharePoint stores the internal name as "User_x0020_Name", you will see "User%20Name" in the URL because "%20" is the URL-encoded form of a space.
You need to be aware of this when using field names in Power Apps or any other platform that interacts with SharePoint. If a field name includes a space, and you are constructing a string to use as a field reference in PowerApps, you will need to use "x0020" to represent that space.
Therefore, in PowerApps, you should be using 'User_x0020_Name' if the field name in SharePoint is 'User Name'.
3. No Data or Access Issues: Confirm that the "Luzon NAFS Users" list has data and that the logged-in user has sufficient permissions to read data from this list. The user must have at least Read access to this SharePoint list.
You can also adjust your OnStart formula to try to debug the issue:
Set(vUserName,User().FullName);
ClearCollect(vAssignees,'Luzon NAFS Users');
Set(vHandlingUnitLookup, LookUp(vAssignees, 'User Name'.DisplayName = vUserName));
Set(vHandlingUnit, vHandlingUnitLookup.'Handling Unit'.Value);
Here, vHandlingUnitLookup should contain the entire record for the logged-in user from "Luzon NAFS Users" list. You can add a text label in your app with vHandlingUnitLookup to verify if the lookup is successful and the record content. If this lookup is unsuccessful (i.e., returns blank), then the issue is likely with the 'User Name' matching. If the lookup is successful but vHandlingUnit is still blank, then the issue is likely with accessing the 'Handling Unit' field value.
Hope this helps @nmlsanmiguel !