enclosevalueinquote condition parameter remoting exception (Banzai 7.12)

Barry SchnellBarry Schnell 💎💎
edited March 2, 2017 in Questions
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:
image


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>

Comments

  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN 💎💎💎
    edited March 2, 2017
    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 :

    image 


    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
                }
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Hey Zach -

    Thanks for explaining this and sorry for not testing in 6.x before I posted, I should have verified.  Awesome that Banzai improves the error handling/messaging in this type of scenario!

    I haven't done much work with client side models so was basing my post on the article at http://help.skuidify.com/m/11720/l/228794-dynamic-creation-of-models-and-components-with-javascript which has enclosevalueinquotes in all lower case.  If possible, likely worth updating the info there to camelCase.

    Thanks again!
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN 💎💎💎
    edited December 21, 2016
    Barry, good catch on the tutorial, I have updated it to use camel case.
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Good deal, thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!