This commit is contained in:
waldo1001 2022-02-28 21:41:22 +00:00
parent d5790b8abb
commit 7e9d4c18d3
232 changed files with 25544 additions and 58300 deletions

View file

@ -145,42 +145,42 @@
<p><a href="8512.2nd-notification.PNG"><img src="8512.2nd-notification.PNG" alt=" "></a></p>
<p><em>Figure 2: You add a second item that is not in stock. the notification is fired with the same GUID, 2712AD06-C48B-4C20-820E-347A60C9AD00, for example. The previous notification is overwritten.</em></p>
<p>Here is the code for this behavior:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-al" data-lang="al"><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>CreateAndSendNotification@<span style="color:#0000cf;font-weight:bold">23</span><span style="color:#ce5c00;font-weight:bold">(</span>UnitOfMeasureCode@<span style="color:#0000cf;font-weight:bold">1010</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Code</span>[<span style="color:#0000cf;font-weight:bold">20</span>]<span style="color:#000;font-weight:bold">;</span>InventoryQty@<span style="color:#0000cf;font-weight:bold">1009</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>GrossReq@<span style="color:#0000cf;font-weight:bold">1008</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedReq@<span style="color:#0000cf;font-weight:bold">1007</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>SchedRcpt@<span style="color:#0000cf;font-weight:bold">1006</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedRcpt@<span style="color:#0000cf;font-weight:bold">1005</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentQuantity@<span style="color:#0000cf;font-weight:bold">1004</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentReservedQty@<span style="color:#0000cf;font-weight:bold">1003</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>TotalQuantity@<span style="color:#0000cf;font-weight:bold">1002</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>EarliestAvailDate@<span style="color:#0000cf;font-weight:bold">1001</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Date</span><span style="color:#ce5c00;font-weight:bold">) </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Boolean</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">VAR</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck@<span style="color:#0000cf;font-weight:bold">1011</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Page</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1872</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification@<span style="color:#0000cf;font-weight:bold">1000</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Notification</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ID<span style="color:#ce5c00;font-weight:bold">(</span>GetItemAvailabilityNotificationId<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>MESSAGE<span style="color:#ce5c00;font-weight:bold">(</span>STRSUBSTNO<span style="color:#ce5c00;font-weight:bold">(</span>NotificationMsg<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#ce5c00;font-weight:bold">))</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SCOPE<span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#204a87;font-weight:bold">NOTIFICATIONSCOPE</span><span style="color:#000;font-weight:bold">::</span>LocalScope<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ADDACTION<span style="color:#ce5c00;font-weight:bold">(</span>DetailsTxt<span style="color:#000;font-weight:bold">,</span><span style="color:#204a87;font-weight:bold">CODEUNIT</span><span style="color:#000;font-weight:bold">::</span>"Item-Check Avail."<span style="color:#000;font-weight:bold">,</span><span style="color:#4e9a06">'ShowNotificationDetails'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck<span style="color:#ce5c00;font-weight:bold">.</span>PopulateDataOnNotification<span style="color:#ce5c00;font-weight:bold">(</span>AvailabilityCheckNotification<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#000;font-weight:bold">,</span>UnitOfMeasureCode<span style="color:#000;font-weight:bold">,</span>InventoryQty<span style="color:#000;font-weight:bold">,</span>GrossReq<span style="color:#000;font-weight:bold">,</span>ReservedReq<span style="color:#000;font-weight:bold">,</span>SchedRcpt<span style="color:#000;font-weight:bold">,</span>ReservedRcpt<span style="color:#000;font-weight:bold">,</span>CurrentQuantity<span style="color:#000;font-weight:bold">,</span>CurrentReservedQty<span style="color:#000;font-weight:bold">,</span>TotalQuantity<span style="color:#000;font-weight:bold">,</span>EarliestAvailDate<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SEND<span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span>FALSE<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>**GetItemAvailabilityNotificationId**@<span style="color:#0000cf;font-weight:bold">27</span><span style="color:#ce5c00;font-weight:bold">() </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">GUID</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#4e9a06">'2712AD06-C48B-4C20-820E-347A60C9AD00'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></code></pre></div><p>An easy fix would be to dynamically generate the notification ID. However, what if you fix the issue that triggered the notification?</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-al" data-lang="al"><span style="display:flex;"><span><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>CreateAndSendNotification@<span style="color:#0000cf;font-weight:bold">23</span><span style="color:#ce5c00;font-weight:bold">(</span>UnitOfMeasureCode@<span style="color:#0000cf;font-weight:bold">1010</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Code</span>[<span style="color:#0000cf;font-weight:bold">20</span>]<span style="color:#000;font-weight:bold">;</span>InventoryQty@<span style="color:#0000cf;font-weight:bold">1009</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>GrossReq@<span style="color:#0000cf;font-weight:bold">1008</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedReq@<span style="color:#0000cf;font-weight:bold">1007</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>SchedRcpt@<span style="color:#0000cf;font-weight:bold">1006</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedRcpt@<span style="color:#0000cf;font-weight:bold">1005</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentQuantity@<span style="color:#0000cf;font-weight:bold">1004</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentReservedQty@<span style="color:#0000cf;font-weight:bold">1003</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>TotalQuantity@<span style="color:#0000cf;font-weight:bold">1002</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>EarliestAvailDate@<span style="color:#0000cf;font-weight:bold">1001</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Date</span><span style="color:#ce5c00;font-weight:bold">) </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Boolean</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">VAR</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck@<span style="color:#0000cf;font-weight:bold">1011</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Page</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1872</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification@<span style="color:#0000cf;font-weight:bold">1000</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Notification</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ID<span style="color:#ce5c00;font-weight:bold">(</span>GetItemAvailabilityNotificationId<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>MESSAGE<span style="color:#ce5c00;font-weight:bold">(</span>STRSUBSTNO<span style="color:#ce5c00;font-weight:bold">(</span>NotificationMsg<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#ce5c00;font-weight:bold">))</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SCOPE<span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#204a87;font-weight:bold">NOTIFICATIONSCOPE</span><span style="color:#000;font-weight:bold">::</span>LocalScope<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ADDACTION<span style="color:#ce5c00;font-weight:bold">(</span>DetailsTxt<span style="color:#000;font-weight:bold">,</span><span style="color:#204a87;font-weight:bold">CODEUNIT</span><span style="color:#000;font-weight:bold">::</span>"Item-Check Avail."<span style="color:#000;font-weight:bold">,</span><span style="color:#4e9a06">'ShowNotificationDetails'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck<span style="color:#ce5c00;font-weight:bold">.</span>PopulateDataOnNotification<span style="color:#ce5c00;font-weight:bold">(</span>AvailabilityCheckNotification<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#000;font-weight:bold">,</span>UnitOfMeasureCode<span style="color:#000;font-weight:bold">,</span>InventoryQty<span style="color:#000;font-weight:bold">,</span>GrossReq<span style="color:#000;font-weight:bold">,</span>ReservedReq<span style="color:#000;font-weight:bold">,</span>SchedRcpt<span style="color:#000;font-weight:bold">,</span>ReservedRcpt<span style="color:#000;font-weight:bold">,</span>CurrentQuantity<span style="color:#000;font-weight:bold">,</span>CurrentReservedQty<span style="color:#000;font-weight:bold">,</span>TotalQuantity<span style="color:#000;font-weight:bold">,</span>EarliestAvailDate<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SEND<span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span>FALSE<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>**GetItemAvailabilityNotificationId**@<span style="color:#0000cf;font-weight:bold">27</span><span style="color:#ce5c00;font-weight:bold">() </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">GUID</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#4e9a06">'2712AD06-C48B-4C20-820E-347A60C9AD00'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span></code></pre></div><p>An easy fix would be to dynamically generate the notification ID. However, what if you fix the issue that triggered the notification?</p>
<p>Here is the code for this possible fix:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-al" data-lang="al"><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>CreateAndSendNotification@<span style="color:#0000cf;font-weight:bold">23</span><span style="color:#ce5c00;font-weight:bold">(</span>UnitOfMeasureCode@<span style="color:#0000cf;font-weight:bold">1010</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Code</span>[<span style="color:#0000cf;font-weight:bold">20</span>]<span style="color:#000;font-weight:bold">;</span>InventoryQty@<span style="color:#0000cf;font-weight:bold">1009</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>GrossReq@<span style="color:#0000cf;font-weight:bold">1008</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedReq@<span style="color:#0000cf;font-weight:bold">1007</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>SchedRcpt@<span style="color:#0000cf;font-weight:bold">1006</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedRcpt@<span style="color:#0000cf;font-weight:bold">1005</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentQuantity@<span style="color:#0000cf;font-weight:bold">1004</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentReservedQty@<span style="color:#0000cf;font-weight:bold">1003</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>TotalQuantity@<span style="color:#0000cf;font-weight:bold">1002</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>EarliestAvailDate@<span style="color:#0000cf;font-weight:bold">1001</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Date</span><span style="color:#ce5c00;font-weight:bold">) </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Boolean</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">VAR</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck@<span style="color:#0000cf;font-weight:bold">1011</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Page</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1872</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification@<span style="color:#0000cf;font-weight:bold">1000</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Notification</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ID<span style="color:#ce5c00;font-weight:bold">(</span>CREATEGUID<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>MESSAGE<span style="color:#ce5c00;font-weight:bold">(</span>STRSUBSTNO<span style="color:#ce5c00;font-weight:bold">(</span>NotificationMsg<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#ce5c00;font-weight:bold">))</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SCOPE<span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#204a87;font-weight:bold">NOTIFICATIONSCOPE</span><span style="color:#000;font-weight:bold">::</span>LocalScope<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ADDACTION<span style="color:#ce5c00;font-weight:bold">(</span>DetailsTxt<span style="color:#000;font-weight:bold">,</span><span style="color:#204a87;font-weight:bold">CODEUNIT</span><span style="color:#000;font-weight:bold">::</span>"Item-Check Avail."<span style="color:#000;font-weight:bold">,</span><span style="color:#4e9a06">'ShowNotificationDetails'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck<span style="color:#ce5c00;font-weight:bold">.</span>PopulateDataOnNotification<span style="color:#ce5c00;font-weight:bold">(</span>AvailabilityCheckNotification<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#000;font-weight:bold">,</span>UnitOfMeasureCode<span style="color:#000;font-weight:bold">,</span>InventoryQty<span style="color:#000;font-weight:bold">,</span>GrossReq<span style="color:#000;font-weight:bold">,</span>ReservedReq<span style="color:#000;font-weight:bold">,</span>SchedRcpt<span style="color:#000;font-weight:bold">,</span>ReservedRcpt<span style="color:#000;font-weight:bold">,</span>CurrentQuantity<span style="color:#000;font-weight:bold">,</span>CurrentReservedQty<span style="color:#000;font-weight:bold">,</span>TotalQuantity<span style="color:#000;font-weight:bold">,</span>EarliestAvailDate<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SEND<span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span>FALSE<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></code></pre></div><p>Now, notifications do not replace each other, but we cannot recall them because we do not track each notification ID.</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-al" data-lang="al"><span style="display:flex;"><span><span style="color:#204a87;font-weight:bold">LOCAL</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">PROCEDURE</span><span style="color:#f8f8f8;text-decoration:underline"> </span>CreateAndSendNotification@<span style="color:#0000cf;font-weight:bold">23</span><span style="color:#ce5c00;font-weight:bold">(</span>UnitOfMeasureCode@<span style="color:#0000cf;font-weight:bold">1010</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Code</span>[<span style="color:#0000cf;font-weight:bold">20</span>]<span style="color:#000;font-weight:bold">;</span>InventoryQty@<span style="color:#0000cf;font-weight:bold">1009</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>GrossReq@<span style="color:#0000cf;font-weight:bold">1008</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedReq@<span style="color:#0000cf;font-weight:bold">1007</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>SchedRcpt@<span style="color:#0000cf;font-weight:bold">1006</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>ReservedRcpt@<span style="color:#0000cf;font-weight:bold">1005</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentQuantity@<span style="color:#0000cf;font-weight:bold">1004</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>CurrentReservedQty@<span style="color:#0000cf;font-weight:bold">1003</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>TotalQuantity@<span style="color:#0000cf;font-weight:bold">1002</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Decimal</span><span style="color:#000;font-weight:bold">;</span>EarliestAvailDate@<span style="color:#0000cf;font-weight:bold">1001</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Date</span><span style="color:#ce5c00;font-weight:bold">) </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Boolean</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">VAR</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck@<span style="color:#0000cf;font-weight:bold">1011</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Page</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">1872</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification@<span style="color:#0000cf;font-weight:bold">1000</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">Notification</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">BEGIN</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ID<span style="color:#ce5c00;font-weight:bold">(</span>CREATEGUID<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>MESSAGE<span style="color:#ce5c00;font-weight:bold">(</span>STRSUBSTNO<span style="color:#ce5c00;font-weight:bold">(</span>NotificationMsg<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#ce5c00;font-weight:bold">))</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SCOPE<span style="color:#ce5c00;font-weight:bold">(</span><span style="color:#204a87;font-weight:bold">NOTIFICATIONSCOPE</span><span style="color:#000;font-weight:bold">::</span>LocalScope<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>ADDACTION<span style="color:#ce5c00;font-weight:bold">(</span>DetailsTxt<span style="color:#000;font-weight:bold">,</span><span style="color:#204a87;font-weight:bold">CODEUNIT</span><span style="color:#000;font-weight:bold">::</span>"Item-Check Avail."<span style="color:#000;font-weight:bold">,</span><span style="color:#4e9a06">'ShowNotificationDetails'</span><span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>ItemAvailabilityCheck<span style="color:#ce5c00;font-weight:bold">.</span>PopulateDataOnNotification<span style="color:#ce5c00;font-weight:bold">(</span>AvailabilityCheckNotification<span style="color:#000;font-weight:bold">,</span>ItemNo<span style="color:#000;font-weight:bold">,</span>UnitOfMeasureCode<span style="color:#000;font-weight:bold">,</span>InventoryQty<span style="color:#000;font-weight:bold">,</span>GrossReq<span style="color:#000;font-weight:bold">,</span>ReservedReq<span style="color:#000;font-weight:bold">,</span>SchedRcpt<span style="color:#000;font-weight:bold">,</span>ReservedRcpt<span style="color:#000;font-weight:bold">,</span>CurrentQuantity<span style="color:#000;font-weight:bold">,</span>CurrentReservedQty<span style="color:#000;font-weight:bold">,</span>TotalQuantity<span style="color:#000;font-weight:bold">,</span>EarliestAvailDate<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span>AvailabilityCheckNotification<span style="color:#ce5c00;font-weight:bold">.</span>SEND<span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">EXIT</span><span style="color:#ce5c00;font-weight:bold">(</span>FALSE<span style="color:#ce5c00;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span><span style="display:flex;"><span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">END</span><span style="color:#000;font-weight:bold">;</span><span style="color:#f8f8f8;text-decoration:underline">
</span></span></span></code></pre></div><p>Now, notifications do not replace each other, but we cannot recall them because we do not track each notification ID.</p>
<p><a href="0677.3-notifications-smaller.PNG"><img src="0677.3-notifications-smaller.PNG" alt=" "></a></p>
<p><em>Figure 3: Three sales lines with a notification for each one</em></p>
<p>Imagine that you’re adding several items to a sales order, and inventory is low for some of the items. Each sales line will send a notification for its item if the quantity to sell is higher than the available inventory. By using dynamically generated notification IDs (<strong>CREATEGUID</strong>), each notification will not be overwritten, which is what we want. This is shown in Figure 3. But after you see the notification, you may decide to decrease the quantity in the sales line. At that point, the notification should be recalled. To do that, we need a way to track the notifications and their IDs.</p>
@ -262,8 +262,8 @@
<ol>
<li>We have a temporary object with a partially complete ID. Something like: Sales Line, 1000, “”.</li>
<li>We send a notification caused by this object (item out of stock).</li>
<li>The temporary table receives NotificationId, empty record Id (Quote, “"), additional context (item out of stock).</li>
<li>When the user leaves the field, the line is inserted. We replace the empty record ID (Quote, “") by the full record ID (Sales Line, 1000, 10000).</li>
<li>The temporary table receives NotificationId, empty record Id (Quote, “”), additional context (item out of stock).</li>
<li>When the user leaves the field, the line is inserted. We replace the empty record ID (Quote, “”) by the full record ID (Sales Line, 1000, 10000).</li>
<li>We recall the notification (the user put a lower quantity for example).</li>
<li>We search for records with the full record ID and the additional context (item out of stock).</li>
<li>If found, they are recalled. </li>