I have a list in sharepoint that I'm populating via power automate.
I had a bit of trouble getting all the data, now I'm not managing to get a lookup type value.

This value is one of the letters of the alphabet, which however I would like to obtain dynamically from each user by taking the first letter of the surname in uppercase.

To obtain this data I thought of using as custom value this function:
toUpper(substring(items('Apply_to_each')?['surname'], 0, 1))

and in fact it works, because I get the letters correctly, but evidently the data type is not suitable, because it makes errors:
OpenApiOperationParameterTypeConversionFailed. The 'inputs.parameters' of workflow operation 'Create_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/AZLookUp/Id' is required to be of type 'Integer/int64'. The runtime value '"P"' to be converted doesn't have the expected format 'Integer/int64'.

What am I doing wrong? How can I solve it?