emailstaffnotification

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
emailstaffnotification [2019/07/23 15:17] Justin Willeyemailstaffnotification [2019/08/01 17:33] (current) – List of topics Michael Scott
Line 3: Line 3:
 Email Group Notifications provide a mechanism for maintaining single or groups of email addresses for use by Jobs and iqxWEB when distributing messages reports etc. Individual email addresses etc can then be changed in IQX without having to edit the jobs each time. Email Group Notifications provide a mechanism for maintaining single or groups of email addresses for use by Jobs and iqxWEB when distributing messages reports etc. Individual email addresses etc can then be changed in IQX without having to edit the jobs each time.
  
-  * Topic - a pre-agreed token e.gRegisterCandidate or CompleteTimesheet+  * Topic - a pre-agreed token, often shared with the IQXWeb Settings - Query RecipientsExamples in use are SUBMITCANDIDATE, ADDSHIFTS, ADDVACANCY, JOBAPPLICATION, SHIFTSTATECHANGE, CLIENTBOOKING, DOCUMENTUPLOAD, TIMESHEET, PAYROLL and ACCOUNTS. 
   * Email Address - can be one or more recipient addresses, separated by commas or semicolons   * Email Address - can be one or more recipient addresses, separated by commas or semicolons
-  * Message Text - the text of the email. May contain tokens such as <code>{loadform}/person/{personid}/cv</code> which will convert to hyperlinks to load a specified form and view in IQX+ 
 +  * Message Text - the text of the email - if invoked by RequestLinkedEmailStaffNotification (see below). May contain tokens such as <code>{loadform}person/{personid}/cv{/loadform}</code> which will convert to hyperlinks to load a specified form and view in IQX 
 +  * Supported tokens are: 
 +    * {personid} 
 +    * {companyid} 
 +    * {vacancyid} 
 +    * {loadform} to start a hyperlink, matched by {/loadform} to end it 
   * Division and Department can be used to narrow down the recipients for a particular notification. If they are left blank this recipient will receive all notifications for the topic   * Division and Department can be used to narrow down the recipients for a particular notification. If they are left blank this recipient will receive all notifications for the topic
  
-**Note: a scheduled job, EmailStaffNotifier.xml or equivalent, must be running to do the actual sending.+A Scheduled Job, EmailStaffNotifier.xml or equivalent, must be running to do the actual sending. ++++Sample Job|<sxh xml><?xml version="1.0"?> 
 +<Job title="Dispatch Email Notifications" autoclose="Yes"> 
 +    <SQLQuery> 
 +        <SQLSelect> 
 +            <![CDATA[ 
 +                select id, topic, body, hyperlink, departmentid, divisionid  
 +                from EmailStaffNotification 
 +                where Dispatched is null and Requested > current date - 3 
 +            ]]> 
 +        </SQLSelect> 
 +        <ForEachRow> 
 +            <SetVariable name="recipients" sql="select list(emailaddress,';') from EmailStaffNotificationAddress where topic=:topic and (departmentid=:departmentid or departmentid is null) and (divisionid=:divisionid or divisionid is null)"/> 
 +            <If x1="{recipients}" x2="" comparison="!="> 
 +                <SetVariable name="emailbody"> 
 +                    <WriteLn>{body}</WriteLn> 
 +                    <If x1="{hyperlink}" x2="" comparison="!="> 
 +                        <WriteLn/> 
 +                        <WriteLn><![CDATA[<br/><a href="iqxw://iqx/loadform/{hyperlink}">Open in IQX</a><br/>]]></WriteLn> 
 +                        <WriteLn>Note: the above link will only work if IQX is running on the current device and configured to respond</WriteLn> 
 +                    </If> 
 +                </SetVariable> 
 +                <SendEmail subject="IQX Notification" smtpsettings="EMAILSTAFFNOTIFY" html="YES"> 
 +                    <EmailRecipients>{recipients}</EmailRecipients> 
 +                    <EmailBody>{emailbody}</EmailBody> 
 +                </SendEmail> 
 +            </If> 
 +            <SQLExec> 
 +                <![CDATA[update EmailStaffNotification set Dispatched=current timestamp, Recipients=:recipients where id=:id]]> 
 +            </SQLExec> 
 +        </ForEachRow> 
 +    </SQLQuery> 
 +</Job> 
 +</sxh>++++ 
 + 
 +There are two alternative functions which can be invoked from a web net procedure or anywhere else:<code>RequestEmailStaffNotification ( in pTopic char(50),in pBody long varchar,in pHyperLink char(100),in pDepartmentID char(2) default null,in pDivisionID char(20) default null )</code> 
 + 
 +This is used to directly specify the body of the email. 
 + 
 +pTopic links to the Topic in Maintenance | Agency Setup | Email Group Notifications. pBody is the body text. pHyperLink is an optional woodpecker form to load, with parameters e.g. person/xxxx where xxxx is a personid. The generated hyperlink will be appended to the body text. pDepartmentID and pDivisionID will be used to narrow down who receives the emails from the recipients specified in Maintenance | Agency Setup | Email Group Notifications.
  
 +Alternatively the Message Text can be specified in Maintenance | Agency Setup | Email Group Notifications containing tokens like {loadform}
 + & {personid} (see above) and the alternative call used:<code>RequestLinkedEmailStaffNotification( 
 +in pTopic char(50),in pPersonID char(20) default null,in pCompanyID char(20) default null,in pVacancyID char(20) default null,in pDepartmentID char(2) default null,in pDivisionID char(20) default null )</code>
  • emailstaffnotification.1563895024.txt.gz
  • Last modified: 2019/07/23 15:17
  • by Justin Willey