Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2015/gotchas-with-custom-apps-v2

Gotchas with custom apps, version 2

Published 19 January 2015
Updated 25 August 2016

A quick distraction from navigation patterns this week:

A while back I wrote a bit about issues with following the SDN instructions to create a new custom application on your Sitecore "start menu". Recently I responded to a Stack Overflow question about this issue, where after a bit of discussion I discovered that this didn't work quite the same way on Sitecore 7.5. So having investigated why, I figured I should write this up...

As discussed in the original post, SDN says there are two bits of data that need creating for a custom entry on the "start menu":

The application definition url copied!

When you navigate to `/sitecore/content/Applications` and create an instance of the `/sitecore/templates/Sitecore Client/Applications/Application` template you need to fill in the "Application" field with a path to the `.aspx` file for your application.

Intuitively you might type in a path like /layouts/MyApp.aspx - but clicking "save" after you've done that will make the value disappear again. You need to click the "Insert External Link" button to insert the path:

Add the application

Clicking save after this will work, and save the data. Under the surface, the raw value of the field will hold XML:

Application data

The start menu entry url copied!

Secondly, you have to add the "start menu" entry itself. You create the an entry in your preferred location under `/sitecore/content/Documents and settings/All users/Start menu` with the `/sitecore/templates/Sitecore Client/Applications/Application shortcut` template - and again have to fill in the "Application" field.

This time you're selecting a Sitecore item – so you'd expect to click the "Insert Link" button, and choose the item created above. But, as discussed in the previous blog post, when you do so you get an unexpected .aspx extension added to your link:

Add shortcut

Again, just editing the value here and clicking "save" won't save the change. And you can see why if you show raw values: An internal link is set up by default with an ID. Having fiddled about a bit it turns out that to get the right data into the field you need to do two things: First click the "Insert External Link" button and paste in the path to your target Application item into the URL:

Shortcut data

Click "ok" to create data for an external link. But for our shortcut to work it needs to be an internal link. So then secondly you need to modify this. I've found you can turn on the "raw values" view, and manually change the linktype attribute from "external" to "internal":

Shortcut data edit

You can then save the item, refresh the page and your custom start menu item will appear:

Resulting menu

However... url copied!

It's important to note that making this manual edit will make your start menu item appear, but it will also mean that the data is wrong from the perspective of the field editor buttons. If you click the "Insert External Link" button the popup's URL field will be empty. And also if you click the "Insert Link" button you'll get an error:

App error

So take care if you need to come back and edit this data again later...

↑ Back to top