In line if statement in MS Flow (power automate)

Recently I was working on a requirement where I had to clone a record and record had 50+ fields and some of the fields were look up.

Flow (power automate) sounded a perfect solution for this purpose however I ran into problems when look ups were null and following errors were appearing…

The supplied reference link — accounts() — is invalid. Expecting a reference link of the form /entityset(key).

Below is how I was passing valuse

Above will work whenever we have a valid record, however if it is null then it will throw error.

One option is to check null before creating a record however did not want to put if against all records.

Below is a very simple solution we can use to check in line if record is empty or not

if(empty(outputs(‘Get_Work_Order_Details’)?[‘body/_rok_costcenter_value’]),”,concat(‘accounts(‘,outputs(‘Get_Work_Order_Details’)?[‘body/_rok_costcenter_value’],’)’))

Comments are closed.