Skip to content
+1-888-319-3663

COMMUNITY FORUM

Conditionally Empty Entity Reference

Paul asked 4 years ago
Is it possible to handle a lookup (entity reference) when importing to CRM where the source column and, hence, the result, *might* be empty? I can’t manually build the entity reference in a calculation because the CRM SDK assemblies aren’t referenced and trying to build an Entity Reference field type fails with, “Failed to set column xxx to an entity reference column : Unrecognized Guid format,” when the value should actually be null.
Answers
Ethan Sorenson Staff answered 4 years ago
Paul,
Lookup fields cannot be blank. If they are blank, then the lookup will fail and give you an error. A work around would be to have a holding value rather than leaving it blank.
For example, if you are updating a Contact with the Account, but some contacts don’t have an Account for you to associate them with, you will want to create a dummy account that you will map as your value if the source does not contain an account. 
In your mapping you will create a Calculated Column that will check if the source contains a value for account. If it doesn’t, return your dummy account, else return the value in the source. Then map this calculated column to your entity reference.
Nannette replied 3 years ago

How would I handle this if I have to have the value in the source do a lookup for the GUID? The field is either blank or populated with data that I have to perform a lookup on. I am not sure how to get an if/else statement in there.


If you would like to submit an answer or comment, please sign in to the eOne portal.