Skip to content

Instantly share code, notes, and snippets.

@tushar30
Created May 28, 2018 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tushar30/fbe00c1d33d43873b2ee46445499ff6d to your computer and use it in GitHub Desktop.
Save tushar30/fbe00c1d33d43873b2ee46445499ff6d to your computer and use it in GitHub Desktop.
({
doInit : function(component, event, helper) {
var sobject = component.get('v.objName');
var fieldName = component.get('v.fieldName');
var formatText = component.find("fielddata");
if(!fieldName.includes('.')) {
formatText.set("v.value",sobject[fieldName]);
}
else {
console.log(sobject[fieldName.split(".")[0]]);
formatText.set("v.value",sobject[fieldName.split(".")[0]][fieldName.split(".")[1]]); //Here we are fetching data from parent field
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment