import { LightningElement, track, wire,api } from 'lwc';
|
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
|
import Object_History_Field_API_Name from '@salesforce/label/c.Object_History_Field_API_Name';
|
import Object_History_NewValue from '@salesforce/label/c.Object_History_NewValue';
|
import Object_History_OldValue from '@salesforce/label/c.Object_History_OldValue';
|
import Object_History_Update_Datetime from '@salesforce/label/c.Object_History_Update_Datetime';
|
import Object_History_Update_User from '@salesforce/label/c.Object_History_Update_User';
|
import getObjectHistoryList from '@salesforce/apex/ObjectHistoryShowController.getObjectHistoryList';
|
|
export default class ObjectHistoryShow extends LightningElement {
|
@api recordId;
|
|
ohiInfoList = [];
|
columns = [
|
{ label: Object_History_Update_Datetime, fieldName: 'updateDatetime', type: 'text' },
|
{ label: Object_History_Field_API_Name, fieldName: 'fieldAPINameLabel', type: 'text' },
|
{ label: Object_History_Update_User, fieldName: 'updateUser', type: 'text' },
|
{ label: Object_History_OldValue, fieldName: 'oldValue', type: 'text' },
|
{ label: Object_History_NewValue, fieldName: 'newValue', type: 'text' },
|
];
|
|
connectedCallback() {
|
getObjectHistoryList({recordId : this.recordId})
|
.then(result => {
|
this.ohiInfoList = result.ohiInfoList;
|
})
|
.catch(error => {
|
window.console.log(' Error Occured ', error);
|
})
|
.finally(()=>{
|
//this.isLoaded = false;
|
window.console.log(this.ohiInfoList);
|
window.console.log(this.recordId);
|
})
|
}
|
|
handleOnLoad(){
|
this.isLoaded = false;
|
}
|
|
showToast (title,message,variant){
|
const event = new ShowToastEvent({
|
title: title,
|
message: message,
|
variant : variant
|
|
});
|
this.dispatchEvent(event);
|
}
|
|
analysisError (error){
|
var msg = '';
|
var errBody = error.body;
|
if (errBody){
|
if (errBody.pageErrors){
|
errBody.pageErrors.forEach(item =>{
|
msg = msg + item.message;
|
});
|
}
|
}
|
return msg;
|
}
|
}
|