Page 1 of 1

HotSpot Address or Contact

Posted: Tue Aug 30, 2016 10:53 am
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?

Re: HotSpot Address or Contact

Posted: Tue Oct 11, 2016 2:12 pm
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");
}