Pricing Administration Guide > Script-Based Pricing Factors >

Sample Script


The following sample script is presented as a learning tool. It may not function properly in your environment.

This example shows a very simple pricing script that demonstrates the process of passing information to and from the script.

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)

{

// User Properties:

// Use Variable Map Y

// Field 1 Customizable Product Header.Account

// Field 2 Customizable Product.Name

// Parameter 3 Customizable Product XA.Color

var account = Inputs.GetProperty ("Var 1");

var Product = Inputs.GetProperty ("Var 2");

var Color = Inputs.GetProperty ("Var 3");

var CurrentPrice = Inputs.GetProperty ("Current Price");

var curPrice = parseFloat (CurrentPrice);

var reason;

if (account.indexOf("Siebel") > -1)

{

curPrice *=1.2;

reason = "20% markup for Siebel. ";

Outputs.SetProperty ("Script Applied", "true");

}

if ((Product == "Shirt") && (Color == "Red"))

{

// note that this is 10 of whatever currency is being used

curPrice += 10;

reason += "Surcharge of 10.";

Outputs.SetProperty ("Script Applied", "true");

}

CurrentPrice = curPrice.toString();

Outputs.SetProperty ("Current Price", CurrentPrice);

Outputs.SetProperty ("Reason", reason);

return (CancelOperation);

}

Pricing Administration Guide