...
- To successfully use the sample Pricing Rules in this section, you should add the following objects to the Pricing Rule Script Type's Repository References tab, if not already present:
- Startup.Aptify Application Object
- CRM.AptifyOBDEntity
- CRM.AptifyOrderLineControl
Anchor | ||||
---|---|---|---|---|
|
The following script, specifies a Member Price of $20 and a Non-Member Price of $50 when this product is added to an order. This type of rule could apply at the top-level Prices record and if a Person did not qualify for either price, the system would fall back to the Prices records in the pricing matrix:
If gePerson isNot Nothing ThenĀ
If gePerson.GetValue("MemberType") isNot Nothing Then
If gePerson.GetValue("MemberType").ToString.ToLower = "member" Then
Price.Price = 20.00D
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Exist
Result.Success = True
Else If gePerson.GetValue("MemberType").ToString.ToLower = "non-member" Then
Price.Price = 50.00D
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Exist
Result.Success = True
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.NotExist
Result.Success = True
End If
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.NotExist
Result.Success = True
End If
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Failure
Result.Success = False
Result.Message = "Person information was not available."
End If
Anchor | ||||
---|---|---|---|---|
|
In the second example below, this rule charges $10 to members located in California and $12 to members not in California. This rule could be entered on a Member-based Prices record
If gePerson isNot Nothing Then
If gePerson.GetValue("State") isNot Nothing Then
If gePerson.GetValue("State").ToString.ToLower = "ca" Then
Price.Price = 10.00D
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Exist
Result.Success = True
Else If gePerson.GetValue("State").ToString.ToLower <> "ca" Then
Price.Price = 12.00D
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Exist
Result.Success = True
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.NotExist
Result.Success = True
End If
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.NotExist
Result.Success = True
End If
Else
Result.Outcome = Aptify.Applications.OrderEntry.IProductPrice.PriceOutcome.Failure
Result.Success = False
Result.Message = "Person information was not available."
End If
...