0

I have created a Flexi record page for an account and also placed a custom lightning component in that. now my requirement is, I want to Open Tab with workspace API to redirect to standard account record page and also want to pass some page reference attributes in a state.

My code looks like below:

  openTab: function(component, event, helper) {
          var workspaceAPI = component.find("workspace");
          workspaceAPI.openTab({
              pageReference: {
                  "type": "standard__recordPage",
                  "attributes": {
                      "recordId":"500xx000000Ykt2AAC",
                      "actionName":"view"
                  },
                  "state": {
                      c__response: "response value"(Here i wan to pass some parameters which is used in custom component init function)
                   }
              },
              focus: true
          }).then(function(response) {
              workspaceAPI.getTabInfo({
                  tabId: response
          }).then(function(tabInfo) {
              console.log("The recordId for this tab is: " + tabInfo.recordId);
          });
          }).catch(function(error) {
              console.log(error);
          });
      }
  )}

Please suggest some approach.

Thanks

1 Answer 1

0

did you try to inject paramat like this ?

openTab: function(component, event, helper) {
          var workspaceAPI = component.find("workspace");
          workspaceAPI.openTab({
              pageReference: {
                  "type": "standard__recordPage",
                  "attributes": {
                      "recordId":"500xx000000Ykt2AAC",
                      "actionName":"view"
                  },
                  "state": {
                    workspaceAPI.setParams({
            "response value" : c__response
        });
                      
                   }
              },
              focus: true
          }).then(function(response) {
              workspaceAPI.getTabInfo({
                  tabId: response
          }).then(function(tabInfo) {
              console.log("The recordId for this tab is: " + tabInfo.recordId);
          });
          }).catch(function(error) {
              console.log(error);
          });
      }
  )}
1
  • Hi Rabiy Bennour, I have tried the above solution, but it is not working.
    – vishnu
    Feb 16, 2021 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .