Avatar

Level 3

Here is teh typology rules script

var tempQuery = xtk.queryDef.create(<queryDef schema="nms:recipient" operation="select"> <select> <node expr="@id"/> <node expr="@timezone"/> </select> <where> <condition expr={"@timezone is not null"}/> </where></queryDef>);

var resultSet = tempQuery.ExecuteQuery();

for each (var row in resultSet)

{

var recipientId = row.@id;

var recipientTz = row.@timezone;

today = new Date(); 

localoffset = -(today.getTimezoneOffset()/60);

      if (recipientTz=="EST")

      {

            tzdestoffset = -4;

      }

      else if (recipientTz=="CST")

      {

            tzdestoffset = -5;

      }

      else if (recipientTz=="MST")

      {

            tzdestoffset = -6;

      }

      else if (recipientTz=="PST")

      {

            tzdestoffset = -7;

      }

      else

      {

             logInfo('TimeZone is missing');

      }

      estoffset = tzdestoffset-localoffset;

      local_dttm = new Date( new Date().getTime() + estoffset * 3600 * 1000);

      local_hh = local_dttm .getHours();

           

      if (local_hh >= work_start && local_hh <= work_end)

      {

          return true;

      }

      else

      {

          return false;

      } 

}