enclosevalueinquote condition parameter remoting exception (Banzai 7.12)

  • 1
  • Problem
  • Updated 3 years ago
  • Not a Problem
  • (Edited)
It appears that 7.x has changed the case of the condition attribute enclosevalueinquotes from all lower case to camel case (encloseValueInQuotes). This causes an error for code (dynamic model creation) written against 6.x that uses all lowercase.

After calling updateData the first time, the model contains an property "enclosevalueinquotes" and "encloseValueInQuotes".  When calling updateData a 2nd time on a model, a remoting exception occurs regarding duplicate field.

Steps to Reproduce:
1) Create page using Sample XML below
2) Preview page
3) Check console window for error

Error:



Sample Page XML
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">   <models/>
   <components/>
   <resources>
      <labels/>
      <javascript>
         <jsitem location="inline" name="newInlineJS" cachelocation="false" url="">(function(skuid){
var $ = skuid.$;
var createAccountModel = function() {
   var accountModel = new skuid.model.Model();
   accountModel.objectName = 'Account';
   accountModel.id = 'Account';
   accountModel.recordsLimit = 1;
   accountModel.fields = [
       { id: 'Id' }
       , { id: 'Name' }
        ]
        accountModel.conditions = [
            {
                type: 'fieldvalue'
                , field: 'Name'
                , operator: '='
                , value: 'blahblah'
                , state: 'on'
                , inactive: false
                , name: 'accountName'
                , enclosevalueinquotes: true
            }
        ]
        accountModel.initialize().register();
        
        return accountModel;
}
$(document.body).one('pageload',function(){
   var accountModel = createAccountModel();
   skuid.model.updateData([accountModel])
       .then(function() {
           skuid.model.updateData([accountModel]);        
       });
});
})(skuid);</jsitem>
      </javascript>
      <css/>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
Barry,

Actually this dynamic Model creation fails in 6.x as well --- enclosevalueinquotes has always needed to be camel-cased when creating a Condition via JavaScript. The difference in Banzai is that we're now surfacing problems with Model updateData() and load() calls as Page Problems, whereas before the problems would have been surfaced either (a) in the debug property on a Model (b) in a Visualforce Remoting Exception, which is what this particular page XML that you're showing here is doing. When I run this page in a 6.x / Superbank org, I get the following Visualforce Remoting Exception in the Console, whose root error message is identical to what Banzai is now also (more helpfully and visibly) displaying as a Page Problem:

Superbank / 6.x :

 


So to fix this, in either Superbank or Banzai, you'll need to change to using camel-casing for encloseValueInQuotes:

           {
                type: 'fieldvalue'
                , field: 'Name'
                , operator: '='
                , value: 'blahblah'
                , state: 'on'
                , inactive: false
                , name: 'accountName'
                , encloseValueInQuotes: true
            }