I recently had a request to customize the Lookup dialog in Infor CRM (Saleslogix) to add a hyperlink column that would launch a dialog to show related data to the row in the lookup search results. For this particular request, the customer wanted to add this custom column to any product lookup that would show multiple related ERP records that would assist the user in determining if it was the correct product to select.
Initially, I wasn’t sure it was going to be doable, or at least not easy. It turns out it was actually a fairly straight forward task. This really came down to three different tasks that the code needed to accomplish:
- The custom column that we’d add to the Lookup dialog
- The code that would execute when the custom column was clicked. In this case we’ll be opening a dialog and use SData to retrieve the related records for the selected row in the lookup results
- Finally, automatically append this new column to the Lookup dialog grid whenever the lookup is for products
For the sample code for this article, I will make this all more generic. Instead of looking up related ERP data for a product, we’ll do the same but for accounts. For any lookup that is for accounts, we’ll append our custom column that will display all related contacts for this account (and we’ll include a hyperlink to navigate to the contact, if the user desires)
I’ve also combined all three objectives above into a single code file. This code file can easily be loaded using our Custom Loader Module. With the Custom Loader Module, all you’ll need to do is create a folder under SupportFiles\Custom\Modules named “AccountLookup” and place the code below in a file named “main.js” in that folder.
Let’s take a look at the complete code:
If you pay attention to the comments in the code, you’ll see each of the three objectives defined. The custom column type is defined, the code that the custom column executes is created, and the new custom column is automatically appended to any lookup that is for accounts. The end result looks like this:
and when the custom column is clicked, the following occurs:
I think the result turned out quite nice and wasn’t too bad to pull off. This could also be done using the Dijit TooltipDialog as well to show this on hover, however, that was a little more messy and the way the custom column was implemented made it difficult to ensure the tooltip would fade out when expected and not get in the way, so the dialog made sure the info was there when the user needed it, and wouldn’t get in the way when they didn’t need it.