The SalesLogix entity model offers the ability to create a custom property underneath an entity. This can be useful for automatically rolling up things like the Opportunity Sales Potential or calculating fields such as the Opportunity Weighted Average. To add an custom entity property, expand out the VFS…Entity Model…Packages…SalesLogix Application Entities. Right click on properties and choose New Code Snippet Property.
The new custom property dialog will open. First, you need to name your custom property. For my example we will use something nondescript, "LookupValidation". You should choose a better name in a real world situation.
The next step is to determine the data type our code system will return. The default is a String but you can choose from others if appropriate. Some data types are not listed. If they are not you can simply just type it in . Make sure you use the fully qualified name "System.".
Now that those have been established you can click the Add Hyperlink next to the Steps label. I am going to add a new C# snippet and select that choice.
Once I click OK I can now see my step in the step dialog. Now I will click the Edit Code Snippet hyperlink to actually modify the code and build my custom entity.
The code editor opens with the skeleton of my custom property already built based upon the parameters I used to set up my property:
We replace the commented out line shown above with our code. In my case I want to check to see if the Account is a Customer or Prospect. To do that I can add the following code:
if (account.Type.ToLower() + "" == "customer" | account.Type.ToLower() == "prospect")
result = "Passes";
result = "Fails";
So there you have it a complete custom entity property. Obviously this is a very simple example but this can be a vary powerful feature.
Now be aware that custom entity properties are currently only useable within the web interface. They are also not available for use in merge documents or groups.