You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Sort Component descending by Date
Hello, I have an activity wrapper List component that shows different activities in one List with pagination. I already tried some code on the internet but I always got errors. Could you help me sort the Data by 'DatumOut', which is the date of the activity that is also shown in the component?
<aura:component controller="ApexActivityWrapper" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global"> <aura:attribute name="accountList" type="Object" /> <aura:attribute name="PaginationList" type="Object"/> <aura:attribute name="perPageSize" type="Integer" default="10"/> <aura:attribute name="totalRecords" type="Integer"/> <aura:attribute name="startValue" type="Integer" /> <aura:attribute name="endValue" type="Integer"/> <aura:attribute name="columns" type="List"/> <aura:attribute name="sortBy" type="String"/> <aura:attribute name="sortDirection" type="String"/> <aura:attribute name="isLastPage" type="Boolean"/> <aura:handler name="init" action="{!c.doInit}" value="{!this}"/> <!-- Ergebnisse + Pagination--> <div class="slds-grid slds-grid_vertical"> <aura:if isTrue="{!not(empty(v.PaginationList))}"> <lightning:datatable data="{!v.PaginationList}" columns="{!v.columns}" keyField="Id" sortedBy="{!v.sortBy}" hideCheckboxColumn="true" /> <aura:set attribute="else"> <div Style="text-align : center"> Keine Aktivitäten </div> </aura:set> </aura:if> <lightning:buttongroup> <lightning:button onclick="{!c.previous}" disabled="{!v.startValue == 0}" label="Previous" iconName='utility:back'/> <lightning:button onclick="{!c.next}" disabled="{!v.isLastPage}" label="Next" iconName='utility:forward'/> </lightning:buttongroup> </div> </aura:component>
({ doInit : function(component, event, helper) { var action = component.get("c.ApexActivityWrapper"); var recordId = component.get('v.recordId'); action.setParams({ recordId : recordId }); action.setCallback(this, function(response) { var state = response.getState(); component.set('v.accountList', response.getReturnValue()); console.log(component.get('v.accountList')); //total number of accounts recieved----------------------------------------- var lengthVar = component.get("v.accountList").length; console.log('length///'+lengthVar); component.set("v.totalRecords",lengthVar); //--------------------------------------------------------------------------- //number of records in each page--------------------------------------------- var perPage = component.get("v.perPageSize"); //--------------------------------------------------------------------------- var values=[]; console.log('perPage///'+perPage); //If total number of records are more than 5 or equals 5----------------------- if(lengthVar >= perPage){ for(var i=0;i<perPage;i++){ values.push(response.getReturnValue()[i]); } }//-------------------------------------------------------------------------- else{//If total number of records are lesser than 5-------------------------- for(var i=0;i<lengthVar;i++){ values.push(response.getReturnValue()[i]); } }//-------------------------------------------------------------------------- console.log('values///'+values); component.set("v.PaginationList",values); component.set("v.startValue",0); //if there are only 5 records or lesser than that in total------------------- if(lengthVar <= (component.get("v.startValue")+perPage)){ component.set("v.isLastPage",true); } component.set("v.endValue",component.get("v.startValue")+perPage-1); }); $A.enqueueAction(action); component.set('v.columns', [ {label: 'Status', fieldName: '', initialWidth: 50, cellAttributes: {iconName: {fieldName: 'StatusPicOut' } } }, //{label: "Datum", fieldName: 'DatumOut', sortable: true, type: "date", initialWidth: 80, typeAttributes: {month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: true } }, {label: "Datum", fieldName: 'DatumOut', sortable: true, type: "date", initialWidth: 110, typeAttributes: {day: '2-digit', month: '2-digit', year: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false } }, {label: 'Art', fieldName: '', initialWidth: 60, cellAttributes: {iconName: {fieldName: 'ArtPicOut' } } }, {label: 'Thema', fieldName: 'ThemaIdOut', sortable: true, type: 'url', initialWidth: 500, typeAttributes: {label: {fieldName: 'ThemaOut'}, tooltip: {fieldName: 'TooltipOut'}, target: '_self'} }, {label: 'Kontakt', fieldName: 'KontaktIdOut', sortable: true, type: 'url', typeAttributes: {label: {fieldName: 'KontaktOut' }, target: '_self'} }, {label: 'Bezug zu', fieldName: 'BezugIdOut', sortable: true, type: 'url', typeAttributes: {label: {fieldName: 'BezugOut' }, target: '_self'} }, {label: 'Zugewiesen zu', fieldName: 'ZugewiesenOut', sortable: true, type: 'text' }, ]); }, previous : function(component, event, helper){ component.set("v.isLastPage",false); var sObjectList = component.get("v.accountList"); console.log('sObjectList///',sObjectList); var startValue=component.get("v.startValue"); var endValue=component.get("v.endValue"); var perPage = component.get("v.perPageSize"); console.log('startValue///',startValue); console.log('endValue///',endValue); var totalRecords = component.get("v.totalRecords"); var values=[]; for(var i=startValue-perPage;i<startValue;i++){ console.log('i'+i); values.push(sObjectList[i]); } component.set("v.PaginationList",values); component.set("v.startValue",startValue-perPage); component.set("v.endValue",startValue-1); console.log('start value////'+component.get("v.startValue")); console.log('end value////'+component.get("v.endValue")); }, next : function(component, event, helper){ var sObjectList = component.get("v.accountList"); console.log('sObjectList///',sObjectList); var startValue=component.get("v.startValue"); var endValue=component.get("v.endValue"); var perPage = component.get("v.perPageSize"); console.log('startValue///',startValue); console.log('endValue///',endValue); var totalRecords = component.get("v.totalRecords"); var values=[]; //for eg------------------------------------------------------------------------- // this is page 2 and there are 10 records // endValue is 4 //if total no. of records == 4+5+1 (i.e. 10) //Or if total no. of records > 10, then evaluate this part---------------------- if(totalRecords >= endValue+perPage+1){ for(var i=endValue+1;i<endValue+perPage+1;i++){ values.push(sObjectList[i]); } if(totalRecords == endValue+perPage+1){//if total records == 4+5+1----------- component.set("v.isLastPage",true); } }//------------------------------------------------------------------------------ else{//if total number of records are lesser than 4+5+1(10) i.e. 8 for(var i=endValue+1;i<totalRecords;i++){ values.push(sObjectList[i]); } component.set("v.isLastPage",true); }//------------------------------------------------------------------------------ component.set("v.PaginationList",values); component.set("v.startValue",endValue+1); component.set("v.endValue",endValue+perPage); console.log('start value////'+component.get("v.startValue")); console.log('end value////'+component.get("v.endValue")); }, })
public Class ApexActivityWrapper { // https://techdicer.com/how-to-created-lightning-datatable-with-sorting-of-columns/ @auraEnabled public static List<eEventTTask> ApexActivityWrapper (Id recordId) { // id recordId = '0010Q00001dBavUQAS'; system.debug('recordId =' + recordId); String sObjName = recordId.getSObjectType().getDescribe().getName(); /* in der Variablen sObjName wird der Name des aktuellen Objekts gespeichert */ system.debug('Objekt --> ' +sObjName); String FROMQuery = 'FROM '; List<eEventTTask> taskEventList = new List<eEventTTask>(); //########################################################################## //########################### CONTACT START ################################ //########################################################################## // Komponente auf Kontakt eingefügt, dann wird das folgende ausgeführt if(sObjName == 'Contact') { List<Contact> recordName = [SELECT Name FROM Contact WHERE Id = :recordId LIMIT 1]; system.debug('ContactName -->' + recordName + ' ' + recordName[0].name); // Abfrage von Terminen/Events for (Event e: [SELECT Id, Subject, ActivityDate, ActivityDatetime, What.Name, What.Id, Owner.Name, Who.Name, Who.Id FROM Event WHERE Id IN (SELECT EventId FROM EventRelation WHERE RelationId = :recordId)]) { taskEventList.add(new eEventTTask(e.Subject, e.ActivityDatetime, 'E', e.What.Name, e.Owner.Name, e.Id, e.What.Id, 'standard:event', '', e.Who.Name, e.Who.Id, e.Subject)); } // Abfrage von Aufgaben/Tasks bis 31.07.2022 - danach wurde das neue Addin akiviert und somit werden leider für jede email die abgelegt wird eine EmailMessage und Task angelegt for (Task t: [SELECT Id, Subject, CreatedDate, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id, Description FROM Task WHERE (Activitydate <= 2022-08-27 OR Activitydate = null) AND Id IN (SELECT TaskId FROM TaskRelation WHERE RelationId = :recordId)]) { //taskEventList.add(new eEventTTask(t.Subject, datetime.newInstance(t.ActivityDate.year(), t.ActivityDate.month(), t.ActivityDate.day(), 0, 0, 0), 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id)); taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } // Abfrage von Aufgaben/Tasks ab 01.08.2022 - danach wurde das neue Addin akiviert und somit werden leider für jede email die abgelegt wird eine EmailMessage und Task angelegt for (Task t: [SELECT Id, Subject, CreatedDate, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id, Description FROM Task WHERE Activitydate > 2022-08-27 AND TaskSubType != 'Email' AND Id IN (SELECT TaskId FROM TaskRelation WHERE RelationId = :recordId)]) { //taskEventList.add(new eEventTTask(t.Subject, datetime.newInstance(t.ActivityDate.year(), t.ActivityDate.month(), t.ActivityDate.day(), 0, 0, 0), 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id)); taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } // Abfrage von Email-Messages for (EmailMessage m: [SELECT Id, Subject, MessageDate, RelatedToId, RelatedTo.Name, CreatedBy.Name, HtmlBody FROM EmailMessage WHERE Id IN (SELECT EmailMessageId from EmailMessageRelation WHERE RelationId = :recordId)]) { taskEventList.add(new eEventTTask(m.Subject, datetime.newInstance(m.MessageDate.year(), m.MessageDate.month(), m.MessageDate.day(), m.MessageDate.hour(), m.MessageDate.minute(), 0), 'M', m.RelatedTo.Name, m.CreatedBy.Name, m.Id, m.RelatedToId, 'standard:email', '', recordName[0].name, recordId, m.HtmlBody)); } // Abfrage von Notizen/Notes for(Note n: [SELECT Id, Title, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Note WHERE ParentId = :recordId]) { //taskEventList.add(new eEventTTask(n.Title, datetime.newInstance(n.CreatedDate.year(), n.CreatedDate.month(), n.CreatedDate.day(), 0, 0, 0), 'N', n.Parent.Name, n.Owner.Name, n.Id, n.ParentId, 'standard:note', '', recordName[0].name, recordId)); taskEventList.add(new eEventTTask(n.Title, n.CreatedDate, 'N', n.Parent.Name, n.Owner.Name, n.Id, n.ParentId, 'standard:note', '', recordName[0].name, recordId, n.title)); } // Abrage von Anlagen/Dateien (alte Version - wird von Salesforce irgendwann abgestellt) for(Attachment a: [SELECT Id, Name, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Attachment WHERE ParentId = :recordId]) { //taskEventList.add(new eEventTTask(a.Name, datetime.newInstance(a.CreatedDate.year(), a.CreatedDate.month(), a.CreatedDate.day(), 0, 0, 0), 'A', a.Parent.Name, a.Owner.Name, a.Id, a.ParentId, 'standard:note', '', recordName[0].name, recordId)); taskEventList.add(new eEventTTask(a.Name, a.CreatedDate, 'A', a.Parent.Name, a.Owner.Name, a.Id, a.ParentId, 'standard:note', '', recordName[0].name, recordId, a.name)); } // Abfrage von Notizen (neue Version) for(ContentDocumentLink c: [SELECT Id, ContentDocumentId, ContentDocument.Title, ContentDocument.createdDate, ContentDocument.Createdby.Name, ContentDocument.FileExtension, LinkedEntity.Id, LinkedEntity.Name FROM ContentDocumentLink WHERE LinkedEntityId = :recordId]) { //taskEventList.add(new eEventTTask(c.ContentDocument.Title, datetime.newInstance(c.ContentDocument.CreatedDate.year(), c.ContentDocument.CreatedDate.month(), c.ContentDocument.CreatedDate.day(), 0 , 0, 0), 'C', c.LinkedEntity.Name, c.ContentDocument.CreatedBy.Name, c.ContentDocumentId, c.LinkedEntity.Id, 'utility:file', '', recordName[0].name, recordId)); taskEventList.add(new eEventTTask(c.ContentDocument.Title, c.ContentDocument.CreatedDate, 'C', c.LinkedEntity.Name, c.ContentDocument.CreatedBy.Name, c.ContentDocumentId, c.LinkedEntity.Id, 'standard:file', '', recordName[0].name, recordId, c.ContentDocument.Title)); } // Abfrage von Wiedervorlagen // for(Wiedervorlage__c w: [SELECT Id, Beschreibung__c, Erinnerungstermin__c, Wiedervorlage_f_r__c, Wiedervorlage_f_r_Name__c, Wiedervorlage_f_r_Id__c, Owner.Name FROM Wiedervorlage__c WHERE Wiedervorlage_f_r_Id__c = :recordId]) { // taskEventList.add(new eEventTTask(w.Beschreibung__c, w.Erinnerungstermin__c, 'W', w.Wiedervorlage_f_r_Name__c, w.Owner.Name, w.Id, '', 'standard:today', '', recordName[0].name, w.Wiedervorlage_f_r_Id__c, w.Beschreibung__c)); // } } //########################### CONTACT ENDE ################################# //########################################################################## //########################### ACCOUNT START ################################ //########################################################################## // Komponente auf Kontakt eingefügt, dann wird das folgende ausgeführt if(sObjName == 'Account') { // Abfrage von Aufgaben/Tasks bis 31.07.2022 - danach wurde das neue Addin akiviert und somit werden leider für jede email die abgelegt wird eine EmailMessage und Task angelegt //for (Task t: [SELECT Id, Subject, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id FROM Task WHERE Activitydate <= 2022-08-26 AND Id IN (SELECT TaskId FROM TaskRelation WHERE RelationId = :recordId)]) { for (Task t: [SELECT Id, Subject, ActivityDate, CreatedDate, Createdby.Name, Owner.Name, RecordType.Name, Status, Who.Name, Who.Id, What.Name, Description from Task WHERE AccountId = :recordId AND WhoId = '' AND (Activitydate <= 2022-08-27 OR Activitydate = null)]) { taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } // Abfrage von Aufgaben/Tasks ab 01.08.2022 - danach wurde das neue Addin akiviert und somit werden leider für jede email die abgelegt wird eine EmailMessage und Task angelegt //for (Task t: [SELECT Id, Subject, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id FROM Task WHERE Activitydate > 2022-08-26 AND TaskSubType != 'Email' AND Id IN (SELECT TaskId FROM TaskRelation WHERE RelationId = :recordId)]) { for (Task t: [SELECT Id, Subject, ActivityDate, CreatedDate, Createdby.Name, Owner.Name, RecordType.Name, Status, Who.Name, Who.Id, What.Name, Description from Task WHERE AccountId = :recordId AND WhoId = '' AND Activitydate > 2022-08-27 AND TaskSubType != 'Email']) { taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } // Abfrage von Aufgaben/Tasks - in dieser Abfrage werden alle Aufgaben von AG-Kontakten selektiert die diesem Unternehmen zugeordnet sind Map<Id, TaskWhoRelation> relatedTasksAcc = new Map<Id, TaskWhoRelation>([SELECT taskId FROM TaskWhoRelation WHERE AccountId = :recordId AND RelationId IN (SELECT Id FROM Contact WHERE RecordTypeId = '012b0000000UNQxAAO')]); Set<Id> taskidsset = new Set<Id>(); for(taskwhorelation relation:relatedTasksAcc.values()) { taskidsset.add(relation.taskid); } system.debug('size relatedtasksAcc ' +relatedtasksAcc.size()); system.debug('size taskidsset ' +taskidsset.size()); List<Task> listtask1 = [SELECT Id, Subject, CreatedDate, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id, Description FROM Task WHERE (Activitydate <= 2022-08-27 OR Activitydate = null) AND Id IN :taskidsset]; system.debug('size listtask1 ' +listtask1.size()); for(Task t : listtask1) { taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } List<Task> listtask2 = [SELECT Id, Subject, CreatedDate, ActivityDate, What.Name, What.Id, Owner.Name, Status, Who.Name, Who.Id, Description FROM Task WHERE Activitydate > 2022-08-27 AND TaskSubType != 'Email' AND Id IN :taskidsset]; system.debug('size listtask2 ' +listtask2.size()); for(Task t : listtask2) { taskEventList.add(new eEventTTask(t.Subject, t.CreatedDate, 'T', t.What.Name, t.Owner.Name, t.Id, t.What.Id, 'standard:task', t.Status, t.Who.Name, t.Who.Id, t.Description)); } // Abfrage von Termine/Events - in dieser Abfrage werden alle Termine von AG-Kontakten selektiert die diesem Unternehmen zugeordnet sind Map<Id, EventWhoRelation> relatedEventAcc = new Map<Id, EventWhoRelation>([SELECT EventId FROM EventWhoRelation WHERE AccountId = :recordId and RelationId IN (SELECT Id FROM Contact WHERE RecordTypeId = '012b0000000UNQxAAO')]); Set<Id> eventidsset = new Set<Id>(); for(eventwhorelation relation:relatedEventAcc.values()){ eventidsset.add(relation.eventid); } system.debug('size relatedeventAcc ' +relatedeventAcc.size()); system.debug('size eventidsset ' +eventidsset.size()); List<Event> listevent = [SELECT Id, Subject, ActivityDate, ActivityDatetime, What.Name, What.Id, Owner.Name, Who.Name, Who.Id FROM Event WHERE Id IN :eventidsset]; system.debug('size listevent ' +listevent.size()); for(event e : listevent) { taskEventList.add(new eEventTTask(e.Subject, e.ActivityDatetime, 'E', e.What.Name, e.Owner.Name, e.Id, e.What.Id, 'standard:event', '', e.Who.Name, e.Who.Id, e.Subject)); } // Abfrage von Notizen (neue Version) for(ContentDocumentLink c: [SELECT Id, ContentDocumentId, ContentDocument.Title, ContentDocument.createdDate, ContentDocument.Createdby.Name, ContentDocument.FileExtension, LinkedEntity.Id, LinkedEntity.Name FROM ContentDocumentLink WHERE LinkedEntityId = :recordId]) { taskEventList.add(new eEventTTask(c.ContentDocument.Title, c.ContentDocument.CreatedDate, 'C', c.LinkedEntity.Name, c.ContentDocument.CreatedBy.Name, c.ContentDocumentId, c.LinkedEntity.Id, 'standard:file', '', '', '', c.ContentDocument.Title)); } for(ContentDocumentLink c: [SELECT Id, ContentDocumentId, ContentDocument.Title, ContentDocument.createdDate, ContentDocument.Createdby.Name, ContentDocument.FileExtension, LinkedEntity.Id, LinkedEntity.Name FROM ContentDocumentLink WHERE LinkedEntityId IN (SELECT Id FROM Contact WHERE AccountId =: recordId)]) { taskEventList.add(new eEventTTask(c.ContentDocument.Title, c.ContentDocument.CreatedDate, 'C', c.LinkedEntity.Name, c.ContentDocument.CreatedBy.Name, c.ContentDocumentId, c.LinkedEntity.Id, 'standard:file', '', '', '', c.ContentDocument.Title)); } // Abrage von Anlagen/Dateien (alte Version - wird von Salesforce irgendwann abgestellt) for(Attachment a: [SELECT Id, Name, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Attachment WHERE ParentId = :recordId]) { taskEventList.add(new eEventTTask(a.Name, a.CreatedDate, 'A', a.Parent.Name, a.Owner.Name, a.Id, a.ParentId, 'standard:note', '', '', '', a.Name)); } // Abrage von Anlagen/Dateien (alte Version - wird von Salesforce irgendwann abgestellt) for(Attachment a: [SELECT Id, Name, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Attachment WHERE ParentId IN (SELECT Id FROM Contact WHERE AccountId =: recordId and RecordTypeId = '012b0000000UNQxAAO')]) { taskEventList.add(new eEventTTask(a.Name, a.CreatedDate, 'A', a.Parent.Name, a.Owner.Name, a.Id, a.ParentId, 'standard:note', '', '', '', a.Name)); } // Abfrage von Notizen/Notes for(Note n: [SELECT Id, Title, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Note WHERE ParentId = :recordId]) { taskEventList.add(new eEventTTask(n.Title, n.CreatedDate, 'N', n.Parent.Name, n.Owner.Name, n.Id, n.ParentId, 'standard:note', '', '', '', n.Title)); } // Abfrage von Notizen/Notes for(Note n: [SELECT Id, Title, CreatedDate, Createdby.Name, Owner.Name, Parent.Name, ParentId FROM Note WHERE ParentId IN (SELECT Id FROM Contact WHERE AccountId = :recordId AND RecordTypeId = '012b0000000UNQxAAO')]) { taskEventList.add(new eEventTTask(n.Title, n.CreatedDate, 'N', n.Parent.Name, n.Owner.Name, n.Id, n.ParentId, 'standard:note', '', '', '', n.Title)); } // Abfrage von Email-Messages for (EmailMessage m: [SELECT Id, Subject, MessageDate, RelatedToId, RelatedTo.Name, CreatedBy.Name, HtmlBody FROM EmailMessage WHERE RelatedToId = :recordId]) { taskEventList.add(new eEventTTask(m.Subject, m.MessageDate, 'M', m.RelatedTo.Name, m.CreatedBy.Name, m.Id, m.RelatedToId, 'standard:email', '', '', '', m.HtmlBody)); } // Abfrage von Email-Messages for (EmailMessageRelation m: [SELECT Id, EmailMessageId, EmailMessage.Subject, EmailMessage.MessageDate, EmailMessage.RelatedToId, EmailMessage.RelatedTo.Name, EmailMessage.CreatedBy.Name, Relation.Name, EmailMessage.HtmlBody FROM EmailMessageRelation WHERE RelationId IN (SELECT Id FROM Contact WHERE AccountId = :recordId AND RecordTypeId = '012b0000000UNQxAAO')]) { taskEventList.add(new eEventTTask(m.EmailMessage.Subject, m.EmailMessage.MessageDate, 'M', m.EmailMessage.RelatedTo.Name, m.EmailMessage.CreatedBy.Name, m.EmailMessage.Id, m.EmailMessage.RelatedToId, 'standard:email', '', m.Relation.Name, m.RelationId, m.EmailMessage.HtmlBody)); system.debug('Name --> ' + m.Relation.Name); } // Abfrage von Wiedervorlagen // for(Wiedervorlage__c w: [SELECT Id, Beschreibung__c, Erinnerungstermin__c, Wiedervorlage_f_r__c, Wiedervorlage_f_r_Name__c, Wiedervorlage_f_r_Id__c, Owner.Name FROM Wiedervorlage__c WHERE Wiedervorlage_f_r_Id__c = :recordId]) { // taskEventList.add(new eEventTTask(w.Beschreibung__c, w.Erinnerungstermin__c, 'W', w.Wiedervorlage_f_r_Name__c, w.Owner.Name, w.Id, '', 'standard:today', '', w.Wiedervorlage_f_r_Name__c, w.Wiedervorlage_f_r_Id__c, w.Beschreibung__c)); // } } //########################### ACCOUNT ENDE ################################## system.debug('taskEventList' + taskEventList); return taskEventList; } public class eEventTTask { @AuraEnabled public String ThemaOut {get; set;} @AuraEnabled public Datetime DatumOut {get; set;} @AuraEnabled public String ArtOut {get; set;} @AuraEnabled public String BezugOut {get; set;} @AuraEnabled public String ZugewiesenOut {get; set;} @AuraEnabled public String ThemaIdOut {get; set;} @AuraEnabled public String BezugIdOut {get; set;} @AuraEnabled public String ArtPicOut {get; set;} @AuraEnabled public String StatusPicOut {get; set;} @AuraEnabled public String KontaktOut {get; set;} @AuraEnabled public String KontaktIdOut {get; set;} @AuraEnabled public String TooltipOut {get; set;} public eEventTTask(String ThemaIn, Datetime DatumIn, String ArtIn, String BezugIn, String ZugewiesenIn, String ThemaIdIn, String BezugIdIn, String ArtPicIn, String StatusIn, String KontaktIn, String KontaktIdIn, String TooltipIn) { ThemaOut = ThemaIn; DatumOut = DatumIn; ArtOut = ArtIn; BezugOut = BezugIn; ZugewiesenOut = ZugewiesenIn; IF(ThemaIdIn != Null) { ThemaIdOut = '/' + ThemaIdIn; } IF(BezugIdIn != Null) { BezugIdOut = '/' + BezugIdIn; } ArtPicOut = ArtPicIn; IF(ArtIn == 'm' || ArtIn == 'n' || ArtIn == 'c' || ArtIn == 'a' || (ArtIn == 'e' && DatumIn <= date.today()) || (ArtIn == 't' && (StatusIn == 'Completed' || StatusIn == 'Fertiggestellt'))) { StatusPicOut = 'custom:custom6'; } //grün ELSE IF ((ArtIn == 'e' && DatumIn > date.today()) || // (ArtIn == 'w' && DatumIn > date.today()) || (ArtIn == 't' && DatumIn > date.today() && StatusIn != 'Fertiggestellt' && StatusIn != 'Completed')) { StatusPicOut = 'custom:custom4'; } // gelb ELSE IF ((ArtIn == 't' && DatumIn <= date.today() && (StatusIn != 'Fertiggestellt' || StatusIn != 'Completed')) || (ArtIn == 'w' && DatumIn <= date.today())) { StatusPicOut = 'custom:custom49'; } // rot KontaktOut = KontaktIn; IF(KontaktIdIn != '' && KontaktIdIn != Null) { KontaktIdOut = '/' + KontaktIdIn; } TooltipOut = TooltipIn; } } }