Skip to content
+1-888-319-3663

HELP ARTICLE

How to update GL posting date on a receivables transaction


There is nowhere to map a GL posting date when creating a receivables transaction. How can I set the posting date to the current date?


If your posting setup is set so that the posting date is coming from the batch date, you can use the following script to update the GL posting date on the batch. In your “Create Transaction” mapping, hit the Restrictions button to place a script there. Your script should read as follows: 


‘Beginning of script
GlobalMessage=_BATCHNAME
return true
‘end of script

Replace _BATCHNAME with the name of the column in our source file that contains the batch name. So for example, if the column is named BATCHNUM, then your script should say “GlobalMessage=_BATCHNUM”

You need to create an after map success script to update the batch after the map succeeds. Hit the GoTo button in the main mapping window and select Tasks – Map – After – Success. Add a new task of the “Script” type In the script, place the following text

‘Beginning of script
‘—————————————————————————————
‘Script Name: UpdatePostingDate
‘ Created On: 01/18/2009
‘ Author: Chris Hanson
‘ Purpose: This script updates the batch posting date in SQL Server.
‘ History:
‘—————————————————————————————
‘—————————————————————————————
‘ Requirements: This script should be located in the Tasks -> Map -> After -> Success
‘ section of the SmartConnect map setup. In the case of this template,
‘ the GlobalMessage global variable is being set to the batch number
‘ in the restriction when the map runs, then this script uses it to
‘ update the posting date in the SY00500.
‘—————————————————————————————
‘—————————————————————————————
‘ Setup: There are five variables to assign in the configuration section. The
‘ first four determine which values are used in the connection string.
‘ Those four variables – the server (data source), database (initial
‘ catalog), user, and password should be changed to the needed values.
‘ The last variable, sqlQuery, contains the query message that is going
‘ to be executed. This needs to be changed to reference an actual table
‘ and its corresponding columns before the script will run.
‘—————————————————————————————
‘———————————– CONFIGURATION ————————————-
Dim server As String = “DS-SRV-01”
Dim database As String = “TWO”
Dim user As String = “sa”
Dim password As String = “pass@word1”
Dim sqlQuery As String = “UPDATE SY00500 SET GLPOSTDT = ‘” & DateTime.Now.ToString(“yyyy-MM-dd 00:00:00.000”) & “‘ where BCHSOURC = ‘RM_Sales’ and BACHNUMB = ‘” & GlobalMessage & “‘”
‘—————————————————————————————
Try ‘Declare the connection string based on the configuration variables
Dim conString As String = “Data Source=” & server & “;Initial Catalog=” & database & “;User=” & user & “;Password=” & password & “;”
‘Define the SQL connection and open it
Dim myConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(conString) myConn.Open()
‘Declare the SQL command as the query string and execute it
Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(sqlQuery, myConn) command.ExecuteNonQuery()
‘Close the connection
myConn.Close() Catch ex As Exception Messagebox.Show(ex.Message, “UpdatePostingDate Script Error”)
Return False
End Try
Return True
‘End of script

RECENT POSTS


Use the REST Connector to parse nested Value Arrays
SmartConnect email task fails with error: An invalid character was found in the email header
Does SmartConnect import into Avalara Avatax software
Could not initialize a collection when launching SmartConnect
ERROR [HY000] [Microsoft][ODBC Excel Driver]General error Unable to open registry key when you open a SmartConnect map.

POPULAR POSTS


SSL Security error using OLEDB Connection
This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms
Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))
The server process could not be started because the configured identity is incorrect.
Using WINSCP and a task to upload or download files from an SFTP site

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships partners Popdock release Reporting SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.