How to get the value of a parameter from the url to pass on to the event handler
<p>I have a business requirement where in i am developing a sapui5 employee leave application deployed in HCP using cloud based sap webide tool.</p>

<p>Two types of employees will access this application using two different url with parameters either 'IT' or 'BPO':</p>

<pre><code>https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/IT

https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/BPO
</code></pre>

<p>Backend : I have developed a REST service which is giving me the employee details in jSON format when i do a GET request using the following url either for IT or BPO specific employees like:
/irc.com/ircit/empleave/rest/empleave/item/requestor/IT
or
/irc.com/ircit/empleave/rest/empleave/item/requestor/BPO
View: I have used a xml view MyRequest which will shows me requests from either IT or BPO in a tabular format.</p>

<p>And a Create view (XML view) with drop downs which is populated from a 'valueHelp' model and the page title etc changes based on the parameter which is either 'IT' or 'BPO'.</p>

<p>I have a create button in the footer of 'MyRequest' view which will call the Create view.</p>

<p>Requirement:</p>

<p>when i access the link
<a href="https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/IT" rel="nofollow noreferrer">https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/IT</a></p>

<p>I am getting all the requests for IT employees and same for BPO in the MyRequest view</p>

<p>But my requirement is in the same MyRequest view when i click the create button it should fetch the url parameter i.e either IT or BPO and navigate to the Create view with that url parameter so that i can set the valuehelp model and change the page title and name of ui components accordingly.</p>

<p>RouterConfiguration.</p>

<pre><code>"routes": [{
                    "pattern": "",
                    "name": "myRequests",
                    "target": "myRequests"
                }, {
                    "pattern": "IT",
                    "name": "IT",
                    "target": "myRequests"
                }, {
                    "pattern": "BPO",
                    "name": "BPO",
                    "target": "myRequests"
                }, {
                    "pattern": "create",
                    "name": "Create",
                    "target": "create"
                }, 

                {
                    "pattern": "/id={id}",
                    "name": "Display",
                    "target": "display"
                }
            ],
            "targets": {
                "myRequests": {
                    "viewName": "MyRequests",
                    "viewId": "myRequests",
                    "viewLevel": 1
                },
                "display": {
                    "viewName": "Display",
                    "viewId": "display",
                    "viewLevel": 2
                },
                "create": {
                    "viewName": "Create",
                    "viewId": "create",
                    "viewLevel": 2
                },
                "copy": {
                    "viewName": "Create",
                    "viewId": "create",
                    "viewLevel": 2
                },
                "notFound": {
                    "viewName": "NotFound",
                    "viewId": "notFound"
                }
            }
        }
    },
</code></pre>

<p>MyRequest controller</p>

<pre><code>onInit: function() {
        var oComponent = this.getOwnerComponent();
        this._router = oComponent.getRouter();
        this._router.getRoute("IT").attachPatternMatched(this._routePatternMatchedForIT, this);
        this._router.getRoute("BPO").attachPatternMatched(this._routePatternMatchedForBPO, this);

    },
    _routePatternMatchedForIT: function (oEvent) {
        console.log('Shout for IT');
        var sRouteName = oEvent.getParameter('name');
        // Call the service : /irc.com/ircit/empleave/rest/empleave/item/requestor/IT
    },
    _routePatternMatchedForBPO: function (oEvent) {
        console.log('Shout for BPO');
        // Call the service : /irc.com/ircit/empleave/rest/empleave/item/requestor/BPO
        var sRouteName = oEvent.getParameter('name');
    }

onCreatePress: function(oEvent) {
            //var sRouteName = this.getViewName();
            //alert(sRouteName);
            /*var sRouteName = oEvent.getParameter("name");
            if (sRouteName === "IT") {
                this.getRouter().navTo("create/IT");
            }
            if (sRouteName === "BPO"){

            this.getRouter().navTo("create/BPO");
            }*/
            this.getRouter().navTo("Create");
        },
</code></pre>

<p>MyRequest View for create button</p>

<pre><code>Button id="btnCreate" text="{i18n&gt;btnOpenCreateView}" press="onCreatePress" type="Accept" visible="true"/&gt;
</code></pre>

<p>Create Controller</p>

<pre><code>onRouteMatched: function(oEvent) {
            var sRouteName = oEvent.getParameter("name");
            //alert(sRouteName);
            if (sRouteName === "create") {
                this.routeName = sRouteName;
                this._loadDataDC();
            }
</code></pre>

<p>Please suggest me how to modify the create controller and MyRequest controller so that i get the value  IT or BPO from the url</p>

<pre><code>https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/IT

or

https://webidetesting453789-inf98834.dispatcher.int.sap.hana.ondemand.com/webapp/index.html#/BPO
</code></pre>

<p>and pass it on with the event onCreatePress() when create button is pressed so that i can navigate to the Create view and load the corresponding valueHelp model along with setting the page title and other ui components .</p>