Unique Field Combination Trigger - Picklist field

Posted by IramK on 24-Jun-2015 11:20

Hello,

I have two objects A and B related to each other (m-M) and I would like to carry out a unique field combination trigger on a picklist in the Grid control of object B (edit page). So lets say my values in the picklist are: 1,2,3,4,5 and I would like all the values to be unique when I edit record A (that contains object B's grid control). When I perform a unique field combination trigger, the record gets saved without throwing an error and on the trigger "Debug" window I get a message saying:

Running Unique Field Checker on Object B: Object B (ID=551824)
Error executing Trigger: "Unique Field Checker" Field needs to be unique.

Any suggestions on why this is happening? Kindly let me know.

Cheers.

Posted by Godfrey Sorita on 25-Jun-2015 08:51

Yes - since the comparison is NOT based on the form data, unique field combination will not wok in this situation. I tested the validation with the same unique field combination.

You can use Rollbase APIs and Javascript as a workaround to this limitation. First, construct a function which will loop to all grid items and compare values to the row which is being modified. If a duplicate is found, you can send an alert and disable the submit button. Then, bind the function to the grid control's onUpdate event. This will allow the function to fire whenever a grid cell is updated. 

The Grid Control APIs are discussed in this section of the documentation: documentation.progress.com/.../index.html

All Replies

Posted by Godfrey Sorita on 24-Jun-2015 13:10
Hi Iram,

What are the selected fields in your Unique Fields Combination Trigger? I don't recommend using this approach as the combinations are being compared to the data stored in the DB, not the current combinations in the Grid Control.

I can't replicate the error using the trigger debugger. Are you using a formula/code in your trigger?


Regards,
Godfrey
Posted by IramK on 25-Jun-2015 03:17

The selected fields in my unique fields combination trigger are:

1) The record name itself (which is always the same for every record i.e. Object B)

2) The picklist control - that contains 1,2,3,4,5

I am not using any formula or code in my trigger. So does that mean the unique field combination trigger does not work on a grid control in this situation? If so, how can I carry out the validation on the grid control picklist fields and error when the user tries to save the record A? Kindly let me know.

Cheers.

Posted by Godfrey Sorita on 25-Jun-2015 08:51

Yes - since the comparison is NOT based on the form data, unique field combination will not wok in this situation. I tested the validation with the same unique field combination.

You can use Rollbase APIs and Javascript as a workaround to this limitation. First, construct a function which will loop to all grid items and compare values to the row which is being modified. If a duplicate is found, you can send an alert and disable the submit button. Then, bind the function to the grid control's onUpdate event. This will allow the function to fire whenever a grid cell is updated. 

The Grid Control APIs are discussed in this section of the documentation: documentation.progress.com/.../index.html

Posted by IramK on 26-Jun-2015 09:06

That works.. it would be great if the unique field combination trigger worked for grid controls as well in the situation described above.

Posted by IramK on 13-Oct-2015 11:15

Has this been fixed in the latest release i.e. 4.0.2.0?

This thread is closed