Using UDF’s in Business Rules

In my last post I created a User-Defined Function (UDF) to determine if a given datetime fell within or outside working hours (as defined by a given work schedule). This post will discuss how to use a function such as this in business rules.

Ok so lets say you want to check in a business rule (doesn’t matter whether normal or client side) if the current time is within the work schedule. For the sake of argument we will assume you have a work schedule called NORMAL.

All you need to do is add the following Condition:

{MATH, (SELECT "_SMDBA_"."IsWorkTime"('NORMAL', GETDATE()))} EQUAL TO 1

Consequently the business rule you are creating will only fire if the current time falls within the selected work schedule.

Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s