Mandatory Checkbox variable on Catalog Item prevents submission in Service Portal after "Rome Patch 7" upgradeDescriptionWhen submitting a Catalog item having a mandatory checkbox variable, the catalog item will provide a prompt mentioning there is a mandatory field. Checking the checkbox and submitting again, which should fulfill the requirement, instead provides this message --> "The following fields contain errors: <checkbox_question>"Steps to Reproduce ---------------------------------------------------- Create the Service Catalog Item ----------------------------------------------------1. Create a sc_cat_item by going to sc_cat_item_list.do and click New2. Fill in the following information:Name: (Choose a name)Catalogs: Service catalogCategory: SoftwareShort Description: (Same as name)Click Submit3. Create a New Variable: Type: CheckboxQuestion: (Give it a unique name)Name: Should auto populateSelection Required: Set to trueSubmit---------------------------------------- Reproducing the issue ----------------------------------------4. Go to Service Portal and search for the catalog item created5. Click on "Order Now" button to submit the request (You will get "Some fields are incomplete" message at the top6. Check the required field and click "Order Now" button again to submitYou get an error message: "Following field contains an error"Expected Behavior:Should be able to submit the Order once checking the manditory boxActual Behavior:Get the error: "Following field contains an error" when trying to order the catalog itemWorkaroundThis issue is fixed in Sand Diego and current track. Issue is only reproduced in RP7 and RP8, issue is targeted to be fixed in RP9. Issue only occurs with checkbox questions Below is a workaround for this issue. This are two kinds of workaround for this issue, use any one of the workaround which suits you Method 1 In this method there are three major areas of impact where some code has to be changed Catalog ItemOrder GuideMulti Row variable set In this method changes are made in cloned widgets of Catalog Item, Order Guide and an onLoad client script in MRVS Since we are changing the widget code itself, in this method we don't need to make change per Catalog Item/Order Guide which has checkbox variable. Once the change is done it will work across all items/guides However, an onLoad client script has to be added to each actively used MRVS which has checkbox variable For Catalog Item 1. Clone `SC Catalog Item` widget. 2. Open the cloned widget in Editor (in service portal) 3. In client script, find the line `spSCNavStateManager.isPreview(c.data.isPreview);` probably line no 477 or 478 4. After that line paste below code (also attached as txt file) overLoadCheckboxValueProp(g_form);function overLoadCheckboxValueProp(g_form) { var fieldNames = g_form.getFieldNames(); for (var fn in fieldNames) { var field = g_form.getField(fieldNames[fn]); if (field && field.type == 'boolean') { Object.defineProperty(field, "value", { set : function (value /* True-False */) { this._value = value; var parent = g_form.getField(this._parent); if (parent && typeof parent.isInvalid != 'undefined' && parent._mandatory) { if (_isCheckboxGroupMandatorySatisfied(parent, g_form)) parent.isInvalid = false; else parent.isInvalid = true; } }, get : function () { if (typeof this._value == 'undefined') { this._value = this.stagedValue; } return this._value || 'false'; }, configurable: true }); } }} function _isCheckboxGroupMandatorySatisfied(field, g_form) { for (var i=0; i<field._children.length; i++) { var child = g_form.getField(field._children[i]); if (!( child.value == "false" || child.value == "")) return true; } return false;} 5. Save the widget. 6. Now use this cloned widget, which has the fix in `instance/sp?id=sc_cat_item` page 7. To do that (Ctrl + Right click) and Choose `Page in designer` 8. Find the container which has `SC Catalog Item` widget, remove it and replace with the cloned widget. For Order guide Here also we follow similar steps as what we did for Catalog item widget 1. Clone `SC Order Guide` widget. 2. Open the cloned widget in Editor (in service portal) 3. In client script, find the line `spSCNavStateManager.isNative($scope.data.isMEE);` probably line no 105 or 105 4. After that line paste below code (also attached as txt file) overLoadCheckboxValueProp(gFormInstance); // Notice the change in argument, its gFormInstance not g_formfunction overLoadCheckboxValueProp(g_form) { var fieldNames = g_form.getFieldNames(); for (var fn in fieldNames) { var field = g_form.getField(fieldNames[fn]); if (field && field.type == 'boolean') { Object.defineProperty(field, "value", { set : function (value /* True-False */) { this._value = value; var parent = g_form.getField(this._parent); if (parent && typeof parent.isInvalid != 'undefined' && parent._mandatory) { if (_isCheckboxGroupMandatorySatisfied(parent, g_form)) parent.isInvalid = false; else parent.isInvalid = true; } }, get : function () { if (typeof this._value == 'undefined') { this._value = this.stagedValue; } return this._value || 'false'; }, configurable: true }); } }} function _isCheckboxGroupMandatorySatisfied(field, g_form) { for (var i=0; i<field._children.length; i++) { var child = g_form.getField(field._children[i]); if (!( child.value == "false" || child.value == "")) return true; } return false;} 5. Save the widget. 6. Now use this cloned widget, which has the fix in `instance/sp?id=sc_cat_item_guide` page 7. To do that (Ctrl + Right click) and Choose `Page in designer` 8. Find the container which has `SC Order Guide` widget, remove it and replace with the cloned widget. For MRVS For MRVS we can't clone the widget, instead what can be done is to have a onLoad script on MRVS's having checkboxes This has to be done for all actively used MRVS which have checkbox variables 1. In the MRVS which has the checkbox, create an onload client script and and paste below code in the script section function onLoad() { overLoadCheckboxValueProp(g_form); function overLoadCheckboxValueProp(g_form) { var fieldNames = g_form.getFieldNames(); for (var fn in fieldNames) { var field = g_form.getField(fieldNames[fn]); if (field && field.type == 'boolean') { Object.defineProperty(field, "value", { set: function(value /* True-False */ ) { this._value = value; var parent = g_form.getField(this._parent); if (parent && typeof parent.isInvalid != 'undefined' && parent._mandatory) { if (_isCheckboxGroupMandatorySatisfied(parent, g_form)) parent.isInvalid = false; else parent.isInvalid = true; } }, get: function() { if (typeof this._value == 'undefined') { this._value = this.stagedValue; } return this._value || 'false'; }, configurable: true }); } } } function _isCheckboxGroupMandatorySatisfied(field, g_form) { for (var i = 0; i < field._children.length; i++) { var child = g_form.getField(field._children[i]); if (!(child.value == "false" || child.value == "")) return true; } return false; } } Note: onLoad script is not required of Single row variable set This fix will mark the valid/invalid property of the checkbox container properly. Remember to revert to the OOB `SC Catalog Item`/ `SC Order Guide` and remove onLoad scripts on MRVS once you upgrade to RP9 or higher Method 2 In this method we don't need to clone widget's but an onLoad client script has to be added for each `Catalog Item`, `Order Guide` and `MRVS` which have checkbox variable 1. Create an onLoad client script in `Catalog Item`, `Order Guide` and `MRVS` which have checkbox variable 2. Paste the code used in MRVS section of method 1 in the script Note: onLoad script is not required of Single row variable set Remember to remove onLoad scripts once you upgrade to RP9 or higherRelated Problem: PRB1560651