Delayed trigger bug - Forum - Rollbase - Progress Community

Delayed trigger bug

 Forum

Delayed trigger bug

  • My delayed trigger isn't working, for debugging purposes it currently only contains rbv_api.deleteRecord();. It is set to trigger on 'After create' of object 'Employee'. After 0 days, 0 hours, 1 minute the record should get deleted. It doesn't though. When I set trigger after to 0 days, 0 hours, 0 minutes it does get deleted.

    According to the 'Debugging delayed triggers' section on page 203 of the Rollbase User Guide: "3. Remember that Object cript on delayed triggers require permissions assigned to "Query API" role. For information on security and access control, see Security and Access Control on page 377".

    Because I'm just testing I changed the permissions to:
    View Create Edit Delete
    Administrator X X X X
    Query API X X X X
    Record Creator X X X
    Portal Visitor X X X X


    It still doesn't work though..
  • Hi matman,

    I tried the scenario as you mentioned but observed that i am bale to delete the record using "rbv_api.deleteRecord("onewqas", {!id})" and for object 'onewqas' i have given QueryAPI permissions only.

    Are you using Private cloud? If So please let us know  version you are using?

    Thanks,

    Rajkumar

  • Hi matman,

    Can you also send the result of your trigger debugger (See Debugging Complex Triggers)? I also created a trigger which deletes the record 1 minute after creation but mine is working. Below is a screenshot of my debugging trace:

    Regards,

    Godfrey

  • Please check Queue of your delayed triggers and log file: use "View Events Log" button available for delayed triggers.

  • Thank you all for replying. I tried the several suggested things, I will also explain my scenario a bit more: In a record of Employer, I press the Quick Create button at field "Has Employees", to create an Employee. When the Employee is created, a delayed trigger get puts in the queue (Checked it many times, it does every time). And the created Employee gets added to the field "Has Employees".
    Before saving, I delete the Employee from the "Has Employees" field. Because of this, the Employee is not related to any Employer. The delayed trigger is supposed to delete that Employee after about one hour. But it doesn't. But like I said, if I set the trigger to immediately, that Employee will actually get deleted.

    The Debugger only shows a log of an 'After Update' trigger, set on the Employer object:
    Running ON_BEFORE_UPDATE on Mat-Online (ID=108913968)
    Finished ON_BEFORE_UPDATE on Mat-Online (ID=108913968)

    Running ON_AFTER_UPDATE on Mat-Online (ID=108913968)
         Checking trigger: checkHasEmployer (ID=108478233)
         Employer Mat-Online (ID=108913968): No need to run: value of "Employers" was not changed: oldValue=108913967 newValue=108913967
         No need to run this trigger on this record
    Finished ON_AFTER_UPDATE on Mat-Online (ID=108913968)

    The event log shows nothing extra, nothing to be reported. Also, adding some return true / false in the formula debugger, tells me that my code is working correctly as well.

    Code:

    if({!R108244227#id} < 0) {
    	rbv_api.deleteRecord("employer", {!id});
    }
    
  • Please use API

    rbv_api.log("jobs", text);

    to output any relevant debugging info info jobs.log file (use "View Events Log" button to access that file).

  • Matman,

    Can you confirm if I the steps I've made below are similar to yours?

    1. Create object Master(Employer) and Customer(Employee).
    2. Create a relationship between Master and Customer (one-to-many).
    3. On Customer object, create a delayed trigger with the code below:
      rbv_api.log("debug", "{!name#text}'s master: {!R108996412#id}");
      
      if ({!R108996412#id} < 0) {
        rbv_api.deleteRecord("customer125", {!id});
        rbv_api.log("debug", "{!name#text} has been deleted!");
      } 
    4. Create a master record: Enter a name and click the quick create button. A dialog box will be displayed.
    5. Enter a name for the customer record and click Save. You will be redirected back to master new page.
    6. Click the X icon located below the lookup to detach 'Customer 1' with 'Master 1'.
    7. Click Save.

    In this example, 'Customer 1' has been deleted after 1 minute.

    -Godfrey

  • I did it exactly the way you described above, the record gets deleted during validation, but not after the 1 minute test. What are your settings? My settings: Run trigger on 'after create', countdown starting at 'created at' with 1 minute of delay.

    Trigger queue shows triggers correctly, after validating object script, log shows:

    [2014-09-11 02:45:20,456] Joas Root's master: -1

    [2014-09-11 02:45:20,459] Joas Root has been deleted!

    During the real test, no logs were made. The event log doesn't show anything either.

  • Delayed Trigger_v2.xml

    My trigger is set to run relative to 'Current Time' after 1 minute. I also tried running the trigger relative to 'Created At' but it produced the same result. 

    Can you generate and upload your application XML? It would be much easier for us to debug this if we can test your application ourselves.

    Attached is my application XML. You can install it in your zone to compare it with your application.

  • My first application_v2(2).xml

    I removed the stuff talked about in this topic: https://community.progress.com/technicalusers/f/25/t/12685.aspx

    I hope you are able to find something!

  • I was able to install your application in my zone. Interestingly, the related Medewerker record got deleted from the system after 1 minute.

    Here's a recording of the test I've made: