Validation Pop Up Warning
Moderator: Phil Barton
Validation Pop Up Warning
Is there any way to do a validation that a message pops up (similar to the simple order validation with the e.cancel) but allow the file to continue to be saved. I know we could do it as a warning and have the user see the warning on the bottom with the warnings and errors but they would be prefer to see it as a pop-up, user clicks ok, and file continues to be saved. (Once they fix the file, the popup would not appear anymore on save).
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Validation Pop Up Warning
On this warning... Can I update a custom field (on the order information screen) and hot spot there? how?
Re: Validation Pop Up Warning
On that note, can I attach an image in one of the image fields (let's say a new contact for escrow company, and attach a bmp or pfd file into the logo image), and then hot spot there. I this doable?
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Adding Errors and Warnings to Errors and Warnings
You can write a rule that writes a value to any custom field and hotspots there. In a shell or server package, you could add/change a contact image but you can't hotspot an image.
To hotspot a field (in general), subscribe to the IOrderStore.OrderSaving event. An example of doing this in a server package is in the SDK at Cookbook/Server Packages/How do I subscribe to OrderSaving Events? Then when the OrderSaving event fires, do your validations and, as necessary, add errors or warnings to the return object.
If you want to validate a Custom Field instead, change "Name" to the custom name Field code (such as "StateOfBusiness#" or "XYZ##"). You can validate top level order model items (such as RelatedOrders) by passing e.Order to AddWarning(..) instead of settlementAgent.
To hotspot a field (in general), subscribe to the IOrderStore.OrderSaving event. An example of doing this in a server package is in the SDK at Cookbook/Server Packages/How do I subscribe to OrderSaving Events? Then when the OrderSaving event fires, do your validations and, as necessary, add errors or warnings to the return object.
Code: Select all
private void Os_OrderSaving(object sender, OrderSavingEventArgs e)
{
dynamic order = e.Order;
if ( {validation fails} )
{
// Get the first settlement agent
IList settlementAgents = (IList)order.SettlementAgents;
IOrderItem settlementAgent = (IOrderItem)settlementAgents[0];
// Write warning to order and hotspot the "Name" property on the settlement agent.
e.AddWarning(settlementAgent, "Name", "Text that will appear in Errors and Warnings.");
}
}
Bob Richards, Senior Software Developer, SoftPro
Re: Validation Pop Up Warning
can you give me an example of setting data (string value) in a custom field on the order level.
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Validation Pop Up Warning
You can't use dynamics since the hash tags would be illegal characters. Use the GetProperty/SetProperty methods like you would for any IOrderItem property.
Code: Select all
IOrderItem order = {order object}
order.SetProperty("XYZ##", "New value");
Bob Richards, Senior Software Developer, SoftPro