How to Add New Condition to Sales Pad Work Flow.

How to Add New Condition to Sales Pad Work Flow.

Conditions are used in Sales pad work flow.  By default sales pad provide various conditions.  However there is always scope to add new conditions to meet workflow requirement.  The procedure is as follows:

1) Make a entry at the spWorkflowCondition table.  In this table the condition ID, description, parameter types and sample parameters are recorded.

2) update  [dbo].[spcpEvalWfRuleCondition] store procedure.  At this store procedure check for the condition ID as created in 1 above, and update the @conditionWasMatched variable to 1 if condition is matched or 0 if the condition fails.

Cheers!
Sanjay

 

New Customer – Pre Save Example

New Customer – Pre Save Example

This Pre-Save will not allow a new customer to be created without the Address Code

string message = "";	
if(SalesPad.Bus.CustomerAddr._Address_Code == "BILL")	
{	
	e.Cancel = true;
	message += "Enter a Customer Name\n";
}	
return message;

Cheers!
Sanjay

 

Customer Address Card Pre Save Script

Customer Address Card Pre Save Script

This Pre-Save will not allow not allow a   customer address to be saved unless a Zip Code is entered.
string message = "";
if (addr.val_Zip == "")
{
e.Cancel = true;
message += "Enter a Zipcode\n";
}
return message;

Source : Salespad.net

Cheers!
Sanjay

 

Sales Pad Customer Fields

Sales Pad Customer

NameData Type
Customer_Numstring
Customer_Namestring
Customer_Classstring
Corporate_Customer_Numstring
Short_Namestring
Statement_Namestring
Primary_Addr_Codestring
Primary_Bill_To_Addr_Codestring
Primary_Ship_To_Addr_Codestring
Statement_To_Addr_Codestring
Sales_Person_IDstring
Sales_Territorystring
Payment_Termsstring
Shipping_Methodstring
Price_Levelstring
User_Def_1string
User_Def_2string
Tax_Exempt_1string
Tax_Exempt_2string
Tax_Registration_Numstring
Comment_1string
Comment_2string
IntegrationSourceshort
Inactivebool
On_Holdbool
Customer_Notestring
Currency_IDstring
Currency_Decint
Last_AgedDateTime
Balancedecimal
Unapplied_Amountdecimal
Customer_Credit_Limitdecimal
Last_Pay_DateDateTime
Last_Pay_Amtdecimal
First_Invoice_DateDateTime
Last_Invoice_DateDateTime
Last_Invoice_Amtdecimal
Last_Stmt_DateDateTime
Last_Stmt_Amtdecimal
Life_Avg_Daysshort
Year_Avg_Daysshort
Total_Amt_NSF_Checks_YTDdecimal
Num_NSF_Checks_YTDint
Tax_Schedulestring
Ship_Completebool
Email_Tostring
Email_CCstring
Email_BCCstring
Messagestring
Suffix val_ for value field name.
Suffix ??. for SDK Field reference
Refer to ????????? view

Sales Pad Customer Addr Fields

Sales Pad Customer Address Fields

NameData Type
Addressstring
Address_Codestring
Address_Line_1string
Address_Line_2string
Address_Line_3string
Address_Usestring
AddressShortstring
Alt_Company_Namestring
Citystring
Commentstring
Contact_Personstring
Countrystring
Created_OnDateTime
Customer_Numstring
Dont_Emailbool
Dont_Mailbool
Emailstring
Faxstring
Loginstring
Modified_OnDateTime
Passwordstring
Phone_1string
Phone_2string
Phone_3string
Phonesstring
Sales_Person_IDstring
Shipping_Methodstring
Statestring
Tax_Schedulestring
UPS_Zonestring
USERDEF1string
USERDEF2string
Warehouse_Codestring
Web_Sitestring
Zipstring
Suffix val_ for value field name.
Suffix ??. for SDK Field reference
Refer ????????? view

Sales Pad Sales Line Items Fields

Sales Pad Sales Line Item Fields

FieldType
Fulfillment_DateDateTime
Shipping_Methodstring
Sales_Territorystring
Price_Levelstring
Item_Qty_Decshort
Custom_Groupstring
Req_Ship_DateDateTime
ReadOnlybool
Ship_To_Address_Codestring
Contact_Personstring
Address_Line_2string
Citystring
Zipstring
Phone_1string
Phone_3string
Commentstring
Sales_Doc_Numstring
Component_Seq_Numint
Item_Numberstring
Is_Non_Inventorybool
UOfM_Schedulestring
Warehouse_Codestring
Expected_Unit_Costdecimal
Unit_Pricedecimal
Currency_Decint
Markdown_Pctdecimal
Quantitydecimal
Qty_Remainingdecimal
Qty_Backordereddecimal
Qty_ToPickdecimal
Qty_Selecteddecimal
Qty_To_Invoicedecimal
Actual_Ship_DateDateTime
Tax_Schedulestring
Sales_Person_IDstring
Purchasing_Statusstring
Item_Curr_Decshort
Tax_Amountdecimal
Item_Trackingstring
Master_Numint
Ship_To_Namestring
Address_Line_1string
Address_Line_3string
Statestring
Countrystring
Phone_2string
Faxstring
Suffix val_ for value field name.
Suffix sl. for SDK Field reference
Refer spv3SalesLineItem view

Sales Document Entry – Pre Save Example:

Sales Document Entry – Pre Save Example:

This pre save will stop the user from saving the document if a PO Number is not entering  a duplicate on a sales document.

	if(sd.val_Sales_Doc_Num == "")	
	{	
		if (sd.val_Customer_PO_Num == "")
	            {	
	                e.Cancel = true;	
	                return "Please enter a customer po number.";	
	            }	
	            else	
	            {	
	                SalesPad.Bus.SalesDocuments sds = new SalesPad.Bus.SalesDocuments();	
	                System.SearchClause sc = new System.SearchClause(Bus.SalesDocument._Customer_PO_Num, "=", sd.val_Customer_PO_Num);	
	                sc.And(Bus.SalesDocument._Customer_Num, "=", sd.val_Customer_Num);	
	                sc.And(Bus.SalesDocument._Sales_Doc_Num, "<>", sd.val_Sales_Doc_Num);	
	                sds.Load(sc);	

	                SalesPad.Bus.SalesDocumentHistorys sdh = new SalesPad.Bus.SalesDocumentHistorys();	
	                System.SearchClause sc2 = new System.SearchClause(Bus.SalesDocument._Customer_PO_Num, "=", sd.val_Customer_PO_Num);	
	                sc2.And(Bus.SalesDocument._Customer_Num, "=", sd.val_Customer_Num);	
	                sc2.And(Bus.SalesDocument._Sales_Doc_Num, "<>", sd.val_Sales_Doc_Num);	
	                sdh.Load(sc);	

	                if (sds.Count > 0)	
	                {	
	                    //e.Cancel = true;	
	                    return string.Format("Customer PO number was user on order: {0}", ((Bus.SalesDocument)sds[0]).val_Sales_Doc_Num);	
	                }	
	                else if (sdh.Count > 0)	
	                {	
	                    //e.Cancel = true;	
	                    return string.Format("Customer PO number was user on order: {0}", ((Bus.SalesDocument)sdh[0]).val_Sales_Doc_Num);	
	                }	
	                else	
	                {	
	                    return "";	
	                }	
	            }	
	}	
	else	
	{	
		return "";
	}

Cheers!
Sanjay

 

Sales Pad Sales Document Fields

Sales Pad Sales Document Fields

FieldData Type
Sales_Doc_Typestring
Sales_Doc_IDstring
Actual_Ship_DateDateTime
Sourcestring
Customer_Numstring
Bill_To_Address_Codestring
Ship_To_Namestring
Address_Line_1string
Address_Line_3string
Statestring
Countrystring
Phone_2string
Faxstring
Customer_PO_Numstring
Req_Ship_DateDateTime
Freightdecimal
Misc_Chargedecimal
Totaldecimal
Depositsdecimal
Tax_Schedulestring
Sales_Person_IDstring
Payment_Termsstring
Commentsstring
User_Def_Date1DateTime
User_Def_List1string
User_Def_List3string
User_Def_2string
User_Def_4string
Prev_Sales_Doc_Typestring
Quote_Numstring
Currency_IDstring
Packingslip_Numstring
Ship_Completebool
Currency_Decint
Created_Bystring
EnteredBatchstring
Alertstring
Forwardablebool
Comment_IDstring
USRDAT02DateTime
USRTAB09string
USERDEF1string
USRDEF03string
USRDEF05string
Sales_Doc_Numstring
Doc_DateDateTime
Fulfillment_DateDateTime
Sales_Batchstring
Customer_Namestring
Ship_To_Address_Codestring
Contact_Personstring
Address_Line_2string
Citystring
Zipstring
Phone_1string
Phone_3string
Price_Levelstring
Statusstring
Subtotaldecimal
Taxdecimal
Discountdecimal
On_Accountdecimal
Shipping_Methodstring
Warehouse_Codestring
Sales_Territorystring
Master_Numint
Notesstring
User_Def_Date2DateTime
User_Def_List2string
User_Def_1string
User_Def_3string
User_Def_5string
Prev_Sales_Doc_Numstring
Invoice_Numstring
Pickticket_Numstring
Blind_Shipbool
Auto_Calc_Freightbool
Created_OnDateTime
Emailstring
BatchHoursdecimal
ReadOnlybool
Messagestring
USRDAT01DateTime
USRTAB01string
USRTAB03string
USERDEF2string
USRDEF04string
Suffix val_ for value field name.
Suffix sd. for SDK Field reference
Refer to spv3Document view