Discussions related to writing and managing custom business rules.
Moderator: Phil Barton
- Posts: 157
- Joined: Tue Dec 02, 2008 12:02 pm
I did a Raise Warning event --> e.AddWarning(e.Order, "Address1", reason), and I want to HotSpot for the 2nd address lets say or specific Contact. How can I do this?
- Posts: 1006
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
The AddWarning(item, property, message) and AddError(item, property, message) method work the same way. The first argument (the context) must be an IOrderItem. The second argument is a member Property for the context. The Context and Property information is displayed in Select in the Field Code Browser when you select an order field. Alternatively, you can press ALT+F6 in a field to see this information.
Code: Select all
void Handler(object o, OrderSavingEventArgs e)
// Get the address IOrderItem for the second underwriter (NO ERROR CHECKING).
IOrder order = e.Order;
IList underwriters = (IList)order.GetProperty("Underwriters");
IOrderItem underwriter = (IOrderItem)underwriters;
IOrderItem address = (IOrderItem)underwriter.GetProperty("Address");
// Add warning.
e.AddWarning(address, "Address1", "Bad address");
Bob Richards, Software Developer, SoftPro