- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2016 11:48 AM
I'm trying to fix an issue we've had since our implementation last fall.
I'm dealing with a catalog item with a Module multiple choice variable with six options. We each option is selected, a UI policy displays the correct check boxes, anywhere from 1-26 of them, depending on the Module selected. When Module changes, the check boxes from the previous selection are hidden; however, they are not cleared. This is resulting in incorrect data in the database, in reports, and in notifications. I've tried putting a script in the UI policy as below, and have also tried calling a UI script from the UI policy, passing in the name of the module, and doing the work in the UI Script. I can get the check boxes to clear fine, but it disrupts the Reverse if False in the UI policy and the check boxes are not hidden. A portion of the code I'm using follows. As stated, the same code has been attempted within the UI Policy and from a UI Script. I just can't get the check boxes to clear and hide as required. Anyone know of a better method of accomplishing what I need to do or what I'm doing wrong below.
The UI Policy on each of the six module selections are as follows. All have Reverse if False set to true.
Read Only - Leave Alone - Mandatory - Leave Alone - Visible True (these are all the same for every checkbox, whether 1, 26, or somewhere in between.
function onCondition() {
function ClearRoles(TheArray) {
for (var j = 0; TheArray.length; j++) {
if (g_form.getValue(TheArray[j]) != '')
g_form.setValue(TheArray[j], ''); //have also tried g_form.clearValue()
}
}
var SuRoles = new Array('agis_superuser', 'ap_superuser', 'ar_superuser', 'ce_cash_management_superuser', 'fa_superuser', 'gl_agis_pa_fa_superuser', 'om_superuser', 'pa_superuser', 'po_superuser');
var TaxRoles = new Array('hq_tax_analyst', 'hq_tax_business_analyst', 'tax_manager');
ClearRoles(SuRoles);
ClearRoles(TaxRoles);
}
Each element of each array is a checkbox. Not all are represented above.
I've also attempted doing a .join() to pass all checkbox values as one array without success.
One thing I would like to be able to do is to have access to current and previous. I would then know the previous value and could limit the checkboxes I need to clear to the previously selected module. I tried calling a script include from the UI Policy to do so but I don't think the two play well together.
Any ideas or suggestions at all would be greatly appreciated.
Jon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2016 02:07 AM
Hi Jon,
It looks to be an issue with the loop statement.
Instead of:
for (var j = 0; TheArray.length; j++) {
try
for (var j = 0; j < TheArray.length; j++) {

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2016 11:52 AM
Jon,
You can use scripting in UI policy and set your check box variables to false when they does not satisfy your conditions.
g_form.setValue('checkbox variable name',false);
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2016 02:07 AM
Hi Jon,
It looks to be an issue with the loop statement.
Instead of:
for (var j = 0; TheArray.length; j++) {
try
for (var j = 0; j < TheArray.length; j++) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2016 08:30 PM
Thanks Anthony, I wish we sat in the same room so you could reach over and slap me. Amazing how something so obvious can be overlooked. The good Lord should have given us a second set of eyes...
I appreciate the virtual slap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2017 09:25 AM
I know this is a year old, but you helped me out of the same jam due to almost the exact same issue. Thanks!!