Column Names to Avoid and Build Errors for Object Entities in Creatio

When adding columns to an entity/object in Creatio, there are a few column names you need to avoid. The object editor won’t stop you from using these column names, but you’ll see a build error when publishing the object if you don’t avoid these.

Scenario

You’re adding columns to an object, which can be a new object or an existing one. Let’s say you’ve added a Product lookup to a Contact named UsrProduct. Later, you add a text column named UsrProductName. When you publish the changes, you get the following error:

CS0102: The type ‘Contact’ already contains a definition for ‘UsrProductName’

You check and only see the one column named UsrProductName in the object, but still the error persists and you’re unable to publish the changes.

Explanation

What is happening here is the following. When you add a lookup column, the C# code that makes up the object itself really adds two properties behind the scenes, that exist only in the generated C# for the object. If we added a lookup named “TheLookup” these are:

  • TheLookupName
  • TheLookupId

So, in the scenario above, when we added our lookup named UsrProduct, the generated C# for the object contained two properties, one named UsrProductName and UsrProductId. It does this because when it loads the data for this object, it retrieves the selected lookup value’s Id, to store in the Id property, and the lookup value’s display value, to store in the Name property.

What causes the error is that the object editor allowed you to also add a text property named UsrProductName, so now the generated C# code contained two properties with the same name – which is what caused the error.

Solution

Obviously, to avoid the error, never add a column that is the same name as a lookup that ends in “Id” or “Name”. If you’ve already added this, and experiencing the error I mentioned above, you can fix this by simply removing the property you added ending in Name, and readd it with some other name.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!