({
doInit : function(component, event, helper) {
var pathname = window.location.pathname;
var pathArray = pathname.split("/");
var sfObject = "";
var isLightningApp = true;
if (pathArray[1] == 'lightning') {
sfObject = pathArray[3];
isLightningApp = false;
}
if (isLightningApp) {
var dataObjectId = component.get("v.dataObjectId");
var action = component.get("c.getDataFields");
action.setParams({ recordId : dataObjectId });
action.setCallback(this, function(data){
component.set("v.dataFields",data.getReturnValue());
});
} else {
var action = component.get("c.getDataFieldsByObjectName");
action.setParams({ name : sfObject });
action.setCallback(this, function(data) {
component.set("v.dataFields",data.getReturnValue());
});
}
$A.enqueueAction(action);
},
openModal: function(component, event, helper) {
let modals = component.find("modal");
let desiredModal = modals.find(
(modal) => modal.getElement().dataset.id === event.target.dataset.id
);
console.log(desiredModal);
desiredModal.getElement().style.display = 'block';
},
closeModel: function(component, event, helper) {
// Set isModalOpen attribute to false
console.log('closeModal');
component.set("v.isModalOpen", false);
},
})