Open a record create Page :
===========================
It is event which is fired to show the full Record create panel.
To display the record create a page for an object,set the object name
on the entityApiName attribute and fire the event.
recordTypeId is optional and, if provided,specifies the record type for the created
object. defaultFieldValues is optional and if povided, specifies values to use to
prepopulate the create record form.
ex :
createAccount : function(component,event,helper){
var accountCreate = $A.get(e.force.createRecod');
accountCreate.setParams({
"entityApiName":"Account",
"defaultFieldValues":{
'Name':'Test Account'
},
"recordTypeId":RecTypeID
});
}
Open a record edit Page :
===========================
editRecord : function(component, event, helper)
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": component.get("v.contact.Id")
});
editRecordEvent.fire();
}
this will open an edit form with pre-populated values from contact record whose id we have passed in controller.
opened edit form is based on the page-layout associated with the record id.
Navigate to a record :
======================
1.force:navigateToList
To navigate to a list view, set the list view ID on the listViewId attribute and fire the event.
gotoList : function (component, event, helper) {
var action = component.get("c.getListViews");
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
var listviews = response.getReturnValue();
var navEvent = $A.get("e.force:navigateToList");
navEvent.setParams({
"listViewId": listviews.Id,
"listViewName": null,
"scope": "Contact";
});
navEvent.fire();
}
});
$A.enqueueAction(action);
}
@AuraEnabled
public static List<ListView> getListViews() {
List<ListView> listviews =
[SELECT Id, Name FROM ListView WHERE SobjectType = 'Contact'];
// Perform isAccessible() check here
return listviews;
}
2. force:navigateToObjectHome
Navigates to the object home specified by the scope attribute.
navHome : function (component, event, helper) {
var homeEvent = $A.get("e.force:navigateToObjectHome");
homeEvent.setParams({
"scope": "myNamespace__myObject__c"
});
homeEvent.fire();
}
3.force:navigateToRelatedList
Navigates to the related list specified by parentRecordId.
gotoRelatedList : function (component, event, helper) {
var relatedListEvent = $A.get("e.force:navigateToRelatedList");
relatedListEvent.setParams({
"relatedListId": "Cases",
"parentRecordId": component.get("v.contact.Id")
});
relatedListEvent.fire();
}
4. force:navigateToSobject
Navigates to an sObject record specified by recordId.
createRecord : function (component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId": "00QB0000000ybNX",
"slideDevName": "related"
});
navEvt.fire();
}
5. force:navigateToURL
Navigates to the specified URL.
1) Using a relative URL.
gotoURL : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/006/o"
});
urlEvent.fire();
}
2) Using external website when the link is clicked.
navigate : function(component, event, helper) {
//Find the text value of the component with aura:id set to "address"
var address = component.find("address").get("v.value");
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": 'https://www.google.com/maps/place/' + address
});
urlEvent.fire();
}
===========================
It is event which is fired to show the full Record create panel.
To display the record create a page for an object,set the object name
on the entityApiName attribute and fire the event.
recordTypeId is optional and, if provided,specifies the record type for the created
object. defaultFieldValues is optional and if povided, specifies values to use to
prepopulate the create record form.
ex :
createAccount : function(component,event,helper){
var accountCreate = $A.get(e.force.createRecod');
accountCreate.setParams({
"entityApiName":"Account",
"defaultFieldValues":{
'Name':'Test Account'
},
"recordTypeId":RecTypeID
});
}
Open a record edit Page :
===========================
editRecord : function(component, event, helper)
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": component.get("v.contact.Id")
});
editRecordEvent.fire();
}
this will open an edit form with pre-populated values from contact record whose id we have passed in controller.
opened edit form is based on the page-layout associated with the record id.
Navigate to a record :
======================
1.force:navigateToList
To navigate to a list view, set the list view ID on the listViewId attribute and fire the event.
gotoList : function (component, event, helper) {
var action = component.get("c.getListViews");
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
var listviews = response.getReturnValue();
var navEvent = $A.get("e.force:navigateToList");
navEvent.setParams({
"listViewId": listviews.Id,
"listViewName": null,
"scope": "Contact";
});
navEvent.fire();
}
});
$A.enqueueAction(action);
}
@AuraEnabled
public static List<ListView> getListViews() {
List<ListView> listviews =
[SELECT Id, Name FROM ListView WHERE SobjectType = 'Contact'];
// Perform isAccessible() check here
return listviews;
}
2. force:navigateToObjectHome
Navigates to the object home specified by the scope attribute.
navHome : function (component, event, helper) {
var homeEvent = $A.get("e.force:navigateToObjectHome");
homeEvent.setParams({
"scope": "myNamespace__myObject__c"
});
homeEvent.fire();
}
3.force:navigateToRelatedList
Navigates to the related list specified by parentRecordId.
gotoRelatedList : function (component, event, helper) {
var relatedListEvent = $A.get("e.force:navigateToRelatedList");
relatedListEvent.setParams({
"relatedListId": "Cases",
"parentRecordId": component.get("v.contact.Id")
});
relatedListEvent.fire();
}
4. force:navigateToSobject
Navigates to an sObject record specified by recordId.
createRecord : function (component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId": "00QB0000000ybNX",
"slideDevName": "related"
});
navEvt.fire();
}
5. force:navigateToURL
Navigates to the specified URL.
1) Using a relative URL.
gotoURL : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/006/o"
});
urlEvent.fire();
}
2) Using external website when the link is clicked.
navigate : function(component, event, helper) {
//Find the text value of the component with aura:id set to "address"
var address = component.find("address").get("v.value");
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": 'https://www.google.com/maps/place/' + address
});
urlEvent.fire();
}
No comments:
Post a Comment