Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

SlxMobile 3 and removal of fields from Opp Creation throwing JS errors

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?

Highlighted
Gold Super Contributor
Posts: 3,087
Registered: ‎03-19-2009

Re: SlxMobile 3 and removal of fields from Opp Creation throwing JS errors

Use "hide"....

    type: 'hidden'

--
RJ Ledger - rjledger@rjlSystems.net +1 603.369.3047 x101

".. Innovators in Mobility - Experts in Workflow Automation..."
http://www.rjlSystems.net - blog: www.rjlSystems.net/blog.html
Highlighted
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: SlxMobile 3 and removal of fields from Opp Creation throwing JS errors

[ Edited ]

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.

Highlighted
Copper Super Contributor
Posts: 172
Registered: ‎07-06-2010

Re: SlxMobile 3 and removal of fields from Opp Creation throwing JS errors

[ Edited ]

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?

Highlighted
Bronze Super Contributor
Posts: 152
Registered: ‎02-01-2011

Re: SlxMobile 3 and removal of fields from Opp Creation throwing JS errors

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.

Andy Freeman
TrellisPoint, LLC