SQL Script to Set EFT Output Locations When Copying Live To Test

Microsoft Dynamics GPAs mentioned in the last post I’ve had a couple of scripts recently which I needed to create in order to facilitate clients easily making live to test copies without issues arising.

The script, below, can be used to set the EFT file locations in Checkbook Master. For the client I was working with, we only needed to set the file location of the Domestic Payments File Location field, but I am including all of the file location fields in the script.

Simply change the highlighted path locations to the required paths and set the Checkbook ID at the bottom:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
UPDATE
	CM00101
SET
	DomPmtsFile = '{path}'
	,ForeignPmtsFile = '{path}'
	,DomDirDbtCollectFile = '{path}'
	,DomDirDbtRefundFile = '{path}'
	,EFTPMPrenoteFile = '{path}'
	,EFTRMPrenoteFile = '{path}'
	,EFTCommunicationFile = '{path}'
WHERE
	CHEKBKID = '{chequebook id}'

As always with scripts, please make sure you have a good backup before using the script.

SQL Script to Update Web Services Server in Workflow Setup When Copying Live To Test

Microsoft Dynamics GPAll clients will at some point copy their live company into a test one, whether or not the test system is on the same server or a different one. If on the same machine, they will usually use an automated process to perform the backup and restore.

There is usually other tasks which will need to be undertaken such as changing the output location of the EFT Payment Register Report or prefixing email message subjects with “TEST” or setting all email addresses to internal ones.

I’ve recently encountered a couple more fields which need to be reset to avoid problems when copying live to test. The one prompting this script, was when the live company was copied to the standalone test system, the Web Services server needed to be changed to a different value:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
UPDATE WF00100
	SET
		Web_Service_Server = '{servername}'
WHERE
	SETUPKEY = 0
GO

The highlighted section, above, needs to be changed to your Web Services server.

In addition, a repair needed to be run using the Web Services Configuration Wizard, but at least the script removes one manual step.

As always with scripts, please make sure you have a good backup before using the script.

SQL Script to Prefix Email Message Subjects with Test

Microsoft Dynamics GPI had an issue reported with purchase requisitions the other day. I logged on and did a little testing and then, a short wile later, got an email from the client asking about some workflow approval emails some managers had received.

The email to the approvers did not contain the word “test” anywhere in either the subject or body. This lead to me having a horrible moment when I thought I might have done my testing on live; I was able to confirm quickly that I had not.

After this I decided I had better knock a quick script together which the client could incorporate into their live to test copy.

The script is more engineered than it might otherwise need to be as I have included code to only do the update when it is running against a test company (flagged with <TEST> at the end of the Company Name) and where the email subject isn’t already prefixed with the word TEST:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
UPDATE
	['Email Messages']
SET
	EmailMessageSubject = LEFT('TEST: ' + CAST(['Email Messages'].EmailMessageSubject AS CHAR(150)), 150)
FROM
	SY04901 AS ['Email Messages']
INNER JOIN
	DYNAMICS..SY01500 AS ['Company Master']
		ON
			['Company Master'].INTERID = DB_NAME()
WHERE
	['Company Master'].CMPNYNAM LIKE '%<TEST>'
AND
	LEFT(['Email Messages'].EmailMessageSubject, 4) <> 'TEST'
GO

As always, before running a script against a database, make sure you understand the scirpt and have a good backup of the database.

Problem Posting General Ledger Batches In Test Company

Microsoft Dynamics GPI recently fielded a call from a client who had copied their live database across to test so they could do a reconciliation of Purchase Order Processing accruals to the General Ledger accrual account without having to chase a moving target as new transactions were processed. Continue reading “Problem Posting General Ledger Batches In Test Company”