Skip to content

Extending Inaport – example of a custom function

April 9, 2013

Following our previous post on extending Inaport using custom functions, Justin Knieling of Grand Canyon University kindly shared an example of a custom function he has written. The function assigns new users a security role in Microsoft CRM 2011.

Here is Justin’s discussion of his requirements and implementation:

Rarely do I find something that Inaport cannot do. However, we were recently trying to automate our user creation process and ran into a bit of a snag. We wrote a query to fetch user information from our identity management database and were able to use this to create new users in Dynamics CRM 2011 with Inaport. However, we also wanted to assign these users a security role based on some information in their record. We found that Inaport was lacking a feature to do this.

The great thing is that a new feature was introduced in Inaport version 7.3 that allows users to create their own custom Inaport functions. This means that if you can write code in a .Net language to do what you are trying to accomplish, you can write an Inaport function that will do it right within an Inaport profile.

I immediately set about writing a function to assign a security role to a user. It was extremely easy to incorporate the code to associate the user with a role into an Inaport function. In no time, I had my first function written and ready to use. Once you compile your function into a dll, all you have to do is drop that dll into the Inaport install directory, restart Inaport, and your new function will appear right within the interface.

This allowed us to automate a process that was extremely manual prior to this ability and is now saving us hours of work every week. With new features constantly being added to Inaport, I’m not sure how often I will have to write my own functions, but I feel more secure in my choice of ETL software knowing I am able to do this.

For reference, here is the actual code used to implement the function:

public class AssignSecurityRoleToUser : IPFunctionBase
{

    public AssignSecurityRoleToUser()
    {
         Name = "AssignSecurityRoleToUser("; // name of the function. YES it does need the "(" at the end.
         FuncDescriptor = new IPFuncDescriptor(
             "Assign a security role to a user", // this is the function description
             "AssignSecurityRoleToUser(#field1, #field2, \"http://server/org\")", // this is the example
             new string[] { "Extensions" }, // this is the category the function will appear under
             new IPFuncParamDesc[] { // these are the parameter descriptions
                 new IPFuncParamDesc("UserId", "Id of the system user record", "String", true),
                 new IPFuncParamDesc("RoleId", "Id of the security role record", "String", true),
                 new IPFuncParamDesc("OrgURL", "URL of the org", "String", true)
            }
         );
     }

    public override object Evaluate(Stack stack)
    {
        int argCount = popInt(stack);
        if (argCount >= 3)
        {
            try
            {
               ClientCredentials clientCred = new ClientCredentials();
               clientCred.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; //credentials of logged in user
               String orgUrl = popStr(stack);
               Guid secRoleId = new Guid(popStr(stack));
               Guid userId = new Guid(popStr(stack));
               orgUrl = String.Format("{0}/XRMServices/2011/Organization.svc", orgUrl);

               OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(new Uri(orgUrl), null, clientCred, null);
               IOrganizationService orgService = (IOrganizationService)serviceProxy;

               AssociateRequest assignRoleRequest = new AssociateRequest();
               assignRoleRequest.RelatedEntities = new EntityReferenceCollection();
               assignRoleRequest.RelatedEntities.Add(new EntityReference("systemuser", userId));
               assignRoleRequest.Relationship = new Relationship("systemuserroles_association");
               assignRoleRequest.Target = new EntityReference("role", secRoleId);
               orgService.Execute(assignRoleRequest);
           }
           catch (Exception e)
           {
               throw e;
           }
           return 0;
       }
       else
       {
           return 1;
       }
     }
 } // end of Function

Extending Inaport – adding your own functions

April 1, 2013

Inaport 7.3 gives you the ability to extend the expression editor by adding your own functions. These functions become available at any point where you can write an expression in Inaport. Some ways this has been used:

  • call out to an external web service to get current pricing for commodity products being imported into CRM
  • implement specialized parsing of a sales order line
  • call out to external database to do conditional updates.

Implementing a new functions is straightforward. You create a DLL in any .NET compatible language, and drop it into the Inaport install directory. Inaport will find the DLL on start up and make the functions in it visible in the Expression Editor.

InaPlex can supply a Visual Studio project with a sample function already implemented, which you can use as a base. The rest of this post will walk through the sample project.

Quick Start

Download and install the demonstration project to use as reference.

  1. Create  Visual Studio project, and add a reference to IPExtensionManager.dll (found in the Inaport install directory)
  2. Create a new class for each function, extending IPFunctionBase. See sample project for setup.
  3. Create a single class extending IPExtensionBase. This class loads your functions into the Inaport environment.
  4. Save the project as a DLL in the Inaport directory. Name *must* start with “IPex”.
  5. Restart Inaport. Your functions should now be visible in the Inaport expression editor.

Read more…

Inaport 7.3 – Dramatically improving matching performance using local cache tables

December 2, 2012

With the rise of CRM systems such as Microsoft CRM 2011 which are accessed via web services, performance becomes more of an issue. Analysis of Inaport projects indicates that for a typical import into a web hosted CRM system, up to 99% of the time may be spent in the web service calls to the target CRM system.

An important objective, then, is to minimize the number of web services calls as far as possible. This post describes some techniques available in Inaport 7.3 that can dramatically reduce or eliminate the cost of  matching on the target system, by removing the need to make any web services calls.

While these techniques have the biggest impact with web services based systems, they can also be very useful for on premise based systems such as SalesLogix.

It is a long and moderately technical post. A subsequent post will provide some examples of using these caching techniques. If you have any questions, it is likely that other readers do as well – feel free to ask for clarification in the comments, or to contact InaPlex direct.

The basic technique is caching the primary key of the target records in the source database. This can be done by one of:

  1. updating the source record with the primary key of the matched record in the target;
  2. using a cross reference table, that stores the primary keys of the source and target records, along with match information;
  3. building a match table that stores the primary key of the target, along with required match information.

Each of these techniques is useful in different scenarios.

Read more…

Inaport 7.3 Released

September 28, 2012

InaPlex is pleased and proud to announce that version 7.3 has just been released to the web site for free download.

The product of thousands of development hours and working with InaPlex customers around the world, 7.3 continues the tradition of maintaining compatibility while enhancing and extending functionality.

Said Steven Neil of Grand Canyon University:

“We have been using Inaport extensively for a couple of years. The new release continues the process of enhancing and deepening functionality, while not loosing sight of usability and manageability that are Inaport trademarks.”

We will expand on the new functionality in a series of blog posts, but in brief:

  • Extend: execute external applications, write your own code
  • Enhance: new ways to integrate with your external systems during a job
  • Compatibility: Microsoft CRM 2011 including integrated with Office 365; SageCRM 7.1 on premise and on line; ACT 2012; SalesLogix 7.x
  • Attention to detail: hundreds of performance enhancements, bug fixes, and tweaks to the user interface

Download the latest build from our web site: http://www.inaplex.com.

 

Building GoldMine relationship trees with Inaport

March 2, 2012

Guest blogger Gail Darling of leading GoldMine partner infoSpectrum describes how she used Inaport to automatically build and update GoldMine relationship trees for a manufacturing customer. Relationship trees are very useful to provide navigation around complex account/contact structures, but they can be difficult to set up and maintain. Over to Gail…

InfoSpectrum’s client had a problem. It was using GoldMine to manage clients and the sales process, but was finding it difficult to view customers from an account perspective.

A leading manufacturer and supplier of antibodies, antigens and critical assay reagents, this client’s customer base includes many large organizations with contacts in different locations. Being able to view activities and relationships from a customer account perspective is imperative for winning and maintaining business. The solution lay with Inaport’s Relationship Builder.

Read more…

Microsoft CRM – Moving Views Between Development and Production With Inaport

February 5, 2012

At times in chez InaPlex, we are slightly dumbfounded by where our users take our product.

Guest blogger Justin Knieling of Grand Canyon University has been pushing the boundaries for a while, but now he has excelled himself. In this post, he describes using Inaport to move MSCRM views from one organization to another. Please note that in this particular scenario, he is using a SQL connection to the source CRM system, as he has it on premise. This might not work, or may need modification, if you are running hosted.

Over to Justin…

We often find ourselves needing to move system views from one Microsoft Dynamics CRM 2011 organization to another. A recent example of this was when we had a department who wanted to start using the case entity in CRM. They developed views to display their department’s cases along with some other views for activities related to the cases. Overall, I think there were about 15 views they created in our development environment.

Read more…

Lift & Shift … with added Brains

November 6, 2011

Guest blogger, David Stewart from Aurise Consulting Ltd (www.aurise.com), outlines an application of Inaport to import and de-duplicate data records. David is a software consultant, based in Edinburgh, who recently delivered a project for a public sector organisation. The project was to deliver a database, built on the Dynamics CRM platform, to store consumer information. Inaport was a key component of the application fabric and fulfilled the requirement to import many millions of source data records.

Over to David …

I was recently engaged by a public sector organisation to build a series of databases consisting of individuals from around the world who asked to receive tailored information. The driver for the project was the replacement of a third party supplier, and the decision was taken to rebuild the new database from scratch rather than purchasing the existing database. This decision initiated the requirement to import ten years of interaction history for each customer.

Read more…

Follow

Get every new post delivered to your Inbox.

Join 45 other followers