• Jonathan Wolff 7
  • NEWBIE
  • 60 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 17
    Replies
Hi, I have this task component. I would like to add a 3rd column in which I have to checkbox to change the task to completed. Can you tell me how to achive this. If you need, I can send you the code of my component :)
User-added image
Hi, 
I wanted to try the data import wizard with an Excel data that I converted to a CSV. When I add the CSV I got the problem that The columns are not seperated by comma but semicolon. What datatype or other option can I use so the problem does not occure?

Greetings Jonathan
User-added image
Hi, I build a flow in which I want to send an email at the end. My problem is, that I dont want the sender type to be the "OrgWideEmailAddress"-adress. 
User-added image
Instead I would like to use the Email adresses I generated in the EMail Services Section.
Could you tell me how to achive this?
When I tried this I got the error message:

Because the Automated Process User’s email address isn’t valid, this flow can’t send emails for actions or errors. On the Process Automation Settings page in Setup, the Automated Process User Email Address must specify an organization-wide email address for the system administrator profile.

User-added image

 
Hello, as you can see below, I build a task component, in which I would like to make some changes I dont know how to add. First I would like to change the status to be in german. Even when I change my SF to german it is still english. In addition I would like to have a checkbox or button as a 3rd column to mark the task as completed.
As the last topic I would like to have a short for the day at the row for tommorow and day after tomorrow. Like :
04.05.2021 (Tue)
05.05.2021 (Wed)

If you know how to make even just one of the things tell me :)
I give you a code sample
User-added image


({
    doInit: function(component, event, helper) {
        
       

                var today = new Date();
        var tomorrow = new Date();
        tomorrow.setDate(new Date().getDate()+1);
        
        var aftertomorrowdate = new Date();
        aftertomorrowdate.setDate(new Date().getDate()+2);
        
        let options = {"month":"2-digit", "day":"2-digit", "year":"numeric"};
        component.set('v.currentDate', today.toLocaleDateString("de-DE",options));
        component.set('v.TomorrowDate', tomorrow.toLocaleDateString("de-DE",options));
        component.set('v.AfterTomorrowDate', aftertomorrowdate.toLocaleDateString("de-DE",options));

      
            component.set('v.mycolumns', [
            {label: 'Thema', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            {label: 'Status', fieldName: 'Status', type: 'picklist'},
        ]);
        var action = component.get("c.loadTasks");
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);
Hello,
I tried to block XLS;XLSX, PPT and PPTX to be be uploaded in my sandbox. I already build 4 records in the "DataBlock" object with the 4 types:
User-added image With this metadata I build 2 triggers but I still cant block only these types. Can you tell me where I have to change my code?


trigger DataBlock on ContentDocument (before insert) {
try {   
    Set<String> blockedTypes = new Set<String>();
    for (DataBlock__mdt  blockedType : [SELECT FileExtension__c FROM DataBlock__mdt WHERE FileExtension__c != null]) {
        blockedTypes.add(blockedType?.FileExtension__c?.toUpperCase());
    }
    for (ContentDocument myDocument : Trigger.new) {
        if (myDocument.FileExtension != null && blockedTypes.contains(myDocument?.FileExtension?.toUpperCase())) {
            myDocument.addError('The file extension ' + myDocument.FileExtension + ' is not allowed.');
        }
    }
} catch (Exception e) {
    throw new StringException(e.getMessage() + ' - ' + e.getLineNumber() + '\r\n' + e.getStackTraceString());
}

}

And the second trigger:

trigger DataBlockContentVersion on ContentVersion(before insert) {
    try {   
        Set<String> blockedTypes = new Set<String>();
        for (DataBlock__mdt  blockedType : [SELECT FileExtension__c FROM DataBlock__mdt WHERE FileExtension__c != null]) {
            blockedTypes.add(blockedType?.FileExtension__c?.toUpperCase());
        }
        for (ContentVersion myDocument : Trigger.new) {
            if (myDocument.PathOnClient != null) {
                String[] parts = myDocument.PathOnClient.split('.');
                if (parts.size() > 0) {
                    String ext = parts[parts.size() - 1];
                    if (blockedTypes.contains(ext.toUpperCase())) {
                        myDocument.addError('The file extension ' + myDocument.FileExtension + ' is not allowed.');
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new StringException(e.getMessage() + ' - ' + e.getLineNumber() + '\r\n' + e.getStackTraceString());
    }
}
Hello, I want to use a component I found on the internet. I added it in my developer console but it doesn't show up on my "Edit page" side. Could you give me some help?

The code:

<aura:component implements="force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="options" type="List" />
    <aura:attribute name="type" type="String" default="News" description="The type of feed" access="GLOBAL"/>
    <aura:attribute name="types" type="String[]"
                    default="Bookmarks,Company,DirectMessages,Feeds,Files,Filter,Groups,Home,Moderation,Mute,News,PendingReview,Record,Streams,To,Topics,UserProfile"
                    description="A list of feed types"/>
    <h1>My Feeds</h1>
    <lightning:select aura:id="typeSelect" onchange="{!c.onChangeType}" label="Type" name="typeSelect">
        <aura:iteration items="{!v.options}" var="item">
            <option text="{!item.label}" value="{!item.value}" selected="{!item.selected}"/>
        </aura:iteration>
    </lightning:select>
    <div aura:id="feedContainer" class="feed-container">
        <forceChatter:feed />
    </div>
</aura:component>


({
    // Handle component initialization
    doInit : function(component, event, helper) {
        var type = component.get("v.type");
        var types = component.get("v.types");
        var opts = new Array();
        
        // Set the feed types on the lightning:select component
        for (var i = 0; i < types.length; i++) {
            opts.push({label: types[i], value: types[i], selected: types[i] === type});
        }
        component.set("v.options", opts);
    },
    
    onChangeType : function(component, event, helper) {
        var typeSelect = component.find("typeSelect");
        var type = typeSelect.get("v.value");
        component.set("v.type", type);
        
        // Dynamically create the feed with the specified type
        $A.createComponent("forceChatter:feed", {"type": type}, function(feed) {
            var feedContainer = component.find("feedContainer");
            feedContainer.set("v.body", feed);
        });
    }
})
Hi, I would like to build a validation rule, trigger or anything like that so types like powerpoint or excel cant be uploaded. Can you tell me how to achive this?

Greetings
Jonathan
 

Hello, how you see below, I as an administrator cant change the status of campaigns. Could you tell me what the error could be? I dont have any validation rules that could block it. For my Lightning Users the problem does not occure. Can you tell me how to solve it?
User-added image
Hello,
I would like to add the chatter in the edit page side, but I only have the Feed and the publisher. Can you tell me how get the Chatter as a component?
Greetings Jonathan
Hi, I have the problem that I can't change the status of campaign members in one layout I made:User-added image

I made a short Layout in which I took out some field and had the problem that I could not change the status like shown above. I changed the layout and now it is working. what could be the reason?
Hi, I would like to build a chatter component in form of a table. One column should show the author of the message, in the second column it should show the content of the message. could you tell me how to build a component like that?

Greetings
Jonathan
Hi, I would like to block specific document types to be uploaded in salesforce. Is there a possibility to apply a filter so there i.e could only be uploaded jpeg's?
Greetings
Jonathan
Hi, I build a selfmade Event Component and I would like to add the "View Calendar Button that mades the same as the one in the standart Component. Could you give me a guide how to implement it in my code? I post my component and controller. tell me if you need the apex too.

Greetings
Jonathan

COMPONENT:

<aura:component controller="EventController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="events" type="Event[]"/>
    <aura:attribute name="events2" type="Event[]"/>
    <aura:attribute name="events3" type="Event[]"/>

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="mycolumns2" type="List"/>
    <aura:attribute name="mycolumns3" type="List"/>
    
    <aura:attribute name="currentDate" type="string"/>
    <aura:attribute name="TomorrowDate" type="string"/>
    <aura:attribute name="AfterTomorrowDate" type="string"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    
    <lightning:card iconName="standard:event" title="Event">
        <div class="slds-card__body slds-card__body_inner"> 
        </div>
        
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            Heute {!v.currentDate}       
        </div>     
        <div>
            <aura:if isTrue="{!not(empty(v.events))}">
                <lightning:datatable data="{!v.events}" 
                                     columns="{!v.mycolumns}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Termine</div>
                </aura:set>
            </aura:if>
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            Morgen  {!v.TomorrowDate}        
        </div>        
        <div>
            <aura:if isTrue="{!not(empty(v.events2))}">
                <lightning:datatable data="{!v.events2}" 
                                     columns="{!v.mycolumns2}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Termine</div>
                </aura:set>
            </aura:if>
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            In 2 Tagen  {!v.AfterTomorrowDate}      
        </div>     
        <div>
            <aura:if isTrue="{!not(empty(v.events3))}">
                <lightning:datatable data="{!v.events3}" 
                                     columns="{!v.mycolumns3}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Termine</div>
                </aura:set>
            </aura:if>
        </div>
             
    </lightning:card>
</aura:component>

CONTROLLER:

({
    doInit: function(component, event, helper) {
        
         var today = new Date();
        var date = today.getDate();
        var tomorrowdate = today.getDate()+1;
        var aftertomorrowdate = today.getDate()+2;
        var month = today.getMonth()+1;
        var year = today.getFullYear();
        var result = date +'.'+month;
        var result2 = tomorrowdate +'.'+month;
        var result3 = aftertomorrowdate +'.'+month;
        component.set('v.currentDate', result);
        component.set('v.TomorrowDate', result2);
        component.set('v.AfterTomorrowDate', result3);
        
        
            
        component.set('v.mycolumns', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url', typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            { label: "StartTime", fieldName: "StartDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            { label: "EndTime", fieldName: "EndDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            
        ]);
        console.log('Before Event');
        var action = component.get("c.loadEvents");
        console.log('After Event');
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.SubjectName= '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                    record.StartDate= record.StartDateTime;
                });
                component.set("v.events", records);
            }
        });
        $A.enqueueAction(action);
        
        component.set('v.mycolumns2', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url', typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            { label: "StartTime", fieldName: "StartDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            { label: "EndTime", fieldName: "EndDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            
        ]);
        console.log('Before Event');
        var action = component.get("c.loadEvents2");
        console.log('After Event');
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.SubjectName= '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                    record.StartDate= record.StartDateTime;
                    record.EndDate= record.EndDateTime;
                });
                component.set("v.events2", records);
            }
        });
        $A.enqueueAction(action);
            
            
            component.set('v.mycolumns3', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url', typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            { label: "StartTime", fieldName: "StartDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            { label: "EndTime", fieldName: "EndDateTime", type: "date", typeAttributes:{ hour: "2-digit", minute: "2-digit" } },
            
        ]);
        console.log('Before Event');
        var action = component.get("c.loadEvents3");
        console.log('After Event');
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.SubjectName= '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                    record.StartDate= record.StartDateTime;
                });
                component.set("v.events3", records);
            }
        });
        $A.enqueueAction(action);
    },
    
})
Hi I build a Task component. I would like to add the view all button from the standart into the top right corner. Could you tell me how to modify my code so I can achive this. (I will only show the code sample of the first section "Überfällig" so it will be easier to read)
I already found this side but I dont know how to implement it in my code: https://www.infallibletechie.com/2018/07/adding-view-all-button-in.html

Greetings
JonathanUser-added image
COMPONENT:

<aura:component controller="TaskController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    
    <aura:attribute name="recordId" type="Id" />    
    <aura:attribute name="tasks" type="Task[]"/>
    <aura:attribute name="tasks2" type="Task[]"/>
    <aura:attribute name="tasks3" type="Task[]"/>
    <aura:attribute name="tasks4" type="Task[]"/>
    
                                              
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>   
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="mycolumns2" type="List"/>
    <aura:attribute name="mycolumns3" type="List"/>
    <aura:attribute name="mycolumns4" type="List"/>
    
    <aura:attribute name="currentDate" type="string"/>
    <aura:attribute name="TomorrowDate" type="string"/>
    <aura:attribute name="AfterTomorrowDate" type="string"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    
                                                 
    <lightning:card iconName="standard:task" title="Tasks">
        <div class="slds-card__body slds-card__body_inner">           
        </div>
        
  <div style= "font-size: 14px; font-weight: bold;">
      Vergangen        
  </div>
        <div>
            <aura:if isTrue="{!not(empty(v.tasks))}">
                <lightning:datatable data="{!v.tasks }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> " There are no Tasks currently "</div>
                </aura:set>
            </aura:if>
        </div>
     
    </lightning:card>
</aura:component>

CONTROLLER:
({
    doInit: function(component, event, helper) {
    
         var today = new Date();
        var date = today.getDate();
        var tomorrowdate = today.getDate()+1;
        var aftertomorrowdate = today.getDate()+2;
        var month = today.getMonth()+1;
        var year = today.getFullYear();
        var result = date +'.'+month +'.'+ year;
        var result2 = tomorrowdate +'.'+month + '.' + year;
        var result3 = aftertomorrowdate + '.'+ month +'.' + year;
        component.set('v.currentDate', result);
        component.set('v.TomorrowDate', result2);
        component.set('v.AfterTomorrowDate', result3);
        
      
            component.set('v.mycolumns', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            {label: 'Status', fieldName: 'Status', type: 'picklist'},
        ]);
        var action = component.get("c.loadTasks");
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);
   

APEX:

public with sharing class TaskController {
    
//ÜBERFÄLLIG - Abfrage Tasks, wo das Activity Date abgelaufen und der Status "Not Completed" ist//
@AuraEnabled
public static List<Task> loadTasks(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate, Status FROM Task WHERE WhatId=:recordId And ActivityDate< TODAY AND OwnerId=:userId AND Status !='Completed'];
}


                
Hi, I build a Task component:User-added image
I would like to add the view all button to my component.
It should do the same like the view all button in the standart component.
Could you give me help how to do it?
Hi, I would like to add the todays date next to the "Heute" title. Could you tell me how to insert it in the code below?
User-added imageUser-added image
Hi, I build a Task Component. I would like to delete the ActivityDate as a column and replace it with status as a column. In addition I would like to have a "View All "-Button for the tasks next the right side at the row of "Tasks"-header

User-added image
<aura:component controller="TaskController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    
    <aura:attribute name="recordId" type="Id" />    
    <aura:attribute name="tasks" type="Task[]"/>
    <aura:attribute name="tasks2" type="Task[]"/>
    <aura:attribute name="tasks3" type="Task[]"/>
    <aura:attribute name="tasks4" type="Task[]"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>   
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="mycolumns2" type="List"/>
    <aura:attribute name="mycolumns3" type="List"/>
    <aura:attribute name="mycolumns4" type="List"/>
                                                   
    <lightning:card iconName="standard:task" title="Tasks">
        <div class="slds-card__body slds-card__body_inner">           
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            Überfällig        
        </div>
        <div>
            <aura:if isTrue="{!not(empty(v.tasks))}">
                <lightning:datatable data="{!v.tasks }" 
                                     columns="{!v.mycolumns }" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Aufgaben</div>
                </aura:set>
            </aura:if>
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            Heute        
        </div>      
        <div>
            <aura:if isTrue="{!not(empty(v.tasks2))}">
                <lightning:datatable data="{!v.tasks2}" 
                                     columns="{!v.mycolumns2}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Aufgaben</div>
                </aura:set>
            </aura:if>
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px; ">
            Morgen        
        </div>       
        <div>
            <aura:if isTrue="{!not(empty(v.tasks3))}">
                <lightning:datatable data="{!v.tasks3}" 
                                     columns="{!v.mycolumns3}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Aufgaben</div>
                </aura:set>
            </aura:if>
        </div>
        
        <div style= "font-size: 14px; font-weight: bold; margin-left:15px; margin-top:10px;">
            In 2 Tagen        
        </div>    
        <div>
            <aura:if isTrue="{!not(empty(v.tasks4))}">
                <lightning:datatable data="{!v.tasks4}" 
                                     columns="{!v.mycolumns4}" 
                                     keyField="Id"
                                     hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center">Keine Aufgaben</div>
                </aura:set>
            </aura:if>
        </div> 
        
    </lightning:card>
</aura:component>



Controller:

({
    doInit: function(component, event, helper) {
        
        component.set('v.mycolumns', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            { label: "ActivityDate", fieldName: "ActivityDate", type: "date-local", typeAttributes:{ month: "2-digit", day: "2-digit" } },
            
        ]);
        var action = component.get("c.loadTasks");
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);
            
            
            component.set('v.mycolumns2', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},            
            { label: "ActivityDate", fieldName: "ActivityDate", type: "date-local", typeAttributes:{ month: "2-digit", day: "2-digit" } },            
        ]);
        var action = component.get("c.loadTasks2");
        
        
        
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
          
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks2", records);
            }
        });
        $A.enqueueAction(action);
        
        
            component.set('v.mycolumns3', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},            
            { label: "ActivityDate", fieldName: "ActivityDate", type: "date-local", typeAttributes:{ month: "2-digit", day: "2-digit" } },            
        ]);
        var action = component.get("c.loadTasks3");
        
        
        
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
          
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks3", records);
            }
        });
        $A.enqueueAction(action);
                
                
             component.set('v.mycolumns4', [
            {label: 'Subject', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},            
            { label: "ActivityDate", fieldName: "ActivityDate", type: "date-local", typeAttributes:{ month: "2-digit", day: "2-digit" } },            
        ]);
        var action = component.get("c.loadTasks4");
        
        
        
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
          
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.SubjectName = '/'+record.Id;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks4", records);
            }
        });
        $A.enqueueAction(action);

    },
   
})


Apex:

public with sharing class TaskController {
    
//ÜBERFÄLLIG - Abfrage Tasks, wo das Activity Date abgelaufen und der Status "Not Completed" ist//
@AuraEnabled
public static List<Task> loadTasks(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate< TODAY AND OwnerId=:userId AND Status !='Completed'];
}
    
//HEUTE - Abfrage Tasks, wo das Activity Date gleich heute ist//     
@AuraEnabled
public static List<Task> loadTasks2(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate = TODAY AND OwnerId=:userId];
}
    
//MORGEN - Abfrage Tasks, wo das Activity Date Heute+1 entspricht//    
@AuraEnabled
public static List<Task> loadTasks3(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate = TOMORROW AND OwnerId=:userId];
}
    
//ÜBERMORGEN - Abfrage Tasks, wo das Activity Date Heute+2 entspricht//    
@AuraEnabled
public static List<Task> loadTasks4(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate > TOMORROW AND ActivityDate <= Next_N_Days:2 AND OwnerId=:userId];
}

//OHNE DATE - Abfrage Tasks, wo kein Activity Date vorhanden ist//     
@AuraEnabled
public static List<Task> loadTasks5(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate = null AND OwnerId=:userId]; 
}
    
}
Hello,
I build a custom Event component that I would like to convert into Liveground. I know, that I need to build a test class for my apex class.
The component just displays the subject, activityDate, Start and EndDate of an event. Could you give me a code for the test class.
The apex class code is this:

public with sharing class EventController {
  

    @AuraEnabled
  public static List<Event> loadEvents(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= TODAY 
           AND ActivityDate  < Next_N_Days:1 AND OwnerId=:userId ];
  }
    @AuraEnabled
  public static List<Event> loadEvents2(Id recordId){
      string userId = UserInfo.getUserId();
      Date tomorrowDate = Date.today().addDays(1);
    Date dayAfterTomorrow = tomorrowDate.addDays(1);
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= :tomorrowDate AND ActivityDate  < :dayAfterTomorrow AND OwnerId=:userId ];
  }

    @AuraEnabled
  public static List<Event> loadEvents3(Id recordId){
      string userId = UserInfo.getUserId();
      Date tomorrowDate = Date.today().addDays(1);
      Date dayAfterTomorrow = tomorrowDate.addDays(1);
      Date twodaysAfterTomorrow = tomorrowDate.addDays(2);
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= :dayAfterTomorrow AND ActivityDate  < :twodaysAfterTomorrow AND OwnerId=:userId ];
  }
    
}


 
Hi, I build an Component and Controller to show the tasks of specific days. I tried it with the code below but it doesn't display the tasks of tomorrow (loadTasks3) and the day after tomorrow (loadTasks4)
Could you help me with this issue

Greetings 
Jonathan


public with sharing class TaskController {
  
    @AuraEnabled
  public static List<Task> loadTasks(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate< TODAY 
           AND OwnerId=:userId AND Status !='Completed' ];
  }
    @AuraEnabled
  public static List<Task> loadTasks2(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate>= TODAY 
           AND ActivityDate  < Next_N_Days:1 AND OwnerId=:userId ];
  }
    @AuraEnabled
  public static List<Task> loadTasks3(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate>= Next_N_Days:1 
           AND ActivityDate  < Next_N_Days:2 AND OwnerId=:userId ];
  }
    @AuraEnabled
  public static List<Task> loadTasks4(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate>= Next_N_Days:2 
           AND ActivityDate  < Next_N_Days:3 AND OwnerId=:userId ];
  }
  @AuraEnabled
  public static Task saveTask(Task task){
    upsert task;
    return task;
   }
}
Hi, I tried to build an Event component. I am not experienced in SF and have an error, that I cant solve. Could you try out the code and tell me how to solve this error:User-added image

<aura:component controller="EventController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="newEvent" type="Event" default="{'sobjectType':'Event'}"/>
    <aura:attribute name="event" type="Event[]"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="mycolumns" type="List"/>
    <lightning:card iconName="standard:event" title="Event">
        <div class="slds-card__body slds-card__body_inner"> 
        </div>
        <div>
            <aura:if isTrue="{!not(empty(v.events))}">
                <lightning:datatable data="{!v.events }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> " There are no Events currently "</div>
                </aura:set>
            </aura:if>
        </div>
    </lightning:card>
</aura:component>


Controller:
({
    doInit: function(component, event, helper) {
        
        component.set('v.mycolumns', [
            {label: 'Id', fieldName: 'Id', type: 'url', 
            typeAttributes: {label: { fieldName: 'Id' }, target: '_blank'}},
            
            {label: 'Subject', fieldName: 'Id', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            {label: 'Activity Date', fieldName: 'ActivityDate', type: 'text'},
            
        ]);
        var action = component.get("c.loadEvents");
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.Subject= record.Subject;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.event", records);
            }
        });
        $A.enqueueAction(action);
    },
    createNewTask : function(component, event, helper) {
        var action = component.get("c.saveEvent");
        var newEvent = component.get("v.newEvent");
        action.setParams({
            "event": newEvent
        });
        action.setCallback(this,function(response){
            var state = response.getState();
                        
            if(component.isValid() && state === "SUCCESS"){
                
                var items = component.get("v.events");
                items.push(response.getReturnValue());
                component.set("v.events",items);
            }
            else{
                console.log("Failed with state "+state);
            }
        });
        $A.enqueueAction(action);
    }
})

Apex:
public with sharing class EventController {
  @AuraEnabled
  public static List<Event> loadEvents(Id recordId){
    return[SELECT Subject, ActivityDate FROM Event WHERE WhatId=:recordId And ActivityDate>= TODAY AND ActivityDate  <= Next_N_Days:3];
  }
  @AuraEnabled
  public static Event saveEvent(Event event){
    upsert event;
    return event;
   }
}

Hello, how you see below, I as an administrator cant change the status of campaigns. Could you tell me what the error could be? I dont have any validation rules that could block it. For my Lightning Users the problem does not occure. Can you tell me how to solve it?
User-added image
Hi, I have the problem that I can't change the status of campaign members in one layout I made:User-added image

I made a short Layout in which I took out some field and had the problem that I could not change the status like shown above. I changed the layout and now it is working. what could be the reason?
Hi, I would like to block specific document types to be uploaded in salesforce. Is there a possibility to apply a filter so there i.e could only be uploaded jpeg's?
Greetings
Jonathan
Hi, I would like to add the todays date next to the "Heute" title. Could you tell me how to insert it in the code below?
User-added imageUser-added image
Hi, I tried to build an Event component. I am not experienced in SF and have an error, that I cant solve. Could you try out the code and tell me how to solve this error:User-added image

<aura:component controller="EventController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="newEvent" type="Event" default="{'sobjectType':'Event'}"/>
    <aura:attribute name="event" type="Event[]"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="mycolumns" type="List"/>
    <lightning:card iconName="standard:event" title="Event">
        <div class="slds-card__body slds-card__body_inner"> 
        </div>
        <div>
            <aura:if isTrue="{!not(empty(v.events))}">
                <lightning:datatable data="{!v.events }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> " There are no Events currently "</div>
                </aura:set>
            </aura:if>
        </div>
    </lightning:card>
</aura:component>


Controller:
({
    doInit: function(component, event, helper) {
        
        component.set('v.mycolumns', [
            {label: 'Id', fieldName: 'Id', type: 'url', 
            typeAttributes: {label: { fieldName: 'Id' }, target: '_blank'}},
            
            {label: 'Subject', fieldName: 'Id', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            {label: 'Activity Date', fieldName: 'ActivityDate', type: 'text'},
            
        ]);
        var action = component.get("c.loadEvents");
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.Subject= record.Subject;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.event", records);
            }
        });
        $A.enqueueAction(action);
    },
    createNewTask : function(component, event, helper) {
        var action = component.get("c.saveEvent");
        var newEvent = component.get("v.newEvent");
        action.setParams({
            "event": newEvent
        });
        action.setCallback(this,function(response){
            var state = response.getState();
                        
            if(component.isValid() && state === "SUCCESS"){
                
                var items = component.get("v.events");
                items.push(response.getReturnValue());
                component.set("v.events",items);
            }
            else{
                console.log("Failed with state "+state);
            }
        });
        $A.enqueueAction(action);
    }
})

Apex:
public with sharing class EventController {
  @AuraEnabled
  public static List<Event> loadEvents(Id recordId){
    return[SELECT Subject, ActivityDate FROM Event WHERE WhatId=:recordId And ActivityDate>= TODAY AND ActivityDate  <= Next_N_Days:3];
  }
  @AuraEnabled
  public static Event saveEvent(Event event){
    upsert event;
    return event;
   }
}
Hello, I build an Task component. I want the link on the subject to lead to the task. I only achived to show the ID, but it doesnt lead to the task. In addition I would like to change it, that only my tasks are shown instead of all.
Could you look over my code and tell me how to fix this problem?User-added image

<aura:component controller="TaskController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="newTask" type="Task" default="{'sobjectType':'Task'}"/>
    <aura:attribute name="tasks" type="Task[]"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="mycolumns" type="List"/>
    <lightning:card iconName="standard:task" title="Tasks">
        <div class="slds-card__body slds-card__body_inner">
        </div>
        <div>
            <aura:if isTrue="{!not(empty(v.tasks))}">
                <lightning:datatable data="{!v.tasks }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> " There are no Tasks currently "
             </div>
                </aura:set>
            </aura:if>
        </div>
    </lightning:card>
</aura:component>

Controller:
({
    doInit: function(component, event, helper) {
        component.set('v.mycolumns', [
            {label: 'Id', fieldName: 'Id', type: 'url', 
            typeAttributes: {label: { fieldName: 'Id' }, target: '_blank'}},
            
            {label: 'Subject', fieldName: 'Id', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            
            {label: 'Activity Date', fieldName: 'ActivityDate', type: 'text'},
        ]);
        var action = component.get("c.loadTasks");
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
                    record.Subject= record.Subject;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);
    },
    createNewTask : function(component, event, helper) {
        var action = component.get("c.saveTask");
        var newTask = component.get("v.newTask");
        action.setParams({
            "task": newTask
        });
        action.setCallback(this,function(response){
            var state = response.getState();
   
            if(component.isValid() && state === "SUCCESS"){
                var items = component.get("v.tasks");
                items.push(response.getReturnValue());
                component.set("v.tasks",items);
            }
            else{
                console.log("Failed with state "+state);
            }
        });
        $A.enqueueAction(action);
    }
})

Apex:
public with sharing class TaskController {
  @AuraEnabled
  public static List<Task> loadTasks(Id recordId){
    return[SELECT Subject, ActivityDate FROM Task WHERE WhatId=:recordId And ActivityDate>= TODAY AND ActivityDate  <= Next_N_Days:3];
  }
  @AuraEnabled
  public static Task saveTask(Task task){
    upsert task;
    return task;
   }
}
Hi,
I want to build or change the existing Todays-Tasks-Component so it shows the tasks of today and the following 7 days. I dont want the users to have to make clicks to see these tasks. Can you give me a guide to achive it?

Greetings
Jonathan
Hi,
I want to build a chatter component so it only shows the last 5 messages with only title and author. Can I do it and even change it that it only shows specific (i.e. to me) messages?

Thank you :)
Jonathan
Hello, I tried to use a calendar component I found on the internet. I have some errors with it, that I cant solve. Could you try it out and tell me what to change?.

Greetings Jonathan

Visualforce:
<apex:page controller="repeatCont" id="thePage" >
<apex:stylesheet value="/sCSS/Theme2/default/homeCalendar.css" />
<apex:form id="theForm">
<apex:outputPanel id="theCalendar" >
<div class="mCalendar" style="width:182px;" >
<div class="topLeft" >
<div class="topRight"/>
</div>
<div class="body">
<table cellspacing="0" cellpadding="2" border="0">
<tbody>
<tr class="header">
<td><apex:commandLink action="{!prev}" rerender="theCalendar">
<img title="Previous Month" class="prevCalArrow" alt="Previous Month" src="/s.gif" />
</apex:commandLink>
</td>
<td colspan="5" >
{!month.monthname} {!month.yearname}
</td>
<td><apex:commandLink action="{!next}" rerender="theCalendar">
<img title="Next Month" class="nextCalArrow" alt="Next Month" src="/s.gif" />
</apex:commandLink>
</td>
</tr>
<tr>
<th scope="col" class="calDays">Sun</th>
<th scope="col" class="calDays">Mon</th>
<th scope="col" class="calDays">Tue</th>
<th scope="col" class="calDays">Wed</th>
<th scope="col" class="calDays">Thu</th>
<th scope="col" class="calDays">Fri</th>
<th scope="col" class="calDays">Sat</th>
</tr>
<apex:repeat value="{!weeks}" var="wk" id="foreachWeek">
<tr class="days">
<!-- or highlight -->
<apex:repeat value="{!wk.days}" var="day" id="foreachday">
<td valign="top">
<a class="calActive" href="/00U/c—md0=2008&md3={!day.dayOfYear}" target="_blank"
title="Day View - {!day.date}"> {!day.dayofmonth2}
</a>
</td>
</apex:repeat>
</tr>
</apex:repeat>
</tbody>
</table>
</div>
<div class="bottomLeft"><div class="bottomRight"/></div>
</div>
</apex:outputPanel>
</apex:form>
</apex:page>

Controller:

public class repeatCont {
public void next() {
addMonth(1);
}
public void prev() {
addMonth(-1);
}
public repeatCont() {
Date d = system.today(); // default to today
Integer mo = d.month();
String m_param = System.currentPageReference().getParameters().get('mo');
String y_param = System.currentPageReference().getParameters().get('yr');
// allow a month to be passed in on the url as mo=10
if (m_param != null) {
Integer mi = Integer.valueOf(m_param);
if (mi > 0 && mi <= 12) {
d = Date.newInstance(d.year(),mi,d.day());
}
}
// and year as yr=2008
if (y_param != null) {
Integer yr = Integer.valueOf(y_param);
d = Date.newInstance(yr, d.month(), d.day());
}
setMonth(d);
}
public List<Month.Week> getWeeks() {
system.assert(month!=null,'month is null');
return month.getWeeks();
}
public Month getMonth() { return month; }

private void setMonth(Date d) {
month = new Month(d);
system.assert(month != null);
Date[] da = month.getValidDateRange(); // gather events that fall in this month
events = [ select id,subject,description,activitydate,activitydatetime,DurationInMinutes from Event where activitydate >= :da[0] AND activityDate <= :da[1]
order by activitydatetime];
month.setEvents(events); // merge those events into the month class
}
private void addMonth(Integer val) {
Date d = month.getFirstDate();
d = d.addMonths(val);
setMonth(d);
}
private List<Event> events;
private Month month;
}

public class eventItem {
public Event ev;
public String formatedDate; 
public eventItem(Event e) { 
    ev= e;
    Datetime endd = e.activitydatetime.addMinutes(e.DurationInMinutes);
            formatedDate = e.activitydatetime.format('h:mm a') + 
    ' - ' + endd.format('h:mm a');
    system.debug(formateddate);
}
public Event getEv() { return ev; }
public String getFormatedDate() { return formatedDate; }
    
public class Month {
private List<Week> weeks; 
public Date firstDate; 
private Date upperLeft; 

public List<Date> getValidDateRange() { 
    List<Date> ret = new List<Date>();
    ret.add(upperLeft);
    ret.add(upperLeft.addDays(5*7) );
    return ret;
}

public String getMonthName() { 
    return DateTime.newInstance(firstDate.year(),firstdate.month(),firstdate.day()).format('MMMM');


public String getYearName() { 
    return DateTime.newInstance(
    firstDate.year(),firstdate.month(),firstdate.day()).format('yyyy');


public String[] getWeekdayNames() { 
    Date today = system.today().toStartOfWeek();
    DateTime dt = DateTime.newInstanceGmt(today.year(),today.month(),today.day());      
    list<String> ret = new list<String>();
    for(Integer i = 0; i < 7;i++) { 
        ret.add( dt.formatgmt('EEEE') );
        dt= dt.addDays(1);
    } 
    return ret;
}

public Date getfirstDate() { return firstDate; } 

public Month( Date value ) {
    weeks = new List<Week>();
    firstDate = value.toStartOfMonth();
    upperLeft = firstDate.toStartOfWeek();
    Date tmp = upperLeft;
    for (Integer i = 0; i < 5; i++) {
        Week w = new Week(i+1,tmp,value.month());   
        system.assert(w!=null); 
        this.weeks.add( w );
        tmp = tmp.addDays(7);
    }

}

public void setEvents(List<Event> ev) { 
    for(Event e:ev) { 
        for(Week w:weeks) { 
            for(Day c: w.getDays() ) { 
                if ( e.ActivityDate.isSameDay(c.theDate))  { 
                    // add this event to this calendar date
                    c.eventsToday.add(new EventItem(e));
                    // add only three events, then a More... label if there are more
                } 
            } 
        } 
    }
}

public List<Week> getWeeks() { 
    system.assert(weeks!=null,'could not create weeks list');
    return this.weeks; 
}

public class Week {
 public List<Day> days;
 public Integer weekNumber; 
 public Date startingDate; 

 public List<Day> getDays() { return this.days; }

 public Week () { 
    days = new List<Day>();     
 }
 public Week(Integer value,Date sunday,Integer month) { 
    this();
    weekNumber = value;
    startingDate = sunday;
    Date tmp = startingDate;
    for (Integer i = 0; i < 7; i++) {
        Day d = new Day( tmp,month ); 
        tmp = tmp.addDays(1);
        d.dayOfWeek = i+1;          
        days.add(d);
    } 

 }
 public Integer getWeekNumber() { return this.weekNumber;}
 public Date getStartingDate() { return this.startingDate;}

}

public class Day {

    public Date         theDate;
    public List<EventItem>  eventsToday; 
    public Integer      month, dayOfWeek;
    public String       formatedDate;  
    private String      cssclass = 'calActive';

    public Date         getDate() { return theDate; }
    public Integer      getDayOfMonth() { return theDate.day(); }
    public String       getDayOfMonth2() { 
        if ( theDate.day() <= 9 ) 
            return '0'+theDate.day(); 
        return String.valueof( theDate.day()); 
    }
    public Integer getDayOfYear() { return theDate.dayOfYear(); }
    public List<EventItem>  getDayAgenda() { return eventsToday; }
    public String       getFormatedDate() { return formatedDate; }
    public Integer      getDayNumber() { return dayOfWeek; }
    public List<EventItem>  getEventsToday() { return eventsToday; }
    public String       getCSSName() {  return cssclass; }

    public Day(Date value,Integer vmonth) { 
        theDate=value; month=vmonth;        
        formatedDate = '12 21 08';// time range..
        //9:00 AM - 1:00 PM
        eventsToday = new List<EventItem>();  
        // three possible Inactive,Today,Active  
        if ( theDate.daysBetween(System.today()) == 0 ) cssclass ='calToday';
        // define inactive, is the date in the month?
        if ( theDate.month() != month) cssclass = 'calInactive';
    }

}