Page 1 of 1

Custom Rule Use Lookups

Posted: Wed Mar 16, 2016 10:54 am
by czentman
can I compare data in my file to data in a lookup in the custom rules python. Can I access the lookups from python? If so, how? If not, can I access the database tables at all and compare data in my file to my own table in the database? Can you guide me along with this. We have the underwriters sending us specific properties or contact names to "watch out" for our users need to be alerted to check into and we keep is as a "watch list" and want to compare our contacts with the contacts in the list, and/or our properties in the file to the properties in the list.

Re: Custom Rule Use Lookups

Posted: Wed Mar 16, 2016 1:51 pm
by BobRichards
You must not do this operation in a Custom Order Rule since it can generate multiple queries to the database. Calling a mid-tier interface should not be performed either since it would make running the rule set entirely too slow. Remember that rules can run multiple times so response time is further degraded. Custom Order Rules should be restricted to objects that are part of the order model.

One method to do this is write a server-side package that monitors the OrderSaving event. On each order save, it would check the necessary information at the server and could generate a validation error message for the user. It would also prevent the order from being saved until the validation is error free.

Sorry.