Technical Support Hours

M-F 8am to 8pm (EST)

Start a conversation



Scripting gives users the ability to add customized behavior at certain times during data processing, allowing great flexibility in implementing rules and actions custom tailored for a specific business. The scripts are written in the C# programming language and allow a great deal of added functionality. For example a script can be written so that each time a document is about to be saved, the script will examine the line items on the document and cancel the save if any of the line items have been discontinued and preventing the selling of items that are no longer available.


Scripts are implemented through settings.

Sales Document Post Forward Script – Script that is run after forwarding a Sales Document.

Sales Document Pre Forward Script – Script that is run before forwarding a Sales Document.

Sales Document Pre Save Script – Script that is run before saving a Sales Document.


To create or edit scripts, click the ellipsis (...) on the right side of the input field on the desired setting to open the script editor.

The script editor has three main sections:

  1. Above the text edit area are listed the parameters available for the script. The parameters may include a CancelEventArgs, labeled as e, which by setting to true can be used to tell the process the script is running with to stop. Parameters may also include business objects related to the ongoing process.
  2. In the middle is the text edit area, this is where the actual script will be written using C#.
  3. Along the bottom are several buttons:
    • Compile – When the script is complete, this can be used to test that the script can compile. Any compilation errors found, such as errors with language semantics or missing parentheses, will be displayed. If no errors are found, a message will appear above the button stating that the script was compiled successfully.
    • Disable Script – If you do not want to delete the script, you can keep it but turn it off so that it is no longer used.
    • Enable Script – Turn a disabled script back on

Once a script is finished and can successfully compile, click OK and the script will be saved to the setting. Next time the operation is run the script will be loaded and run as part of the operation.

Important Reminders
  • Please install this on a test machine and run it against a test database before using it on your live system.
  • You should always make sure you have a database backup prior to installing new scripts.
  • C# scripts, unless written by SalesPad, are the responsibility of the dealer/customer.
  • Anytime a change to a script is made, the Mobile Server needs to be restarted for the changes to take effect.
Pre Save Script Example

Script runs before saving a document that will cancel the save if any of the line items on the document are being sold too high or too low of the items cost.

Choose files or drag and drop files
Was this article helpful?
  1. SalesPad Support

  2. Posted
  3. Updated