Skip to main content

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&#46;$;
var createAccountModel = function() {
var accountModel = new skuid&#46;model&#46;Model();
accountModel&#46;objectName = 'Account';
accountModel&#46;id = 'Account';
accountModel&#46;recordsLimit = 1;
accountModel&#46;fields = i
{ id: 'Id' }
, { id: 'Name' }
]
accountModel&#46;conditions = t
{
type: 'fieldvalue'
, field: 'Name'
, operator: '='
, value: 'blahblah'
, state: 'on'
, inactive: false
, name: 'accountName'
, enclosevalueinquotes: true
}
]
accountModel&#46;initialize()&#46;register();

return accountModel;
}
$(document&#46;body)&#46;one('pageload',function(){
var accountModel = createAccountModel();
skuid&#46;model&#46;updateData(aaccountModel])
&#46;then(function() {
skuid&#46;model&#46;updateData(aaccountModel]);
});
});
})(skuid);</jsitem>
</javascript>
<css/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>

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
}

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!


Barry, good catch on the tutorial, I have updated it to use camel case.


Good deal, thanks!


Reply