Back

Sample Scripts

Published: Apr 20, 2018Reviewed on: Sep 27, 2024
Post Author Written by David Youngquist

Sample scripts for performing various data manipulations inside of SmartConnect.

NOTE: Scripts are provided as is. Assistance with installation or modification of the scripts is available as a billable service from our professional services team.

Following is a listing of what each script does:

AccountSegments.txt – This scripts takes an unformatted account number and breaks it into segments using the specified account segment separator. (Ex. 000110000 – 000-1100-00).

AddPhoneFormatting.txt – This script adds general phone number formatting to a phone number that consists of just digits. (Ex. 21822231140015 – (218) 222-3114 Ext. 0015) This is useful when bring phone numbers from Great Plains into CRM

BatchIDInputTemplate.txt – This script is a template that shows how to use an input box to gather a batch id from the user when the map is run.

CheckAccountNumbers_and_DisplayAccounts.txt – This script will check account numbers as a map is run into Great Plains and will return an error message afterwards telling you which specific account numbers did not exist.

CheckSQLTable.txt – This script is a template that shows how to use a SQL query to check a table for data in a SQL Server database.

CreateFile.txt – This script creates a new tab or comma delimited file in a specified location that is populated using an SQL query. The file can then be used as a data source.

CreditCalcTemplate.txt – This script will determine if the value is a credit by using a distribution type. This example is for Payables transactions and is using 2 as the distribution type, which is an Accounts Payable account.

CRMDateToGPDate.txt – This script returns the date portion of the date time that is used in CRM in a useable format for GP.

DateInputTemplate.txt – This script is a template that shows how to use input boxes to gather a date range from the user. These can now be returned, stored in global variables, or used in a SQL query/stored procedure to restrict a data source.

DebitCalcTemplate.txt – This script will determine if the value is a debit by using a distribution type. This example is for Payables transactions and is using 6 as the distribution type, which is an Purchasing account.

GetPONumber.txt – This script determines the PO Number based on the results of a SQL query on the source SOP Number and SOP Type.

MoveFile.txt – This script moves an existing file from one location to another.

MoveFileAddDate.txt – This script moves an existing text or csv file from one location to another and adds a date stamp to the file name.

ParseString.txt – This script can strip a string down to only numeric characters, alpha characters, or alpha characters with white spaces.

ReformatDate.txt – This script creates a formatted date based on the set date in the source field.

RemovePhoneFormatting.txt – This script removes any formatting that a phone number has, leaving only the digits.

SelectDestCompanyTemplate.txt – This script determines which company the map will run into based on user specified conditions.

SendEmailAttachment.txt – This script sends an e-mail with a specified attachment.

SplitFullNameTemplate.txt – This script splits a full name into a first and last name and places them into a string array.

SQLQuerySelectTemplate.txt – This script is a template that shows how to use a sql query to return a value from a table in a SQL Server database

SQLQueryUpdateTemplate.txt – This script is a template that shows how to use a SQL query to update a table in a SQL Server database.

StoredProcInputParamTemplate.txt – This script is a template that shows how to call a stored procedure and add parameters to it.

StoredProcOutputParams.txt – This script is a template that shows how to call a stored procedure that has output parameters along with the input parameters

Event Log Scripts Subfolder:

EventReader.txt – This script reads all entries from the specified event logs that were generated during the time that the associated map was executing.

EventWriter.txt – This script writes an entry to the specified event log for each document that errors during a map’s execution.

You can download a zip file with all the sample scripts here. SmartConnect Sample Scripts

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.