Adding a Email link to a datagrid in Infor CRM SLX for Windows

Adding an email link to a datagrid in Infor CRM SLX for Windows can be a useful feature to allow users to quickly send emails to a specific recipient without having to manually enter the email address. In this article, I will outline how to create an email link in a datagrid using VBScript in Infor CRM SLX for Windows.

First, you need to add the Email column to the datagrid.  From the SQL property of the datagrid, open the query builder and add Email to the items in the Layout tab.

Close the query builder, and go to the datagrid columns collection property.  On the Properties view, right click the Email column and select “Change Column Type…”.  From the Available options, select “Hyperlink”.

Once the column type is set, right click the Email column again and view the properties.  On the HyperlinkProperties view, check the “Single link to Launch” option and close the properties view.

Finally, the “Row Select” property for the grid must be unchecked.  When the grid is set to RowSelect, it doesn’t utilize click events for each column, making it impossible to run any code when the link is selected.

 

That’s all we need to do to add the column to the datagrid.  The only thing left to do is write the code to be launched when the new column is clicked.

The datagrid should have an OnHyperlinkStart event.  Double-click the empty event to add a new method for that event.

     Sub grdContactsHyperlinkStart(Sender, PrimaryKeyValue, FieldName, Value, ByRef LaunchBrowser)
          If (Not (Value = "")) Then
               Dim objShell

               Set objShell = CreateObject("Shell.Application")
               objShell.Open "mailto:" & Value

               Set objShell = Nothing

          End If
     End Sub

That should be all that needs to be done.  This is a pretty simple implementation, but you may have other considerations.  This assumes there is only one Hyperlink in the datagrid, since the event where we added our code runs for any hyperlink column.  If that were the case, the Field Name is part of the event parameters, so conditional statements could be included to handle different columns.  This is a simple mailto link that is being passed to the Shell, which can easily be expanded to add default information to the new email.

 

Want content like this delivered to your inbox? Sign up for our newsletter!
ABOUT THE AUTHOR

Jason Buss

Jason is a senior application developer with Customer FX.

Submit a Comment

Your email address will not be published. Required fields are marked *