Run Update Field Value Trigger in a Grid Control - Forum - Rollbase - Progress Community

Run Update Field Value Trigger in a Grid Control

 Forum

Run Update Field Value Trigger in a Grid Control

This question is answered

Hello,

I am trying to update the field value of a field in a grid control with a value from another field in the same grid control and I would like to do that using Triggers. Is there a way I could do this?

Verified Answer
  • The trigger works for all rows on submission but yeah not on individual ones. For individual ones, I've used the onUpdate call where I can specify the grid number and row number and then update the ones I need.

All Replies
  • Hi Iram,

    Could you explain your situation a bit more? Do you want to update the field when you press the Save button?

  • Yes that's correct.

  • I guess I would do that the following way: Create an Update Field Value trigger and set timing to After Create and After Update. Give the trigger a name and select the On field change (the field that will trigger the trigger). Now select the Field to Change. In the Change Value Formula, put the code that generates the new value of the field. (Make sure to return that value.) Now press save, if everything went correctly your field should now update.

  • It doesn't take in the grid row? Is there a way I could specify that? Or I can only use the OnUpdate function available when configuring the Grid Control?

  • Hi Iram,

    The trigger runs when you press the Save button. When you press Save Rollbase which grid records changed and will run the trigger on those records. The server doesn't use the grid row numbers to see whether the related records had been updated.

    Have you tested the trigger?

  • Hello,

    What you can do is create a trigger with an "on finalize" timing in the parent record and then try to navigate the created child records by using Query API and update the child record using rbv_api.setFieldValue().

    Thank you,
    Gian
  • "After Create" and "After Update" triggers do trigger on Grid records, right?

  • The trigger works for all rows on submission but yeah not on individual ones. For individual ones, I've used the onUpdate call where I can specify the grid number and row number and then update the ones I need.

  • Hello,

    Running an "after update/create" trigger in the parent will not guarantee that child records are created since the parent record is the first to be created. Adding the "after update/create" in the child grid records will not guarantee that it will affect other child records since the hierarchy of creation/update might be different.

    Thank you,
    Gian
  • Alright, thanks!


    does that mean you found a solution?

  • Yes I did as I mentioned.

  • Please consider using "on finalize" timing option for your trigger.