Activity › Forums › Salesforce® Discussions › How to access cross object fields in lightning:datatable?
-
How to access cross object fields in lightning:datatable?
Posted by Prachi on August 30, 2018 at 2:13 PMHow to access cross object fields in lightning:datatable?
Dave replied 6 years, 2 months ago 4 Members · 3 Replies -
3 Replies
-
Hello Prachi,
Salesforce approval process is an automated process and your organization can use to approve records in Salesforce, An approval process is combination of steps for a record to be approved and person has to approve it each step.A step can apply to all the records to that object or just record that meets the certain criteria. An approval process also specifies the actions to take when a record is approved, rejected, recalled, or first submitted for approval.
Thanks.
- [adinserter block='9']
-
Hi,
I am sharing you the code for data table, it may give you a little help –
Component –
<aura:component>
<aura:import library=”lightningcomponentdemo:mockdataFaker” property=”mockdataLibrary”/>
<aura:attribute name=”data” type=”Object”/>
<aura:attribute name=”columns” type=”List”/>
<aura:handler name=”init” value=”{! this }” action=”{! c.init }”/>
<div style=”height: 300px”>
<lightning:datatable
keyField=”id”
data=”{! v.data }”
columns=”{! v.columns }”
hideCheckboxColumn=”true”/>
</div>
</aura:component>Controller –
({
init: function (cmp, event, helper) {
cmp.set(‘v.columns’, [
{label: ‘Opportunity name’, fieldName: ‘opportunityName’, type: ‘text’},
{label: ‘Account name’, fieldName: ‘accountName’, type: ‘text’},
{label: ‘Close date’, fieldName: ‘closeDate’, type: ‘date’},
{label: ‘Confidence’, fieldName: ‘confidence’, type: ‘percentage’},
{label: ‘Amount’, fieldName: ‘amount’, type: ‘currency’, typeAttributes: { currencyCode: ‘EUR’, maximumSignificantDigits: 5}},
{label: ‘Contact Email’, fieldName: ‘contact’, type: ’email’},
{label: ‘Contact Phone’, fieldName: ‘phone’, type: ‘phone’},
{label: ‘Website’, fieldName: ‘website’, type: ‘url’, typeAttributes: { target: ‘_self’}},
{label: ‘Address’, fieldName: ‘address’, type: ‘location’}
]);var fetchData = {
opportunityName: “company.companyName”,
accountName : “name.findName”,
closeDate : “date.future”,
amount : “finance.amount”,
contact: “internet.email”,
phone : “phone.phoneNumber”,
website : “internet.url”,
status : {type : “helpers.randomize”, values : [ ‘Pending’, ‘Approved’, ‘Complete’, ‘Closed’ ] },
actionLabel : {type : “helpers.randomize”, values : [ ‘Approve’, ‘Complete’, ‘Close’, ‘Closed’ ]},
confidenceDeltaIcon : {type : “helpers.randomize”, values : [ ‘utility:up’, ‘utility:down’ ]}
};helper.fetchData(cmp,fetchData, 10);
}
})Helper –
({
fetchData: function (cmp, fetchData, numberOfRecords) {
var dataPromise,
latitude,
longitude,
fakerLib = this.mockdataLibrary.getFakerLib();fetchData.address = {type : function () {
return {
latitude : fakerLib.address.latitude(),
longitude : fakerLib.address.longitude()
}
}};fetchData.confidence = { type : function () {
return fakerLib.random.number(100) + “%”
}};dataPromise = this.mockdataLibrary.lightningMockDataFaker(fetchData,numberOfRecords);
dataPromise.then(function(results) {
cmp.set(‘v.data’, results);
});
}
})Hope this helps.
Log In to reply.
