
Team,
I would like to get the employee's designation based on the name(Datacardvalue10). The formula looks fine. However, during the submission, I am getting the "Office365users.UserProfileV2 failed. The method UserProfileV2 has an invalid value of parameter 'id'.
Please help me to fix the issue.
If(!IsBlank(Find("-",Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle)),
Left(Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle,Find("-",Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle)-1),
!IsBlank(Find(",",Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle)),
Left(Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle,Find(",",Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle)-1),
Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle
)
Regards,
Alwin
Hey @allwynbazil,
You should probably be using With so that you aren't repeatedly calling the Office365Users, like this:
With({ O365Lookup: Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle},
If(!IsBlank(Find("-",O365Lookup)),
Left(O365Lookup, Find("-", O365Lookup) -1),
!IsBlank(Find(",",O365Lookup)),
Left(O365Lookup, Find(",", O365Lookup) -1),
O365Lookup
)
)
but from the error message it sounds like the account you chose either doesn't have a proper email address (is it a service account or some other kind of non-user account?) or its doing the lookup before there is a selected item. So you can probably mitigate that with a check at the beginning like this:
If(!IsBlankOrError(DataCardValue10.Selected.Email),
With({ O365Lookup: Office365Users.UserProfileV2(DataCardValue10.Selected.Email).jobTitle},
If(!IsBlank(Find("-",O365Lookup)),
Left(O365Lookup, Find("-", O365Lookup) -1),
!IsBlank(Find(",",O365Lookup)),
Left(O365Lookup, Find(",", O365Lookup) -1),
O365Lookup
)
)
)