I'm working on a project using Sharepoint and PowerAutomate. I want to write an expression in PowerAutomate.
I want to update a field and store the company name of the person who created the item in the Sharepoint list.
I could simply use the ' Company Name ' after I add search for user (V2) function, but the problem is that I only want the first 4 letters of the company name.
I tried many expressions, like:
substring(triggerOutputs()['body']['createdBy']['CompanyName'], 0, 4)
outputs('Search_for_User')?['body/d/CompanyName']
but I had no luck.
Use "Get user profile (V2)" action and give the email from the trigger "Created by" as input.
If company name is populated in the AD, you will get value using below expression:
outputs('Get_user_profile_(V2)')?['body/companyName']
After that you can use substring to get the first four letters.