HotSpot Address or Contact

Discussions related to writing and managing custom business rules.

Moderator: Phil Barton

Post Reply
czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

HotSpot Address or Contact

Post by czentman »

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?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: HotSpot Address or Contact

Post by BobRichards »

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[1];
	IOrderItem address = (IOrderItem)underwriter.GetProperty("Address");

	// Add warning.
	e.AddWarning(address, "Address1", "Bad address");
}
Bob Richards, Senior Software Developer, SoftPro
Post Reply