01-08-2014 11:40 AM
In a Mobile 3 install I'm getting the following from Chrome:
"Cannot call method 'setCurrencyCode' of undefined"
Which points to this in Edit.js
this.fields['SalesPotential'].setCurrencyCode(App.getBaseExchangeRate().code);
It appears this is because I've removed the SalesPotential field; we calculate this based off a number of other values instead of using one textbox.
I have also removed Status, which throws a similar error on a different method.
Opps save correctly otherwise, but the GUI shows the loading animation at the top of the browser window.
My removal code is pretty vanilla:
this.registerCustomization('edit', 'opportunity_edit', { at: function (row) { return row.name == 'SalesPotential'; }, type: 'remove' });
How do I correct this without re-adding the fields I want removed?
01-08-2014 12:11 PM
01-08-2014 12:38 PM - edited 01-09-2014 05:56 AM
hidden didn't work. In Chrome the field was still displayed.
For example, I tried to use "hidden" as the type under Contact to remove the CuisinePreference row. It didnt hide until I used remove.
My bad, clearly the documentation says hidden (now that I found where to look), I think its just a caching problem. I'll try again. Thanks.
01-09-2014 06:09 AM - edited 01-09-2014 06:09 AM
So I've changed it to this:
this.registerCustomization('edit', 'opportunity_edit', { at: function (row) { return row.name == 'SalesPotential'; }, type: 'hidden' });
Which still has not hidden the region (why I thought it wasn't working at first). It's not cached; the above is taken straight out of Dev Tools in Chrome when the page loads. If I change type to remove it is stripped from the page but the JS error returns. Is my syntax correct?
03-07-2014 11:22 AM
Here's what I added to my RegisterCustomizations for opportunity:
var setValuesOverrideMixin = { setValues: function(values) { this.inherited(arguments); var nodes; if (App.hasMultiCurrency()) { if (values && values.ExchangeRateCode) { this.fields['ExchangeRateCode'].setValue({'$key': values.ExchangeRateCode, '$descriptor': values.ExchangeRateCode}); } if (!App.canLockOpportunityRate()) { this.fields['ExchangeRateLocked'].disable(); } if (!App.canChangeOpportunityRate()) { this.fields['ExchangeRate'].disable(); this.fields['ExchangeRateCode'].disable(); } this.fields['ExchangeRateDate'].disable(); } //this.fields['SalesPotential'].setCurrencyCode(App.getBaseExchangeRate().code); } }; Mobile.SalesLogix.Views.Opportunity.Edit.extend(setValuesOverrideMixin);
In the above, the entire SetValues method is copied from the stock app and the .setCurrencyCode method line is commented out.
At first I used "type: 'remove'" with SalesPotential and I started getting errors (or rather, just a blank screen with the unhelpful message net::ERR_FAILED in the dev console). A null check would've been nice.