Skip to Content
0

Problems getting the ShellHash

Apr 27, 2017 at 01:33 PM

27

avatar image

Hello all,
I am having problems getting the current shell hash. In principle, I should be able to get want I want using the service sap.ushell.Container.getService("URLParsing"), but I'm encountering difficulties getting the app specific part.

Consider the code;

var oURLService = sap.ushell.Container.getService('URLParsing');
var sShellHash = oURLService.getShellHash(document.URL);
var oShellHash = oURLService.parseShellHash(sShellHash);

If the document URL is "TheThing-theAction?fld=1", oShellHas looks like this;

{ semanticObject: "TheThing",  action: "theAction",  contextRaw: undefined,  params: {fld: ['1']},  appSpecificRoute: undefined}

The fld and '1' can be found in the paramaters

But if the URL is in a standard Fiori form like this;

LeaveRequest-manage&/detail/C81F66DA90A51ED785CA61B693549534

The getShellHash function returns "LeaveRequest-manage" so the parseShellHash obviously does not have the detail.

I could try to get the "/detail/C81F66DA90A51ED785CA61B693549534" by splitting the document.URL, but I'd prefer to use a more standard approach.

Can someone recommend a tidy way of extracting the part after the ampersand?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers