Jul 19 2021 09:05 AM - edited Jul 19 2021 09:20 AM
Please could someone give me some pointers on how I can split a userPrincipalName from user.name@doamin.com to user.name?
Essentially I want to extract everything before the '@' symbol.
I attempted using this syntax however it is not working, so any pointers would be greatly appreciated.
split(triggerBody()?['object']?['properties']?['owner']?['userPrincipalName'], '@')
This leaves me with ["user.name", "domain.com"], how can I escape the "domain.com"
Jul 19 2021 10:20 AM
@TS-noodlemctwoodle I think if you append "[0]" to end of your split you will only get the username.
Jul 20 2021 12:49 AM
The template language expression 'split(triggerBody()?['object']?['properties']?['owner']?['userPrincipalName'], '@')['0']' cannot be evaluated because property '0' cannot be selected. Array elements can only be selected using an integer index.
This isnt possible, I have tried many variations of the same
split(triggerBody()?['object']?['properties']?['owner']?['userPrincipalName'], '@'),['0']'
split(triggerBody()?['object']?['properties']?['owner']?['userPrincipalName'], '@')(['0']')
Jul 20 2021 03:19 AM
Solution
Thanks for the pointers, this is the working Expression.
Jul 20 2021 03:19 AM
Solution
Thanks for the pointers, this is the working Expression.