Run Update Field Value Trigger in a Grid Control

Posted by IramK on 09-Jan-2015 06:33

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?

Posted by IramK on 09-Jan-2015 10:21

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

Posted by matman on 09-Jan-2015 07:19

Hi Iram,

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

Posted by IramK on 09-Jan-2015 07:53

Yes that's correct.

Posted by matman on 09-Jan-2015 08:01

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.

Posted by IramK on 09-Jan-2015 08:11

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?

Posted by matman on 09-Jan-2015 08:16

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?

Posted by Gian Torralba on 09-Jan-2015 10:09

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

Posted by matman on 09-Jan-2015 10:16

[mention:c5dec1ce5a5948c5a25cf4bcaeb7db77:e9ed411860ed4f2ba0265705b8793d05] "After Create" and "After Update" triggers do trigger on Grid records, right?

Posted by IramK on 09-Jan-2015 10:21

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.

Posted by Gian Torralba on 09-Jan-2015 10:24

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

Posted by matman on 09-Jan-2015 10:30

Alright, thanks!


[mention:19aa761d6eff491bb43da3a9faf25681:e9ed411860ed4f2ba0265705b8793d05] does that mean you found a solution?

Posted by IramK on 09-Jan-2015 11:03

Yes I did as I mentioned.

Posted by pvorobie on 09-Jan-2015 16:16

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

This thread is closed