Creating Custom Deployment Actions for Portals in Application Architect for Infor CRM

Something that is nice about the Application Architect is that it is customizable in a similar way to how you customize the Infor CRM web client itself. An example of this is in my Git Extensions for Application Architect project. One useful place that you can extend with your own code is the deployment process. You can create your own deployment action provider to add files to the deployment files for a portal, or execute code before or after the deployment process. There’s a lot of useful possibilities with extending the deployment process. This article will outline the complete steps to create a custom deployment action provider and wire it up to the deployment process in Application Architect.

In a nutshell, a custom deployment action provider is a DLL that implements the IDeploymentActionProvider interface found in the Sage.Platform.WebPortal.Design.dll. You then add this DLL to a portal (or multiple portals) and when the portal is deployed it will run the code in the custom action provider DLL.

The complete steps are as follows:

  1. Create a new Class Library project in Visual Studio. Set the .NET framework version to .NET 4.5.2.
  2. Add a reference to Sage.Platform.WebPortal.Design.dll in C:\Program Files (x86)\Saleslogix\Platform
  3. Add a reference to Sage.Platform.Deployment.dll in C:\Program Files (x86)\Saleslogix\Platform
  4. Add a reference to Sage.Platform.Projects.dll in C:\Program Files (x86)\Saleslogix\Platform
  5. Add a reference to Sage.Platform.Application.dll in C:\Program Files (x86)\Saleslogix\Platform
  6. Add a new class to your project that implements the interface Sage.Platform.WebPortal.Design.IDeploymentActionProvider
  7. For the GetDeployableItems method, you can just add return new IShadowCopyItem[0]; if you don’t want to deploy any new files – See complete code below in this article.
  8. Copy the assembly to C:\Program Files (x86)\Saleslogix\Platform
  9. Restart Application Architect
  10. In Application Architect, expand the Portal Manager and the select the portal you want to add this to, such as the SlxClient portal
  11. In the Properties grid with the SlxClient portal selected, you’ll see a property for DeploymentActionTypes. Click that to bring up the editor

    (click the image for a larger view)
  12. Add your new assebmbly to the list

    (click the image for a larger view)
  13. Deploy and your code will execute

Inside the custom deployment action provider DLL you can get a reference to the deployment directory path, or a connection string to the current Saleslogix database.

To get a connection to the current Saleslogix database, you will get a reference to the DataService, just like you would in the Infor CRM web client:

var dataService = ApplicationContext.Current.Services.Get<IDataService>();
var connectionString = dataService.GetConnectionString();

To get a reference to the deployment directory, you will need to get a reference to the deployment targets for the deployment and then find the target that includes the portal your custom action has been added to, like this:

// "deployment" is provided to you as an argument as object
// "application" is provided to you as an argument as Sage.Platform.WebPortal.Design.PortalBase

foreach (var target in (deployment as Sage.Platform.Deployment.Deployment).Targets.Where(x => x.IsActive))
{
	// locate the matching portal for this target 
	var targetPortal = target.Portals.FirstOrDefault(x => x.PortalApp.PortalAlias == application.PortalAlias);
	if (targetPortal == null) continue;

	// Get the deployment directory 
	var deployFolder = target.GetFolderName(targetPortal);
}

I have created a complete working sample on Github. This sample project contains a complete implementation of a custom deployment action provider. It creates a file stream which is deployed with the portal files and also implements the After Deployment step to retrieve the deployment path and connection string (and also writes to the output window). Feel free to take a look.

SampleDeploymentAction from Customer FX
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. 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) news and product updates!

You have Successfully Subscribed!