Previous Topic

Next Topic

SP Script Editor

Navigator > Setup > Special Pricing > Pricing Script Editor

The Pricing script determines how SP rules are collected, selected, applied and ranked. The pricing script provided sorts rules by priority and effective price, then chooses the lowest price at the highest priority. A default script SPDefault.pfs is provided with Accredo.

The SP Script Editor is a version of the MaxBasic Script Editor. You can use it to create a new script, or modify the provided script.

The SP Script Editor includes the Context object, available under the Objects menu, which contains properties for the context in which the script is triggered to return a price. The Context object may be documented from the Automated menu, select Automated > Context > Document Context.

For example, you can rank and select SP Rules according to the business process, write information back to custom TD fields in the context object or disallow Special Pricing if an account is not paid in full by the due date.

Within the script editor, to cancel writeback of Special Pricing, use a silent Abort statement.

Important: If you edit the provided SPDefault.pfs script or one of the other example scripts, save it under a different file name, as the provided script is overwritten when an Accredo server install is performed.

The Pricing Script file set in SP Settings will be executed whenever a price is returned if Apply Special Pricing is selected and in SP Price Query when the Query (F9) button is clicked.

Special Pricing Context Object

The Special Pricing Context object appears in the Objects menu in the SP Script Editor, and may be documented from the Automated menu (Automated > Context > Document Context).

The Context object is used to Collect Special Pricing rules matching the properties of the Context and then to return special pricing values after evaluation.

When a pricing decision is triggered the Context.Initial... properties return the starting point before Special Pricing is evaluated, e.g. in an IN Invoice the prices and discount that would apply if there is no special pricing.

Rules are collected using Context.Collect then evaluated.

After evaluating Special Pricing the Context.Special... properties are set to return the values from the context. Context.SpecialMessage can be set to return a status hint.

Context sub objects can be located on different records and Context.Collect called to collect rules that apply the record. Set Context.UpdateDependantTables set True to apply the change to related sub objects.

For an example see the SPDefaultWithBillTo.pfs script which is provided, this first collect rules for the customer, then if the Customer has a BillToAccountCode locates the BillToCustomer to collect rules applying to that customer. If UpdateDependentTables is set True then locating the BillToAccountCode would also update ARCategory1, ARCategory2, CustomerGroup, etc to the ones from the BillToAccountCode customer record.

See Also

Special Pricing - Settings

Book Contents

Book Index