0

How do I open the aura: component directly on Salesforce1 App when I click on Url or link

1 Answer 1

0

You can fire navigateToComponent event from Lightning Component.

navigateToMyComponent : function(component, event, helper) {
    var evt = $A.get("e.force:navigateToComponent");
    evt.setParams({
        componentDef : "c:myComponent",
        componentAttributes: {
            contactName : component.get("v.contact.Name")
        }
    });
    evt.fire();
}

If you are having a visualforce, then use this:-

<script>
var compDefinition = { 
    "componentDef" : "c:NewContact", 
    "attributes" :{ 
          "recordTypeId" : "012xxxxxxxxxxxx",
          "testAttribute" : "attribute value"
     } 
    };
// Base64 encode the compDefinition JS object
var encodedCompDef = btoa(JSON.stringify(compDefinition));
window.parent.location = "/one/one.app#"+encodedCompDef;
</script> 

If you are not using any of them, You simply want a link on your page layout then, You can store the Base64 encode of the component Definition in a field and use like this:-

/one/one.app#+{!Object.encodedCompDef__c}

You have to dynamically update the field value with base64 encoding part as attribute value will be changed for each record. If you have static attributes then you don't need to update dynamically.

2
  • Just I need a link in my email when I click on that link In my email it should open Salesforce 1 app with my Component
    – Mohd
    Commented Sep 13, 2019 at 9:12
  • The link should work over there also. Commented Sep 13, 2019 at 9:14

You must log in to answer this question.

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