0

I'm using power automate to return user profile data from AAD via graph api. My calling graph api query

https://graph.microsoft.com/v1.0/groups/groupid/members?$select=displayName,city,department,businessPhones,jobTitle,officeLocation,mail,mobilePhone,createdDateTime&$top=2

Some users have the field businessPhones empty (See json below).

{
        "@odata.type": "#microsoft.graph.user",
        "displayName": "DXu Po",
        "city": "Ondo",
        "department": "Design",
        "businessPhones": [
          "93625613000"
        ],
        "jobTitle": "Designer",
        "mail": "comradecom.au",
        "mobilePhone": null,
        "createdDateTime": "2019-09-18T05:54:26Z"
      }

I tried the below to check if the field is empty and if yes insert null

if(empty(items('Apply_to_each_2')?['businessPhones'][0]),'[]',null)

But still getting the same error. Any ideas what i'm missing here. Thanks in Advance

1 Answer 1

1

Based on above condition it's look like when businessPhones empty it's returning '[]' and when not empty it's returning null. Based on your description your condition should look like something below

if(empty(items('Apply_to_each_2')?['businessPhones']?[0]),null,items('Apply_to_each_2')?['businessPhones']?[0])

added ? to avoid null error

1
  • Thanks Bharat. That did the trick not sure what i was thinking Commented Sep 26, 2024 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.