rbv_api.deleteRecord in trigger not deleting records when tr

Posted by spope-rollbase on 17-Apr-2015 02:09

This is giving me some grief.

Writing an app involving contracts > Contracted Vehicles > scheduled payments

Have a trigger that is supposed to  clear out current scheduled payments, and regenerate a payment schedule if any of the Schedule or expected payment amount fields are updated on the contracted vehicle record.

When the trigger runs as a triggered process it does not delete the current records (that are OK to delete), before regenerating the scheduled payments.

Introduced a scheduled payment  formula field to determine if there was any update to the record indicating we should keep the record “OktoDelete” Checkbox true/false..

Introduced a Contracted Vehicle Formula field which strings together all of the fields involved in determining a schedule of payments.

Changed from Button running  rbf_ createRecords to triggered process on update of the calculated field new trigger: CrtUpdPaymentSched..

Added field to scheduled payments to flag the first payments as a first payment record, and introduced logic so that if first payment still exists my new logic does not recreate a first payment.

First part of the updated trigger gets all the scheduled payments related to the contracted vehicle, and is supposed to delete any that are OK to delete, only problem is the delete does not appear to be working at all.

  • I have debugged this and the program is definitely getting in the section of code where it should be deleting the existing scheduled payment. – It just isn’t doing the deletes.
  • The println *** Deleting: currDeletes [k]is appearing where I expect it to..

Code snippet:

// Delete exisiting Records that are OK to delete

var currDeletes = rbv_api.getRelatedIds("R91199", {!id});                                     

var firstPaymentExists = false;

 

for (var k=0; k<currDeletes.length; k++) {

    var OkToDelete = rbv_api.getFieldValue("sched_cust_payment", currDeletes [k], "okToDelete");

    var isthisFirstPayment = rbv_api.getFieldValue("sched_cust_payment", currDeletes [k], "IsThisTheFirstPayment");

    rbv_api.println( typeof OkToDelete);

    rbv_api.println( "OK to Delete: " + OkToDelete);

    rbv_api.println("First Payment: " + isthisFirstPayment);

    rbv_api.println("currDeletes [k]: " + currDeletes [k]);

    if ( OkToDelete == true ) {

        rbv_api.deleteRecord("sched_cust_payment", currDeletes [k]);

        rbv_api.println("*** Deleting: currDeletes [k]: " + currDeletes [k]);

    } else {

        if ( isthisFirstPayment == true ) {

            firstPaymentExists = true;

            rbv_api.println("Keeping First Payment: " + currDeletes [k]);

        }

    }

}

 

I also retained my button, but changed it to run the above trigger  which is puzzling me.

  • This actually DOES delete the existing records as expected and then recreates a new payment schedule – as expected…
  • Only trouble with the button (as before) is that you don’t see the changes until after you do a screen refresh – clunky!
  • I tried building a screen refresh into the button logic, but it refreshed before any records are deleted / recreated….

The updated Button logic:

rbf_runTrigger("contracted_vehicle", {!Id}, "CrtUpdPaymentSched", true );

// Screen refresh

window.location.reload();

 

 

2 issues:

  1. Why isn't the trigger update of contract vehicle, deleting the existing scheduled payments; but the client side button running the same trigger code does work as expected???
  2. How do I get a client-side button to refresh after all of the updated have occurred??

(Apologies if this is a bit long, and if I have the ettiquette all wrong - First post to this forum, but won't be my last..)

 

Posted by spope-rollbase on 27-Apr-2015 16:22

All,

This issue was sorted by adding "on finalize" to the triggering conditions.

I had a TAB in the update screen allowing users to do grid update of the related records, that we are trying to recreate.

Posted by pvorobie on 27-Apr-2015 17:14

If you use input from Grid Controls - yes, you should use "on finalize" timing option. I hope this is clear from documentation.

All Replies

Posted by Sharavan Kumar on 17-Apr-2015 04:05

Hi ,

As I understand , at this step your trying to fetch the related record id's in 'currDeletes"

var currDeletes = rbv_api.getRelatedIds("R91199", {!id});  

In below step your trying to delete the related records , However your giving parent object name  "sched_cust_payment" , instead of related object name . Hence this will not delete the related records.

rbv_api.deleteRecord("sched_cust_payment", currDeletes [k]);

For deleting child object records please try - rbv_api.deleteRecord("child_objName", currDeletes [k]);

Scenario I tried :

created two objects customer and orders having M-M relationship. A record in customer object has 'n' related records of object orders. And on-update customer record , am deleting all the related records from orders object as shown below

// To get Relationship Id

var arr = rbv_api.getRelatedIds("R1585258", {!id});

for (var k=0; k<arr.length; k++) {

var id = arr[k];

rbv_api.println("id="+id);

rbv_api.deleteRecord("ssapinew1_orders", id);

}

rbv_api.setFieldValue("ssapinew1_customer",{!id}, "ssapinew1_orderrelatedid", id);

Here ssapinew1_customer is parent object and ssapinew1_orders is the child object.

please let me know if this works

thanks,

Sharavan

Posted by spope-rollbase on 19-Apr-2015 16:13

sched_cust_payment is my child object..

Parent object is a higher level table.

Posted by spope-rollbase on 19-Apr-2015 17:12

All,

Have been doing some more testing this morning, and it gets stranger!

(1) ** If I Edit a single field from a view of my Contracted Vehicle, then the trigger works as expected - deleting the existing records that are flagged as can be deleted, and then recreating scheduled payment records with the updated details.

(2) ** However, If I use the Edit button to update multiple fields, and then save I get the problem I logged; ie: Exisiting records are not deleted first.

(Also having intermittent issues with this process taking longer than 3000ms, and not completing... PITB! Does not appear to be related to my delete issue though, as Editing a single field results in all expected deletes occurring, but depending on how long it takes the process to complete it sometimes does not generate all of the expected scheduled payments. (This is logic (not shown) that follows the delete logic in the original issue post) - This is also going to be a major problem for me, as the 3000ms thing is not negotiable in the public cloud where I understand our client intends to run this app.)

Posted by spope-rollbase on 22-Apr-2015 16:30

Still wondering if anyone has any thoughts on what the problem might be, or how to solve it?

I'm not familiar with batch processes (yet) but I'm wondering if this needs to trigger a batch regeneration of the child records???

Posted by pvorobie on 22-Apr-2015 17:40

Are you saying that editing field using Inline Editing and editing whole record invoke different sets of triggers? Could you please provide output from Triggers Debugger to confirm that?

Posted by spope-rollbase on 23-Apr-2015 17:58

They are invoking the same trigger, but editing whole record causes the existing related records to be not deleted.

inline editing of 1 field, or running a button, that runs the same trigger code results in the related records being deleted as expected.

This is very strange. (For the short term I'm going to have to disable the trigger and rely on the button. (Still having problems with the updates taking longer than 3 seconds though - This is a very odd thing for any app to invoke - I'll process updates, but only for 3 seconds, leaving you in a state of uncertain data integrity..

Posted by pvorobie on 24-Apr-2015 11:32

Please attach output from Triggers Debugger

Posted by pvorobie on 24-Apr-2015 11:33

Also, how did you verified that related records were not deleted? Can you see these records in UI ?

Posted by spope-rollbase on 26-Apr-2015 20:47

Inline Editing of 1 field: (Works as expected.)

Triggers Debug Info

Debugging Info

Running ON_BEFORE_UPDATE on ABC126 (ID=91623)

Finished ON_BEFORE_UPDATE on ABC126 (ID=91623)

Running ON_AFTER_UPDATE on ABC126 (ID=91623)

 Checking trigger: CreateUpdatePaymentSchedule (ID=107051)

 Contracted Vehicle ABC126 (ID=91623): Need to run: value of "SchedUpdateFields" was changed: oldValue=12|Sun Apr 26 2015|Fri Mar 27 2015|804.0|402.0|M|0| newValue=13|Sun Apr 26 2015|Fri Mar 27 2015|804.0|402.0|M|0|

 Running CreateUpdatePaymentSchedule on Contracted Vehicle: ABC126 (ID=91623)

 Running VALIDATION_DELETE on 27/03/2015 (ID=124145)

 Finished VALIDATION_DELETE on 27/03/2015 (ID=124145)

 Running ON_BEFORE_DELETE on 27/03/2015 (ID=124145)

 Finished ON_BEFORE_DELETE on 27/03/2015 (ID=124145)

 Running ON_AFTER_DELETE on 27/03/2015 (ID=124145)

 Finished ON_AFTER_DELETE on 27/03/2015 (ID=124145)

 Running VALIDATION_DELETE on 26/04/2015 (ID=124146)

 Finished VALIDATION_DELETE on 26/04/2015 (ID=124146)

 Running ON_BEFORE_DELETE on 26/04/2015 (ID=124146)

 Finished ON_BEFORE_DELETE on 26/04/2015 (ID=124146)

 Running ON_AFTER_DELETE on 26/04/2015 (ID=124146)

 Finished ON_AFTER_DELETE on 26/04/2015 (ID=124146)

 Running VALIDATION_DELETE on 26/05/2015 (ID=124147)

 Finished VALIDATION_DELETE on 26/05/2015 (ID=124147)

 Running ON_BEFORE_DELETE on 26/05/2015 (ID=124147)

 Finished ON_BEFORE_DELETE on 26/05/2015 (ID=124147)

 Running ON_AFTER_DELETE on 26/05/2015 (ID=124147)

 Finished ON_AFTER_DELETE on 26/05/2015 (ID=124147)

 Running VALIDATION_DELETE on 26/06/2015 (ID=124148)

 Finished VALIDATION_DELETE on 26/06/2015 (ID=124148)

 Running ON_BEFORE_DELETE on 26/06/2015 (ID=124148)

 Finished ON_BEFORE_DELETE on 26/06/2015 (ID=124148)

 Running ON_AFTER_DELETE on 26/06/2015 (ID=124148)

 Finished ON_AFTER_DELETE on 26/06/2015 (ID=124148)

 Running VALIDATION_DELETE on 26/07/2015 (ID=124149)

 Finished VALIDATION_DELETE on 26/07/2015 (ID=124149)

 Running ON_BEFORE_DELETE on 26/07/2015 (ID=124149)

 Finished ON_BEFORE_DELETE on 26/07/2015 (ID=124149)

 Running ON_AFTER_DELETE on 26/07/2015 (ID=124149)

 Finished ON_AFTER_DELETE on 26/07/2015 (ID=124149)

 Running VALIDATION_DELETE on 26/08/2015 (ID=124150)

 Finished VALIDATION_DELETE on 26/08/2015 (ID=124150)

 Running ON_BEFORE_DELETE on 26/08/2015 (ID=124150)

 Finished ON_BEFORE_DELETE on 26/08/2015 (ID=124150)

 Running ON_AFTER_DELETE on 26/08/2015 (ID=124150)

 Finished ON_AFTER_DELETE on 26/08/2015 (ID=124150)

 Running VALIDATION_DELETE on 26/09/2015 (ID=124151)

 Finished VALIDATION_DELETE on 26/09/2015 (ID=124151)

 Running ON_BEFORE_DELETE on 26/09/2015 (ID=124151)

 Finished ON_BEFORE_DELETE on 26/09/2015 (ID=124151)

 Running ON_AFTER_DELETE on 26/09/2015 (ID=124151)

 Finished ON_AFTER_DELETE on 26/09/2015 (ID=124151)

 Running VALIDATION_DELETE on 26/10/2015 (ID=124152)

 Finished VALIDATION_DELETE on 26/10/2015 (ID=124152)

 Running ON_BEFORE_DELETE on 26/10/2015 (ID=124152)

 Finished ON_BEFORE_DELETE on 26/10/2015 (ID=124152)

 Running ON_AFTER_DELETE on 26/10/2015 (ID=124152)

 Finished ON_AFTER_DELETE on 26/10/2015 (ID=124152)

 Running VALIDATION_DELETE on 26/11/2015 (ID=124153)

 Finished VALIDATION_DELETE on 26/11/2015 (ID=124153)

 Running ON_BEFORE_DELETE on 26/11/2015 (ID=124153)

 Finished ON_BEFORE_DELETE on 26/11/2015 (ID=124153)

 Running ON_AFTER_DELETE on 26/11/2015 (ID=124153)

 Finished ON_AFTER_DELETE on 26/11/2015 (ID=124153)

 Running VALIDATION_DELETE on 26/12/2015 (ID=124154)

 Finished VALIDATION_DELETE on 26/12/2015 (ID=124154)

 Running ON_BEFORE_DELETE on 26/12/2015 (ID=124154)

 Finished ON_BEFORE_DELETE on 26/12/2015 (ID=124154)

 Running ON_AFTER_DELETE on 26/12/2015 (ID=124154)

 Finished ON_AFTER_DELETE on 26/12/2015 (ID=124154)

 Running VALIDATION_DELETE on 26/01/2016 (ID=124155)

 Finished VALIDATION_DELETE on 26/01/2016 (ID=124155)

 Running ON_BEFORE_DELETE on 26/01/2016 (ID=124155)

 Finished ON_BEFORE_DELETE on 26/01/2016 (ID=124155)

 Running ON_AFTER_DELETE on 26/01/2016 (ID=124155)

 Finished ON_AFTER_DELETE on 26/01/2016 (ID=124155)

 Running VALIDATION_DELETE on 26/02/2016 (ID=124156)

 Finished VALIDATION_DELETE on 26/02/2016 (ID=124156)

 Running ON_BEFORE_DELETE on 26/02/2016 (ID=124156)

 Finished ON_BEFORE_DELETE on 26/02/2016 (ID=124156)

 Running ON_AFTER_DELETE on 26/02/2016 (ID=124156)

 Finished ON_AFTER_DELETE on 26/02/2016 (ID=124156)

 Running VALIDATION_DELETE on 26/03/2016 (ID=124157)

 Finished VALIDATION_DELETE on 26/03/2016 (ID=124157)

 Running ON_BEFORE_DELETE on 26/03/2016 (ID=124157)

 Finished ON_BEFORE_DELETE on 26/03/2016 (ID=124157)

 Running ON_AFTER_DELETE on 26/03/2016 (ID=124157)

 Finished ON_AFTER_DELETE on 26/03/2016 (ID=124157)

 Running VALIDATION_CREATE on 03/27/2015 (ID=124158)

 Finished VALIDATION_CREATE on 03/27/2015 (ID=124158)

 Running ON_BEFORE_CREATE on 03/27/2015 (ID=124158)

 Finished ON_BEFORE_CREATE on 03/27/2015 (ID=124158)

 Running ON_AFTER_CREATE on 27/03/2015 (ID=124158)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 27/03/2015 (ID=124158)

   Scheduled Customer Payment 27/03/2015 (ID=124158): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 27/03/2015 (ID=124158)

 Running VALIDATION_CREATE on 04/26/2015 (ID=124159)

 Finished VALIDATION_CREATE on 04/26/2015 (ID=124159)

 Running ON_BEFORE_CREATE on 04/26/2015 (ID=124159)

 Finished ON_BEFORE_CREATE on 04/26/2015 (ID=124159)

 Running ON_AFTER_CREATE on 26/04/2015 (ID=124159)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/04/2015 (ID=124159)

   Scheduled Customer Payment 26/04/2015 (ID=124159): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/04/2015 (ID=124159)

 Running VALIDATION_CREATE on 05/26/2015 (ID=124160)

 Finished VALIDATION_CREATE on 05/26/2015 (ID=124160)

 Running ON_BEFORE_CREATE on 05/26/2015 (ID=124160)

 Finished ON_BEFORE_CREATE on 05/26/2015 (ID=124160)

 Running ON_AFTER_CREATE on 26/05/2015 (ID=124160)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/05/2015 (ID=124160)

   Scheduled Customer Payment 26/05/2015 (ID=124160): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/05/2015 (ID=124160)

 Running VALIDATION_CREATE on 06/26/2015 (ID=124161)

 Finished VALIDATION_CREATE on 06/26/2015 (ID=124161)

 Running ON_BEFORE_CREATE on 06/26/2015 (ID=124161)

 Finished ON_BEFORE_CREATE on 06/26/2015 (ID=124161)

 Running ON_AFTER_CREATE on 26/06/2015 (ID=124161)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/06/2015 (ID=124161)

   Scheduled Customer Payment 26/06/2015 (ID=124161): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/06/2015 (ID=124161)

 Running VALIDATION_CREATE on 07/26/2015 (ID=124162)

 Finished VALIDATION_CREATE on 07/26/2015 (ID=124162)

 Running ON_BEFORE_CREATE on 07/26/2015 (ID=124162)

 Finished ON_BEFORE_CREATE on 07/26/2015 (ID=124162)

 Running ON_AFTER_CREATE on 26/07/2015 (ID=124162)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/07/2015 (ID=124162)

   Scheduled Customer Payment 26/07/2015 (ID=124162): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/07/2015 (ID=124162)

 Running VALIDATION_CREATE on 08/26/2015 (ID=124163)

 Finished VALIDATION_CREATE on 08/26/2015 (ID=124163)

 Running ON_BEFORE_CREATE on 08/26/2015 (ID=124163)

 Finished ON_BEFORE_CREATE on 08/26/2015 (ID=124163)

 Running ON_AFTER_CREATE on 26/08/2015 (ID=124163)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/08/2015 (ID=124163)

   Scheduled Customer Payment 26/08/2015 (ID=124163): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/08/2015 (ID=124163)

 Running VALIDATION_CREATE on 09/26/2015 (ID=124164)

 Finished VALIDATION_CREATE on 09/26/2015 (ID=124164)

 Running ON_BEFORE_CREATE on 09/26/2015 (ID=124164)

 Finished ON_BEFORE_CREATE on 09/26/2015 (ID=124164)

 Running ON_AFTER_CREATE on 26/09/2015 (ID=124164)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/09/2015 (ID=124164)

   Scheduled Customer Payment 26/09/2015 (ID=124164): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/09/2015 (ID=124164)

 Running VALIDATION_CREATE on 10/26/2015 (ID=124165)

 Finished VALIDATION_CREATE on 10/26/2015 (ID=124165)

 Running ON_BEFORE_CREATE on 10/26/2015 (ID=124165)

 Finished ON_BEFORE_CREATE on 10/26/2015 (ID=124165)

 Running ON_AFTER_CREATE on 26/10/2015 (ID=124165)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/10/2015 (ID=124165)

   Scheduled Customer Payment 26/10/2015 (ID=124165): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/10/2015 (ID=124165)

 Running VALIDATION_CREATE on 11/26/2015 (ID=124166)

 Finished VALIDATION_CREATE on 11/26/2015 (ID=124166)

 Running ON_BEFORE_CREATE on 11/26/2015 (ID=124166)

 Finished ON_BEFORE_CREATE on 11/26/2015 (ID=124166)

 Running ON_AFTER_CREATE on 26/11/2015 (ID=124166)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/11/2015 (ID=124166)

   Scheduled Customer Payment 26/11/2015 (ID=124166): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/11/2015 (ID=124166)

 Running VALIDATION_CREATE on 12/26/2015 (ID=124167)

 Finished VALIDATION_CREATE on 12/26/2015 (ID=124167)

 Running ON_BEFORE_CREATE on 12/26/2015 (ID=124167)

 Finished ON_BEFORE_CREATE on 12/26/2015 (ID=124167)

 Running ON_AFTER_CREATE on 26/12/2015 (ID=124167)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/12/2015 (ID=124167)

   Scheduled Customer Payment 26/12/2015 (ID=124167): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/12/2015 (ID=124167)

 Running VALIDATION_CREATE on 01/26/2016 (ID=124168)

 Finished VALIDATION_CREATE on 01/26/2016 (ID=124168)

 Running ON_BEFORE_CREATE on 01/26/2016 (ID=124168)

 Finished ON_BEFORE_CREATE on 01/26/2016 (ID=124168)

 Running ON_AFTER_CREATE on 26/01/2016 (ID=124168)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/01/2016 (ID=124168)

   Scheduled Customer Payment 26/01/2016 (ID=124168): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/01/2016 (ID=124168)

 Running VALIDATION_CREATE on 02/26/2016 (ID=124169)

 Finished VALIDATION_CREATE on 02/26/2016 (ID=124169)

 Running ON_BEFORE_CREATE on 02/26/2016 (ID=124169)

 Finished ON_BEFORE_CREATE on 02/26/2016 (ID=124169)

 Running ON_AFTER_CREATE on 26/02/2016 (ID=124169)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/02/2016 (ID=124169)

   Scheduled Customer Payment 26/02/2016 (ID=124169): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/02/2016 (ID=124169)

 Running VALIDATION_CREATE on 03/26/2016 (ID=124170)

 Finished VALIDATION_CREATE on 03/26/2016 (ID=124170)

 Running ON_BEFORE_CREATE on 03/26/2016 (ID=124170)

 Finished ON_BEFORE_CREATE on 03/26/2016 (ID=124170)

 Running ON_AFTER_CREATE on 26/03/2016 (ID=124170)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/03/2016 (ID=124170)

   Scheduled Customer Payment 26/03/2016 (ID=124170): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/03/2016 (ID=124170)

 Running VALIDATION_CREATE on 04/26/2016 (ID=124171)

 Finished VALIDATION_CREATE on 04/26/2016 (ID=124171)

 Running ON_BEFORE_CREATE on 04/26/2016 (ID=124171)

 Finished ON_BEFORE_CREATE on 04/26/2016 (ID=124171)

 Running ON_AFTER_CREATE on 26/04/2016 (ID=124171)

   Checking trigger: Relate Payment to account (ID=91763)

   Running Relate Payment to account on Scheduled Customer Payment: 26/04/2016 (ID=124171)

   Scheduled Customer Payment 26/04/2016 (ID=124171): Creating relationship with Customer: IDs=87447

 Finished ON_AFTER_CREATE on 26/04/2016 (ID=124171)

Finished ON_AFTER_UPDATE on ABC126 (ID=91623)

Running ON_BEFORE_UPDATE on ABC126 (ID=91623)

 Already run these triggers

Finished ON_BEFORE_UPDATE on ABC126 (ID=91623)

Running ON_AFTER_UPDATE on ABC126 (ID=91623)

 Already run these triggers

Finished ON_AFTER_UPDATE on ABC126 (ID=91623)

Posted by spope-rollbase on 26-Apr-2015 20:52

Update of any number of fileds via whole screen edit: (This Does fore the trigger, but does not delete related records that should be deleted) - NOT working as expected.

Triggers Debug Info

Debugging Info

Running ON_BEFORE_CREATE on 09/26/2015 (ID=127618)

Finished ON_BEFORE_CREATE on 09/26/2015 (ID=127618)

Running ON_AFTER_CREATE on 26/09/2015 (ID=127618)

 Checking trigger: Relate Payment to account (ID=91763)

 Running Relate Payment to account on Scheduled Customer Payment: 26/09/2015 (ID=127618)

 Scheduled Customer Payment 26/09/2015 (ID=127618): Creating relationship with Customer: IDs=87447

Finished ON_AFTER_CREATE on 26/09/2015 (ID=127618)

Posted by spope-rollbase on 26-Apr-2015 20:57

You can see records via the UI.

If I do an inline edit of payment schedule fields on the Contracted vehicle record - all works OK.

If I do a screen level update of multiple fields, the existing records that should be deleted are not being deleted first.

Rest of the trigger is working as expected and generating a new set of scheduled payments which are visible in the UI.

It is like the existing related records are not visible to the trigger when you do a full screen edit of the Contracted vehicle fields.

Trigger is firing on update of a formula field that strings together several of the fields related top payment schedules.

Posted by pvorobie on 27-Apr-2015 11:13

I can see that ON_AFTER_DELETE triggers are being checked, Is this what you expect?

It would be helpful if you can come up with simple example demonstrating the problem.

Posted by spope-rollbase on 27-Apr-2015 16:22

All,

This issue was sorted by adding "on finalize" to the triggering conditions.

I had a TAB in the update screen allowing users to do grid update of the related records, that we are trying to recreate.

Posted by pvorobie on 27-Apr-2015 17:14

If you use input from Grid Controls - yes, you should use "on finalize" timing option. I hope this is clear from documentation.

Posted by pvorobie on 27-Apr-2015 17:15
Posted by spope-rollbase on 27-Apr-2015 17:21

Thanks. Rookie mistake - taken a long time to sort out.

One of my colleagues spotted the on finalize  in the documentation.

Posted by spope-rollbase on 27-Apr-2015 17:22

Thanks - Living with the PDF version open at the moment. (That and W3Schools Javascripting...) :)

This thread is closed