Technical Support Hours

M-F 8am to 8pm (EST)

Start a conversation

Purchase Order Generation


The Purchase Order Generation plugin automatically creates purchase orders on sales document line items that need purchasing. Vendors for purchase orders can either be specified by the user or be determined by the spcpGetVendorID.

The Purchase Order Generation plugin can also be set up to automatically email a vendor (automatic vendor emailing) as purchase orders are created.
Note: To use automatic emailing with Purchase Order Generation, first create a PO template for the body of the email. Refer to the Emailing and Email Templates documentation for information on email template creation.

Note: Refer to SalesPad’s Configuring SalesPad for Purchasing  document to set up purchasing before setting up automatic PO generation.

User Fields

Note: The first user field used here is the same user field used for Auto Item Conversion. If Auto Item Conversion has already been set up according to the instructions, you should not set up an additional user field.

  1. Create the user field shown below in the User Field Editor that will be used as the Sales Line Vendor Smart Field. In the example, this field is called xVendor. For more information on setting up user fields, refer to SalesPad’s User Defined Fields document.
  2. Paste the following script into the Quick Report field:
    <report ReturnColumn='Vendor'>
    <query addWhere="false"> select Vendor='', Vendor_Name='' union
    select Vendor = Vendor_ID , Vendor_Name from spvVendor order by vendor

    Anoter valid Quick Report if you only want to buy from vendors you have previously bought from.
    <report ReturnColumn='Vendor'>
    <query addWhere="false">
    select Vendor='', Item_Number='', Vendor_Item_Num='', Last_Receipt_Cost =''
    select Vendor = ISNULL(ivm.VENDORID, ''), Item_Number = ISNULL(ivm.ITEMNMBR,''), Vendor_Item_Num = ISNULL(ivm.VNDITNUM, ''), Last_Receipt_Cost = ISNULL(CAST(ivm.LRCPTCST AS VARCHAR(50)), '')
    from IV00103 as ivm (nolock)
    WHERE ivm.ITEMNMBR = /*Item_Number*/
    OR ivm. VNDITNUM = /*Item_Number*/
  3. For automatic vendor emailing, create the user field shown below, xEmailOnly
  4. If using version 4.1 or later, and you want to determine cost with a user defined field instead of based on the standard options under the PO Cost Selection setting (Current, Standard, Last Vendor Invoice Cost, or Manual), create a user defined field that will store this information (example: xCost). The name of this field will be added in Settings.
    Note: You need to make sure to pick the appropriate data type and field length for the information that will be stored in the user field.
  5. Click Save and then Update Database
  6. Close the User Field Editor, which will log you out of SalesPad
  7. Log back in

Follow the steps below in Settings.

  1. Filter to “Sales Line Vendor”
  2. Next to Sales Line Vendor Smart Field, specify the name of your user defined field
  3. Filter to “purchasing”
  4. If the PO Cost Selection User field was created (User Fields section step 4), next to PO Cost Selection, select PO_Cost_Selection_User_Field
  5. Next to PO Cost Selection User Field, enter the name of the user field created in User Fields section step 4 (ex: xCost)
  6. In versions 4.1 and later, you can set the sales person ID as the Buyer ID. To do so, filter to “use sales person” and set Use Sales Person ID as Buyer ID to True.
    Note: The Sales Person must also be set up as a Buyer in Dynamics GP
Security Editor

Follow the steps below in the Security Editor

  1. On the Security column, filter to and check the box for Purchase Order Generation
  2. Filter to Sales Document Entry
  3. Under the Scripts, select Pre Save Script
  4. Click the ellipses in the adjacent field

Once the window has opened, click here to download a plain text version of the pre save script. Paste the script into the window (or create your own script).

  1. For automatic vendor emailing, fill out the following sub-settings as in the screenshot below:

    Note: If the Email From field is left blank, it will use the User Email field in the user properties on the Security Editor. One of these fields must be populated in order to send an email.
  2. Save, log out, and log back in
Custom spcpGetVendorID (optional)

To use the spcpGetVendorID stored procedure to determine a vendor, run the following script inside your GP database with your vendor determining logic:

CREATE procedure [dbo].[spcpGetPOVendorID]
@SalesDocNum varchar(65)
,@SalesDocType varchar(15)
,@Line_Num varchar(65)
,@ComponentSeqNum varchar(15)
,@VendorID varchar(65) output
set nocount on
select @VendorID = 'JENSENSY0001' GO

Manual Vendor Selection
  1. In a sales order, add the user defined field onto the sales line items by right-clicking on the column header of the sales line items and selecting Column Chooser
  2. The Customization window appears. Select the field you wish to add to the grid (Vendor, in this case) and drag it onto the column header:
  3. To specify a vendor for each line item, double-click a vendor from the vendor dropdown
Triggering Purchase Order Generation

In the sales document header, select Purchase Order Generation from the Actions dropdown

Purchase Orders will be generated for line items that need purchasing (indicated by red text or a small orange triangle on the sales line), based on the vendor information provided.


You can also trigger Purchase Order Generation to occur at a certain workflow point. Set up the desired workflow in Workflow Setup to include the Purchase Order Generation plugin (refer to the SalesPad Workflow document if needed):

Automatic Vendor Emailing

For automatic vendor emailing, set up the vendor for Purchase Order email in Vendor Search:

  1. Find the vendor you wish to set up
  2. Click on the User Fields tab
  3. Check the Email Only box on the vendor’s User Fields tab
  4. Under the Contact Address for the vendor you are modifying, specify an email on the Primary Address line

    Repeat these steps for each vendor to receive automatic emails. Automatic emails will be sent to each vendor set up for automatic emailing when the Purchase Order Generation plugin is triggered.
Choose files or drag and drop files
Was this article helpful?
  1. SalesPad Support

  2. Posted
  3. Updated