cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Burak_Oezfalci
Frequent Visitor

Checking null value for CDS field

Hi all, currently I am working on a Flow which exports Accounts from Dynamics 365/Common Data Service and adds them to an external system.

 

I have created a custom string field in Dynamics 365/CDS for the Accounts Entity.

What I want to do is exporting an Account to an external system, after the export I want to update the Account Record and add the ID of that account in the external system.

 

The first steps in the flow are the following ones:

1.) When a record is selected is the trigger action for this flow.

2.) Condition which checks if the custom string field is empty/null

 

I do have problems with the second step, especially when the selected account has not been exported already and therefore has null as the value of the custom field.

In this circumstances the Flow is showing me the following error https://support.microsoft.com/en-us/help/4540228/there-is-a-problem-with-the-flow-s-trigger

If the account has been already exported, then it has a value for the custom string field and the flow is running correctly.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Burak_Oezfalci ,

 

From the select record action which you were doing previously do select the variable value and compare it with null , no trim or length functionality is required. Just ensure that you are typing null using expression and not direct input. 

 

Thanks

View solution in original post

14 REPLIES 14
ManishJain
Solution Sage
Solution Sage

Hi @Burak_Oezfalci ,

 

Can you please share what are you using to check the empty/null value for custom field.

 

Thanks

Hi @ManishJain , i tried different approaches but none of them was successful.

 

I needed to add the step with the variable because i could not use the Flow functions like empty or length, i had no dynamic content available after selecting the function.

 

1.) Using a variable and checking if it is empty.

Burak_Oezfalci_0-1604301794298.png

 

2.) Using a variable and checking if it is null.

Burak_Oezfalci_1-1604302257175.png

 

3.) Checking directly if the custom string field is empty

I Could not post more images, if you need them just tell me.

 

When I select a record, which has not been exported and therefore has no value for the field, the Flow crashes when it starts.

When I select a record, which has already been exported and therefore has a value for the field, the Flow runs successfully.

 

 

 

Hi @Burak_Oezfalci ,

 

When the flow runs upon selecting record what value does the field shows, if not you can click on download the output to see the value . Can you please share the output. Alternatively even if you are not able to view the field value then do Get Record action , select your entity and provide the entity id from previous (select record action) . This will help you troubleshoot what is happening . Also please check if the customization that you have made is published. 

 

Thanks

abm
Super User
Super User

Hi @Burak_Oezfalci 

 

Could you try to modify the below step where you mapping the variable to use expression trim() and length(). Change the condition to greater than zero.

 

trim(length('your variable'))

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@ManishJain 

It seems like I found a solution, it is not nice but it is working.

 

Sorry for the german labels.

I added a new step which gets the record from Common Data Service.

 

Burak_Oezfalci_0-1604324875294.png

Although my custom field was not shown under dynamic content after entering the empty function.

I edited the value manually into the function, and it works.

Burak_Oezfalci_1-1604324970449.png

 

Still a strange behaviour, don't know why the Flow acts like that.

 

Hi @Burak_Oezfalci ,

 

Now that your functionality works can you please try doing the same with select record variable and see if it is working. 

 

 

Thanks

@abmI tried your approach but the same error occurs.

In Dynamics 365 it shows me the following error.

Burak_Oezfalci_1-1604325524969.png

Which means refresh the page or try again later.
When i scroll down, at the end it says "Invalid type. Expected String but got Null.."

 

The data for the custom field looks like this, for accounts that have not been exported the custom field has the value 'null'.

Burak_Oezfalci_0-1604325427215.png

 

I do think that the flow crashes when it tries to set up the string variable, it has null and tries to add it to the string variable

@ManishJainI am not sure if I understood you correctly ? Could you please explain in detail, what you want me to do ?

 

The Flow currently looks like this.
I am using the Common Data Service Trigger, when a record is selected.

After that I am getting the record with the get record action.

Burak_Oezfalci_0-1604325792138.png

 

Hi @Burak_Oezfalci ,

 

From the select record action which you were doing previously do select the variable value and compare it with null , no trim or length functionality is required. Just ensure that you are typing null using expression and not direct input. 

 

Thanks

@ManishJain 

I hope I understand you correctly.

This is approach is also working, I use the ID from the Select/Get record action (Datensatz abrufen) and not from the trigger action.

Burak_Oezfalci_0-1604326463959.png

 

What I don't unterstand is why the following approach is not working:

I removed the additional getRecord Action, so that the billwerkId is based on trigger.

Burak_Oezfalci_0-1604326709941.png

 

Hi @Burak_Oezfalci ,

 

Can you please add compose action to see what value you are getting in that field from select record.

 

Thanks

You mean like that ?

Burak_Oezfalci_1-1604328896355.png

 

It results in the same error behaviour.

Unfortuanelty I can't look in the run, cause no run is shown.

This is the Info I get in Dynamics 365 when I try to start the flow.

 

Burak_Oezfalci_0-1604328824989.png

 

The two options you mentioned did not work either, i will go on with the approach which has been working where i added the additional getRecord Action.

 

Thanks for your help @ManishJain.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,225)