Order Script

    


This allows you to create a Script that is run against an Order as a whole in the following areas:

Assembly

Jobs

Sales

Purchase

POS

 

and enables you to add extra specific functionality such as:

Total Order Value discounting based on Order content

Freight calculations based on Order content

Order Authorisation Levels (Example: User Purchasing levels)

Order Margin Control with User-defined Margin levels

Order Validation and/or Checks

Workflow actions (Example: send Email regarding this Order)

Promotions (Example: 3 for price of 2, etc) 

 

To see how this works you can try the following exercise in which we will create a Sales Order Script that will return the Order Customer’s Name which when confirmed will allow the order to proceed.

 

Go into File>Custom Scripts and add a new Custom Script called (say) OrderCust.  ‘Check’ the ‘This is an Order Script’ checkbox.  To define if this script must be acknowledged before the Order can proceed you should also ‘check’ the ‘Mandatory’ checkbox.

 

In the ‘Script’ tab enter the following:

 

var

TheCustomer: string;

begin

   TheCustomer := GetSourceFieldValue('CUSTOMER');

   showmessage(TheCustomer);

   OrderScriptRun(True);

end.

 

The first line defines a variable

The 3rd line populates this variable with the contents of the CUSTOMER field in the SALESHEADER record

The 4th line displays the content of the variable when the script is run

The 5th line updates the OrderScriptRun field in the SALESHEADER record with ‘True’ to denote that the Order Script has been run

 

The next step is to tell Ostendo that the script is linked to a Sales Order.  To do this go into File>System Configuration>Order Scripts and create a new record containing the following

Screen:  Select ‘Sales Orders’ from the drop-down

Script Name: Select OrderCust

 

Now go into Sales>Sales Orders and create a Sales Order then add a line to the Order.  If you try and pick a line then you will be presented with an error message stating that OrderCust needs to be run’.  I.e. OrderScriptRun field in the SALESHEADER record is currently set to ‘False’.

 

You will see a new button (OrderCust) on the Batch Entry Bar of the Sales Order Lines screen.  If you click on this button then the script will be run. This will return the Customer Name to the screen in addition to amending the OrderScriptRun field in the SALESHEADER record to ‘True’.

 

You can now continue with picking the Sales Order lines