Tuesday, October 30, 2012

Salesforce - Unable to uninstall package due to page layouts

Uninstalling a package from a Salesforce org failed recently due to references from profiles to page layouts.

Unable to uninstall package
This installed component is referenced by a locally created component. System Administrator
Unable to uninstall package

It is possible to remove this mapping by following the link to the profile and changing the page layout assignments for the affected objects.

Alternatively, I found it quicker to manually remove the page layout and use the replacement screen provided by Salesforce.

App Setup > Customize > Accounts > Page Layouts > Page Layout Name : Del

Then use the page layout replacement screen to reassign any references to a remaining page layout.

Wednesday, October 24, 2012

Changing the Windows Store Market

I recently published an app to the Windows Store and was puzzled why I couldn't find it in the Store to install from other machines.

When I published the app I restricted it to the New Zealand market. Turns out my current Windows 8 language settings were sending me to the wrong store.

  • Go to the Control Panel under the Settings charm.
  • In the Control Panel, click on Clock, Language, and Region.
  • Click on 'Add a language'
  • [Optionally] in the opened Window again click on 'Add a language' to add your language to Windows. (Ignore this step if you already have the required language)
  • Move the language the corresponds to the required store to the top of the list. Making it your primary language.
  • Back at Clock, Language, and Region, click on 'Change location' and select the location from the drop-menu and then click on OK.

Sunday, October 21, 2012

Debugging a WinRT background task

With Windows Phone 7 apps I often used ScheduledActionService.LaunchForTest to make background agents run quickly when debugging so I didn't need to wait 15 minutes before they would fire.

With WinRT you can now trigger the Background Task directly from Visual Studio. To do so:

  • Bring up the Debug Location toolbar. Right click somewhere in an empty toolbar if you can't find it.
  • Trigger the code that registers the background task.
  • Click the dropdown next to suspend and select the class that the background task runs.

See also:

Wednesday, October 17, 2012

DEP0700 : Registration of the app failed. Windows cannot install package

The following error appeared in Visual Studio when trying to run the Bing Maps SDK examples:

Error : DEP0700 : Registration of the app failed. Windows cannot install package 133E2AEE-177A-43F4-BB19-4A6CCA8BD2CA because the package requires architecture ARM, but this computer has architecture x64. (0x80073cf3) PushpinSample

The fix was simple enough. Change the Platform from ARM to x64 in the Configuration Manager.

Tuesday, October 16, 2012

Salesforce Save error: Illegal assignment from Decimal to Long

A very simple type conversion error occurs in Apex when trying to implicitly cast from a Decimal (an arbitrary precision number) to a Long (A 64-bit number that does not include a decimal point).

Save error: Illegal assignment from Decimal to Long

I noticed some inherited code was solving the issue by converting via an intermediate String. Using the dedicated Decimal.longValue() was a bit cleaner.

Decimal testDecimal = 123.0;
Long convertedDecimal = testDecimal; // results in "Illegal assignment from Decimal to Long"

// Conversion via a string works, but is a bit ugly
Long conversionViaString = Long.valueOf(String.valueof(testDecimal));
System.assertEquals(123, conversionViaString);

// Direct conversion using dedicated Decimal method
Long directLongConversion = testDecimal.longValue();
System.assertEquals(123, directLongConversion );

Tuesday, October 9, 2012

Salesforce Save error: Entity is not org-accessible

The following line of Apex attempting to pull the more recent ApexPages Message produced an error I haven't encountered before. What made it particularly confusing was the lack of a line reference in the error.

Message mostRecentMessage = ApexPages.getMessages().get(ApexPages.getMessages().size() - 1);
Save error: Entity is not org-accessible

Changing is as follows resolved the issue (Note the ApexPages.):

ApexPages.Message mostRecentMessage = ApexPages.getMessages().get(ApexPages.getMessages().size()-1);

If you encounter the same error check the most recently changed lines for incorrect class references, such as a spelling mistake, a missing classname or __c suffix.