<h2>Email triggered before field value is set. </h2><br/><div style="overflow-x:auto"><article><div ><h3 >Issue </h3><section><ul style="list-style-type: square;"><li>One email notification that has not been triggered for the past two months. This notification's conditions have not been changed and it was being triggered based on a custom field (u_requested_by) on sc_request. The email is sent from the sc_req_item table on insert when the 'request.u_requested_by' is different from the 'request.requested_for' and the 'request.u_requested_by' is not empty. </li></ul></section></div><div ><h3 >Release</h3><section><ul style="list-style-type: square;"><li>NY Patch 4 HF 1a</li></ul></section></div><div ><h3 >Cause</h3><section><ul style="list-style-type: square;"><li>The u_requested_by field is being populated on the before insert business rule on sc_request table. At that time, the req_item has already been created and the notification engine already ran:<br />```<br />13:28:02.93 About to execute engine 'com.glide.ui_notification.Engine' on table sc_req_item<br />13:28:02.93 Finished executing engine 'com.glide.ui_notification.Engine' on table sc_req_item<br />13:28:02.93 About to execute engine 'com.glide.email_outbound.NotificationEngine' on table sc_req_item<br />(...)<br />13:28:02.286 Execute before insert business rules on sc_request: REQ0106159 before engines (order <1000)<br />```</li></ul></section></div><div ><h3 >Resolution</h3><section><ul style="list-style-type: square;"><li>To avoid this, recommendation for implementation would be:<br />- Register a new custom event;<br />- Change the notification to trigger based on that event, and use parm1 and parm2 as recipients for the email.<br />- On the above business rule, if the requested_for is different than the 'u_requested_by':<br />--- Use GlideRecord to loop through the sc_req_item table for records belonging to that request;<br />---On the loop, queue an event of the type created above and pass the parameters as needed.<br /><br /></li></ul></section></div></article></div>