How do I open the aura: component directly on Salesforce1 App when I click on Url or link
1 Answer
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.
-
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– MohdCommented Sep 13, 2019 at 9:12
-