Announcement

Collapse
No announcement yet.

Recalculate Totals After Deleted Record Triggers Delete Signal in BPM

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Recalculate Totals After Deleted Record Triggers Delete Signal in BPM

    So I've added a credit memo module. The goal is for me to give my clients credit for various reasons. When I create a credit it will automatically recalculate the related invoice totals. That part works great. But if I decide to remove a credit I prefer to delete the credit completely from the system. When I delete the credit then it needs to recalculate the related invoice totals. My issue is once the credit is deleted then you cant access the credit record attributes such as the related invoice id any longer. Does anyone know a way around this to where I can delete the credit but still recalculate the related invoice totals?

  • #2
    i think you need to use a Script Task to grab the deleted credit id (using deleted, 1) and then you can find the related invoice id to do your calculation.

    Comment


    • dodom2
      dodom2 commented
      Editing a comment
      Thank you Rabii. I dont understand exactly. So I can get the ID of the deleted record but once that record is deleted you can't access the attributes to know my knowledge. So how can I access the invoice id that you mention?
      Last edited by dodom2; 12-30-2022, 05:55 PM.

  • #3
    i think you can try using a Script Task and use code below:

    Code:
    $creditId = record\findOne('Credit', 'createdAt', 'desc', 'id=', id, 'deleted', true);
    Once you have the creditId then you can find related invoice and perform any logic you need.

    Thanks

    Comment

    Working...
    X