Adding an assembly reference to code files in the SalesLogix Application Architect

Often when adding custom code to SalesLogix you need to reference Assemblies that are not included by default in Code Snippets or action items.  This problem will often manifest itself with an error when building like “The type or namespace name ‘Data’ does not exist in the namespace ‘System’ (are you missing an assembly reference)”

 This article will show you how to add an assembly reference to your code.  If you look at either a Business Rule/Event or a Code Snippet Action item, both have a Reference Assemblies property.  In the code editor within Application Architect you will see comments at the top of the code that show the included referenced assemblies like so:

 

Reference Assemblies

 

So how does one add a referenced assembly?  Well it is fairly easy, though do to a glitch in the interface the actual process is kind of hidden. With the code page visible, open the properties window.  In the drop down at the top of the property window you should see Sage.Platform.Entities.Orm.Entities.CodeSnippetHeader.  If you choose this then you should see an AssembliesReference collection.  This is the avenue for adding assembly references.

 On some version of the Application Architect, the Sage.Platform.Entities.Orm.Entities.CodeSnippetHeader is not visible to be selected in the drop down.  To get it to appear, you need to do the following:

  1.  Click the CodeSnippet property in the properties window (should be the first one)
  2.  Click into the Code itself.
  3.  Click on the drop down in the properties window.  You should now see the choice Sage.Platform.Entities.Orm.Entities.CodeSnippetHeader.

 

Once you can correctly see the property window, click the Assembly References Collection property. (There should be an ellipse to choose.)

Reference Assemblies Property

 

This will open up the Assembly Reference dialog.  It should show you what the default assemblies that are included in every event/snippet are.

 

Reference Assemblies Dialog

If you click Add, you can add a new reference.  You will need to enter the AssemblyName at a minimum.  This should be the full file name of the assembly (i.e. System.Data.dll).  If the assembly is part of the .Net global assembly cache you should not need to enter a hint path.  If the assembly is not in the GAC, you will need to add the hint path which is the location the assembly is physically located so it can be accessed to validate during the build.  I would recommend using the base build path’s assemblies sub folder.  This requires copying your assembly into that location so it is available.  See this post for some more info on where assemblies need to be to build successfully. The HintPath should be the full path, plus the full file name. 

While you are defining your assembly reference you may receive errors.  Just click OK.  They are basically just a warning that the assmbly reference isn’t fully defined (which it won’t be until you are done defining).  As long as you can build successfully after you add your reference you should be fine.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

1 Comment

  1. Great post Kris and a much needed topic. One other thing worth noting is that you can also add system level references, that is, references automatically added to every code snippet or business rule, by modifying the “codesnippets.xml” file. On a Win7/Vista machine you can find this at:

    C:ProgramDataSagePlatformConfigurationGlobalcodesnippets.xml

    (on WinXP or 2003 you’ll find this in the AddUsers profile).

    Adding an assembly to the defaultReferences section will cause the reference to be used for all code snippets and business rules. This is a nice way to automatically wire up your own utility libraries to use everywhere without needing to wire it up to each one individually.

    -Ryan

    Reply

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!