Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

routing is not working in sapui5

hi iam using routing concept in my sapui5 application.but it is not working when i tried to navigate from 2nd page to first page.

my component.js file is

i am calling first page view in sap.m.message box which is been placed in the 2nd page controller.js file.

callCreatePage : function(oEvent){

    var oDate = sap.ui.getCore().byId("PLANNED_DATE").getValue();

    var tempdate = new Date(oDate);

    var month = (tempdate.getMonth() + 1);

    if(month < 10)

      month = "0"+month;

      var day = (tempdate.getDate());

      if(day < 10)

        day = "0"+day;

      var year = (tempdate.getFullYear());

      var PlanedDate = (year+''+month+''+day);

    var oActivity= sap.ui.getCore().byId("ACTIVITY").getSelectedItem().getText();

    var oSub = sap.ui.getCore().byId("SUBACTIVITY").getSelectedItem().getText();

    var oPSR = sap.ui.getCore().byId("PSR_HQ").getSelectedItem().getText();

    var oFaculty = sap.ui.getCore().byId("FACULTY").getValue();

    var oAddress = sap.ui.getCore().byId("ADDRESS").getValue();

    var oAmount = sap.ui.getCore().byId("EST_AMOUNT").getValue();

    var oRemarks = sap.ui.getCore().byId("REMARKS").getValue();



       "Please Confirm to Submit", {

          icon: sap.m.MessageBox.Icon.INFORMATION,

          title: "Dear User",

        actions: [sap.m.MessageBox.Action.YES, sap.m.MessageBox.Action.NO],

        onClose: function(oAction){

        if(oAction == sap.m.MessageBox.Action.YES){alert("bye");

        var oRouter = sap.ui.core.UIComponent.getRouterFor(this);

       oRouter.navTo("default", "");






but it is entering inside the if condition in sap.m.message box i.e.,upto alert("bye"),but after that it is giving Cannot read property 'navTo' of undefined.

Former Member
Not what you were looking for? View more on this topic or Ask a question