back to top

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)
     {        
         try
         {
         r[c.ColumnName] =  timeZone.UTCDateTimeToLocalTime((DateTime)r[c.ColumnName]);
         }
         catch{}
     }
}
//End Date to local stuff

 There you have it!

 

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Kris Halsrud
Kris Halsrud
Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

3 COMMENTS

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

    • 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,

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos