Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Not able to setup lookup value to null in power automate

Posted on by 60

Hi All,

I am listing an entity records which is being used to create a duplicates  of all listed records using power automate flow.

Now, the problem is this entity has got 5 lookup fields to populate to the new duplicates records, when it has got the value I am able to populate and create a new records. But not when it has null value. I cannot add the if else as it will have a lot of branching and look bad.

For example,

When contact lookup has got the value then I am using this expression and its working fine-

/contacts(Dynamic value)

 When it has null value then I am using and its giving error or blank contact even if it has contact

if(empty(items('Apply_to_each')?['body/_new_contact_value']), ' ',
concat('contacts(',items('Apply_to_each')?['body/_new_contact_value'],')'))

 

I cannot use the below expression as suggested by other members as I am fething record form APPLY to each

if(empty(triggerOutputs()?[‘body/_parentcustomerid_value’]), ‘ ‘,
concat(‘accounts(‘, triggerOutputs()?[‘body/_parentcustomerid_value’],’)’))

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: Not able to setup lookup value to null in power automate

    Hi DevCrmUser,

  • Suggested answer
    pavanmanideep Profile Picture
    pavanmanideep 1,329 on at
    RE: Not able to setup lookup value to null in power automate

    Hello,

    Please post this in relevant forum where Power Platform community can assist you. 

    Microsoft Power Automate Community - Power Platform Community

    Cheers,

    PMDY

  • DevCrmUser Profile Picture
    DevCrmUser 60 on at
    RE: Not able to setup lookup value to null in power automate

    I think there is no way to do it as of now. It setting the value to null even we have value in account

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: Not able to setup lookup value to null in power automate

    Hi DevCrmUser,

    Try to use it. I added null there I am thinking this is the fix.
    if(empty(items('Apply_to_each')?['body/_new_contact_value']), null,concat('contacts(',items('Apply_to_each')?['body/_new_contact_value'],')'))
  • DevCrmUser Profile Picture
    DevCrmUser 60 on at
    RE: Not able to setup lookup value to null in power automate

    its not coming from http but I am listing the record using List raws and fetch xml.  I mean can u please tell me explicity for my expression

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Moderator on at
    RE: Not able to setup lookup value to null in power automate

    Hi DevCrmUser,

    How about this 'if(equals(body('HTTP'),0),null,/contacts(body('HTTP')))'?

    pastedimage1677656551584v1.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans