Exporting dates as local time in the SalesLogix Web client when exporting groups to a file.

When exporting groups in the SalesLogix web client to a file (csv or tab) using the “Common Tasks” Export to File option the dates are exported using the entity model again.  As I mentioned in this post, dates retrieved through the entity model are not converted from the UTC format the database stores to local date time. 

This can be modified by editing the  Common Tasks Tasklet.  This is a custom smartpart that is what the “Common Tasks” area of the web client uses.  Since it is custom it can be found in the Application Architect’s Project Explorer, under the Portal Manager…Sage SalesLogix…Support Files…SmartParts…TaskPane…CommonTasks.  In this folder you will see the User Control CommonTasksTaskLet.ascx and the corresponding code file CommonTasksTasklet.ascx.cs.  The cs file is the one we will need to modify for this.

If you open the cs file you need to find the routine “ExportToFile”.  About 8 liones from the top you should see a line like:

DataTable GroupTableAll = gInfo.GetGroupDataTable();

This line is populating a DataTable called GroupTableAll with the current group’s data using the GetGroupDataTable method of the  Sage.SalesLogixClient.GroupBuilder.GroupInfo.GroupInformation class found in the Sage.SalesLogixClient.GroupBuilder.dll assembly.

Further down in the routine you should see some code with a comment about removing hidden columns like this:

//remove hidden columns
SetLayout(GroupTableSelections, layout);

Immediatly after these two lines of code we can add some code that manipulates the DataTable object referenced as GroupTableAll.  We are adding it here because immeadiatly above the “remove hidden columns” code there is code to remove unwanted rows from the DataTabl, so we add our code after that so we are not doing stuff to rows that are going to be removed anyways.


What we do next is to loop through our DataTable and look at each column.  When the column is a DateTime column we then modify each row in the DataTable so that these DateTime values are converted into local times.  Here is the complete code:

//Do Date UTC to local Stuff                    
IContextService context = ApplicationContext.Current.Services.Get<IContextService>(true);
Sage.Platform.TimeZone timeZone = (Sage.Platform.TimeZone) context.GetContext(“TimeZone”);
foreach (DataColumn c in GroupTableSelections.Columns)
     if (c.DataType.ToString() == “System.DateTime”) //Need to adjust values for all values in this column
     foreach (DataRow r in GroupTableSelections.Rows)
         r =  timeZone.UTCDateTimeToLocalTime((DateTime)r);
//End Date to local stuff

 There you have it!



Kris Halsrud

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


  1. Kris I have problem with this code cant convert datarow to datetime. That apply to the new version?


    • This post is fairly old and things may have changed. You could maybe try something like this:

    • I Get the same error Cannot convert type ‘System.Data.DataRow’ to ‘System.DateTime’.
      I’m trying different format but the problem is the cast to datetime. Regards,

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!