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

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 190
    Questions
  • 84
    Replies
Hello,

I want to create a cms permission set for experience building The problem I face is, that I have only the fields "CMS Channels" and "CMS Workspaces" but I miss "CMS Home" and "CMS Experience.". Do I have to change something to get these fields displayingUser-added image
Hi I have a apex class 'XLSXGenerator' which contains a method generate. When I insert XLSXGenerator.generate(new List<String>); in the execute Apex in Workbench, i get an xlsx as result. But I would like to trigger it with a visualforce button instead of workbench. Could you tell me how i can achive this?

My apex class:
 
public class XLSXGenerator {

    public PageReference generate() {
        return null;
    }

    //public static String generate(List<String> textList) {
    public static String generate(List<String> AccList) {
        // Build XLSX File Content
        PageReference xlsxTemplate = page.XLSXTemplate;
    //    xlsxTemplate.getParameters().put('textList', System.JSON.serialize(textList));
        xlsxTemplate.getParameters().put('AccList', System.JSON.serialize(AccList));
        Blob xlsxContent;
        if (Test.isRunningtest()) {
            xlsxContent = Blob.valueOf('Sample');
        } else {
            xlsxContent = xlsxTemplate.getContent();
        }
        // Build XLSX File Frame
        StaticResource xlsxTemplateFrame = [SELECT Body FROM StaticResource WHERE Name = 'XLSXTemplateFrame' LIMIT 1];
        Zippex xlsx = new Zippex(xlsxTemplateFrame.Body);
        // Add the Content to the Frame to complete the File
        xlsx.addFile('xl/worksheets/sheet1.xml', xlsxContent, null);
        // Save XLSX File 
        ContentVersion cv = new ContentVersion();
        String title = 'XLSXExample';
        cv.Title = title;
        cv.PathOnClient = title + ' - ' + DateTime.now() + '.xlsx';
        cv.VersionData = xlsx.getZipArchive();
        insert cv;
        Id contentDocumentid = [SELECT Id FROM ContentDocument WHERE LatestPublishedVersionId = :cv.Id].Id;
        return URL.getOrgDomainUrl().toExternalForm() + '/sfc/servlet.shepherd/document/download/' + contentDocumentid;
    }

}

 
Hi, I have a Site with the URL of this form:
https//: MySite.com/FSR/s/?RecordID=0027a00003JsuTW

I also have a custom flow component within the Site which creates a rich text field. I would like to use the ID from the URL into the Component. I pass the RecordID with an email so its not possible to just query it. Could you tell me how to change my code to get the Id from the URL?

My custom flow component:
 
<aura:component implements="lightning:availableForFlowScreens,force:hasRecordId, force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="label" type="String" access="global" />
     <aura:attribute name="value" type="String" access="global" />
     <aura:attribute name="required" type="Boolean" access="global" />
     <aura:attribute name="placeHolder" type="String" access="global" />
    
    <aura:handler name="init" value="{!this}" action="{! c.doInit }" />
    
    <aura:attribute name="validate" type="Aura.Action" />
    
    <lightning:inputRichText value="{!v.value}"
                             required="{!v.required}"
                             placeHolder="{!v.placeHolder}"
                             labelVisible="true"
                             variant="bottom-toolbar"
                             label="{!v.label}">
        <lightning:insertImageButton/>
    </lightning:inputRichText>
</aura:component>

Controller
({
    doInit: function(component, event, helper) {
        component.get("v.recordId");
      
       component.set('v.validate', function() {
           var userInput = component.get('v.value');
           if(userInput) {
               return { isValid: true };
           } else if(!userInput &&  component.get("v.required")){
                     
                      return { isValid: false, errorMessage: 'A value is required.' };
       }else{
                     return{ isValid: true};
                     }
              
           });
	}
})

 
Hello,
I am in the following situation:
I want to use a flow in my experience Builder Site.
I have used the flow component but I could also utilize the flow within visualforce. The problem I have is, that I would like to enter the Record Id from the URL into the first text field. ( shown below you can see my Site and the flow which I would like to fill with the URL-RecordId. Could you tell me a way I can achive it?
User-added image
fs
Hello, I have the following topic:
I want to send email from salesforce to multiple accounts. The record id should be stored inside a button within the template. By clicking the button I want to lead to a site where the accounts record Id is passed into. Could you give me an example for email template and site etc. where this kind of task is adressed.

Greetings 
Jonathan
Hi I tried to create a javascript button, but I face some problems with it. Now I want to try it with a visualforce button. The apex execute action I want to trigger with the button is "XLSXGenerator.generate(new List<String>{});"

Could you give me an example of a visualforce with a button that executes this apex?
Hello, I created a Detail page button to trigger an apex action. I created Detail Page Button -> Execute Javascript -> OnClick Javascript and the I added my code . But the button does not show up in my account template even though I added it into my layout.
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} if({!Account.Name}!=Null) { XLSXGenerator.generate(new List<String>{}); alert("This is {!Account.Name}"); }
Hello, I have a XLSXGenerator apex. I want to start the apex by using a button. For now I can only start it by workbench.
In workbench i make apex execute with the command:
XLSXGenerator.generate(new List<String>{})

The XLSXGenarator code is:
 
public class XLSXGenerator {
    //public static String generate(List<String> textList) {
    public static String generate(List<String> AccList) {
        // Build XLSX File Content
        PageReference xlsxTemplate = page.XLSXTemplate;
    //    xlsxTemplate.getParameters().put('textList', System.JSON.serialize(textList));
        xlsxTemplate.getParameters().put('AccList', System.JSON.serialize(AccList));
        Blob xlsxContent;
        if (Test.isRunningtest()) {
            xlsxContent = Blob.valueOf('Sample');
        } else {
            xlsxContent = xlsxTemplate.getContent();
        }
        // Build XLSX File Frame
        StaticResource xlsxTemplateFrame = [SELECT Body FROM StaticResource WHERE Name = 'XLSXTemplateFrame' LIMIT 1];
        Zippex xlsx = new Zippex(xlsxTemplateFrame.Body);
        // Add the Content to the Frame to complete the File
        xlsx.addFile('xl/worksheets/sheet1.xml', xlsxContent, null);
        // Save XLSX File 
        ContentVersion cv = new ContentVersion();
        String title = 'XLSXExample';
        cv.Title = title;
        cv.PathOnClient = title + ' - ' + DateTime.now() + '.xlsx';
        cv.VersionData = xlsx.getZipArchive();
        insert cv;
        Id contentDocumentid = [SELECT Id FROM ContentDocument WHERE LatestPublishedVersionId = :cv.Id].Id;
        return URL.getOrgDomainUrl().toExternalForm() + '/sfc/servlet.shepherd/document/download/' + contentDocumentid;
    }

}

​​​​​​​
Hello, I use a command in Apex execute from workbench to create xlsx.
The command in the xlsx is: 
XLSXGenerator.generate(new List<String>{'Apex', 'Create', 'XLSX', 'By Raymar'})
 I would like to execute the command with a button from account object. could you tell me if it is possible and how I can do it?
Hi I saw that it is somehow possible to create an input component that I can add to a flow. The requirement I have are radio buttons that lead to the next screen automatically when the buttons are clicked. Could you give me a code example which would work on this topic?

Greetings
Jonathan
Hello, I have a component on account object. I want to render part of the component dependend on if the checkbox 'Urlaub__c' on the ownerUser is true. The problem I have is, that with the way I did it the section Is not showing up even tough the checkbox is true. Could you tell me what to change so that it works?
 
<aura:if isTrue="{!v.OwnerUser.Urlaub__c}">
            <lightning:layoutItem padding="around-small">                
                <br></br> 
                
                <div class="header-column" width="100%">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Vertreter__c.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.Vertreter__c.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon"   /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Vertretung__c.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Vertreter__c.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
                   
            </lightning:layoutItem>
              </aura:if>

 
Hello,
I have a checkbox field named "Urlaub__c" on my user. Now I would like to render a Component on Accounts which I would like to have a section that is hidden, when the Urlaub__c checkbox of the owneruser is not checked.
I tried it like that:
 <div class="header-column" width="100%" rendered="{v.OwnerUser.Urlaub__c == 'true'}">

But the section does still not hide when I uncheck the box. Could you tell me what I need to change?
Hello, I build a small Visualforce page with an apex class. 
I get the error "Illegal conversion from Contact to System.PageReference" at return obj; .
Could you tell me how I can fix this error?

VF:
 
<apex:page controller="updateJobStatus" action="{!updateRec}" cache="false">
	<apex:form>
		Thank you.
	</apex:form>
</apex:page>

Apex class:
 
public class  updateJobStatus{

	public String recId {get;set;}
	public String isJobCompleted {get;set;}

	public updateJobStatus() {
		recId = ApexPages.currentPage().getParameters().get('recId');
		isJobCompleted = ApexPages.currentPage().getParameters().get('isJobCompleted');
	}
	public PageReference updateRec() {
		
		Contact obj = new Contact();
		obj.Id = recId;
		obj.R_ckantwort__c = isJobCompleted;
		update obj;
        return obj;
       
	}


}

 
Hello, I have a component that displays the details of the account owner user :
User-added image
In the user page I have two custom fields " Urlaub" and Vertreter.

When Urlaub is checked I want the Details of the Vertreter to be displayed on the right of the component
User-added image
The problem I have is that the right side does not render right and I do not get the details of the right side.
Could you tell me how to fix it?

My Component Code:
 
<aura:component controller="VisitenkarteRecordDetails" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="OwnerUser" type="user" default="{'sobjectType' : 'User'}" />   
    <aura:attribute name="ids" type="id" default="{!v.recordId}" />
    
    <div class="c-container" style=" border-radius: 4px;  background-color: #FFFFFF; ">
        <lightning:layout >            
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <img src="{!v.OwnerUser.SmallPhotoUrl}" class="img_size" variant="circle" height="180px;"  />
                </div>
            </lightning:layoutItem>            
            <lightning:layoutItem padding="around-small">                
                <br></br>                
                <div class="header-column" width="100%">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon" /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">                
                <br></br>                
                <div class="header-column" width="100%" rendered="{v.OwnerUser.Urlaub__c == 'true'}">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Vertreter__c.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.Vertreter__c.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon"   /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Vertretung__c.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Vertreter__c.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
            </lightning:layoutItem>
             
        </lightning:layout>        
    </div>    
</aura:component>
 
({     
    doInit : function(component, event, helper) {       
        var AccountIDS=component.get("v.ids");             
        console.log('account ids'+ AccountIDS);              
        var action = component.get("c.fetchUserDetail");         
        action.setParams({                   
            "Accountids" : AccountIDS });        
        action.setCallback(this, function(response) {            
            var state = response.getState();            
            if (state === "SUCCESS") {               
                var res = response.getReturnValue();                
                component.set('v.OwnerUser', res);             
            }                                 
        });               
        $A.enqueueAction(action);      
    }, 
})

 
Hello,
I have a field on User with the name Vertreter__c which is a Hierarchy field. I want to display the Vertreter__c details in my component but I only get blank space. Could you tell me how I can make it work?

my code:
 
<aura:component controller="VisitenkarteRecordDetails" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="OwnerUser" type="user" default="{'sobjectType' : 'User'}" />   
    <aura:attribute name="ids" type="id" default="{!v.recordId}" />
    
    <div class="c-container" style=" border-radius: 4px;  background-color: #FFFFFF; ">
        <lightning:layout >            
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <img src="{!v.OwnerUser.SmallPhotoUrl}" class="img_size" variant="circle" height="180px;"  />
                </div>
            </lightning:layoutItem>            
            <lightning:layoutItem padding="around-small">                
                <br></br>                
                <div class="header-column" width="100%">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon" /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">                
                <br></br>                
                <div class="header-column" width="100%" rendered="{v.OwnerUser.Urlaub__c == 'false'}">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Vertreter__c.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.Vertreter__c.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon"   /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Vertretung__c.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
            </lightning:layoutItem>
             
        </lightning:layout>        
    </div>    
</aura:component>

 
Hi,
I want to create style my force .com site by doing CSS styling in Visualforce. Unfortunately the styling does not work for me. ( for the button styling it works, but not for the flow body. Could you tell me what to change about it?
<apex:page lightningStyleSheets="true" showHeader="false">
<style>

.FlowTextArea{
background-color:#00FFFF;
}
   </style>
   
<apex:slds />

<flow:interview name="Account_Site_Email_Antwort" 
buttonStyle="color:#050; background-color:#fed; border:1px solid;"/>

</apex:page>

 
Hello, I have a flow in a salesforce site. The problem I have is that I can click through the first 2 screens but when it comes to the decision and the 2 screens, I cant get to them. Could you tell me where the problem is?
User-added image
Hello I have a Screen Component with 2 radio buttons that have the value 'Ja' & 'Nein'. The thing I want to achive is a Lightning flow component, that includes the 2 radio buttons and when they are clicked automatically the next command happens, so I dont need 2 buttons. Could you share a code example with me?

Greetings
Jonathan
Hello, I tried to make a test class for my apex but I still get errors.
Could you give me some support:

Apex class
public class Kampagne_Brief{
    
    public string camId {get;set;}
    
    @InvocableMethod(Label = 'Kampagne_Brief' description='')  
    
    public static void Kampagne_Brief(List<Id> CampaignId) {
        
        string camName = [SELECT Id, Name FROM Campaign WHERE Id =: CampaignId.get(0) LIMIT 1].Name;
        String strDate = String.valueOf(System.now().dateGmt()); // FORMAT YYYY-MM-DD
        // String strDate = System.now().format('yyyyMMdd'); // FORMAT YYYYMMDD
        
        PageReference page = Page.Kampagne_Brief_PDF;
        
        page.getParameters().put('Id', CampaignId.get(0));
        
        string camId= page.getParameters().put('Id', CampaignId.get(0));
        // string camName = page.getParameters().put('Campaign.Name', CampaignId.get(0));
        Blob contentBlob = page.getContentAsPDF();
        
        ContentVersion cv = new ContentVersion();
        cv.VersionData = contentBlob;
        cv.Title = strDate + '_' + camName;
        //    cv.Title =  System.today().year() + '_' + System.today().month() + '_' + System.today().day() + '_' + 'Serienbrief_'+ camName;
        cv.PathOnClient =  strDate + '_' + camName + '.pdf';
        //    cv.PathOnClient =  System.today().year() + '_' + System.today().month()  + '_' + System.today().day() + '_' + 'Serienbrief.pdf';
        cv.Vertraulichkeitsstufe__c = 'Intern';
        cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
        insert cv;
        
        cv = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];
        
        ContentDocumentLink cdl = new ContentDocumentLink();
        cdl.ContentDocumentId = cv.ContentDocumentId;
        cdl.ShareType = 'I';
        cdl.LinkedEntityId = camId;
        insert cdl;
    }
}

My test class to this point:
I get the error message: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LinkedEntityId]: [LinkedEntityId]
 
@isTest 
public with sharing class Kampagnen_Brief_Test  {        
    static testmethod void contentDocumentTest()        {  
            
Campaign cam                        = new Campaign();
        cam.Name                            = 'Test Briefkampagne';
        cam.RecordTypeId                    = '0127a000001lOti';
        cam.IsActive                        = True;
        insert cam;

        
        ContentVersion cv = new ontentVersion();
        cv.Title = '2022-03-10_John Campaign';
        cv.PathOnClient = '2022-03-10_John Campaign.pdf';
        cv.VersionData = Blob.valueOf('Test Content');
        cv.IsMajorVersion = true;
        cv.Vertraulichkeitsstufe__c = 'Intern';
        cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
        Insert cv;
        ContentVersion contentVersion_2 = [SELECT Id, Title, ContentDocumentId 
                                           FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];   
        ContentDocumentLink contentlink = new ContentDocumentLink();
        
        contentlink.contentdocumentid = contentVersion_2.contentdocumentid;
        contentlink.ShareType = 'V';
        insert contentlink;
        Kampagne_Brief KB = new Kampagne_Brief();             
        
    }
    
    
}

 
Hello,
I work for a company that has no access to the Event Log Browser. Due to the upcoming update and the deletaion of API Version 20 and below, I want to find a way to get all things in my organisation where API Version 20 or below is being used.
Could you give me a way or a query that I can use in Workbench to get a List of affected parts?

Greetings
Jonathan
Hello, 
I would like to get a report as a visualforce. For this I made the code:

<apex:page standardController="account"> <analytics:reportChart reportId="00O0Q000000U9CyUAK"></analytics:reportChart> </apex:page>

When adding the visualforce to a page I get the error:

"The report chart is unavailable because the report's format is not summary or matrix."

What do I have to change to make it work?
Hello, I build a List button that Includes a Visualforce Page. When I chose Accounts in List view and click account I only see the blank Page without the account fields. Please tell me how to change it.

<apex:page standardController="Account" renderAs="pdf" recordSetVar="accounts" >
 

<h1>Welcome to APP!</h1>
 
<p>Thank you, <b><apex:outputText value=" {!Account.Name}"/></b>, for 
   working with APP.</p>
 
<p>Your account details are:</p>
 
<table>
<tr><th>Account Name</th>
    <td><apex:outputText value="{!Account.Name}"/></td>
    </tr>
<tr><th>Account Rep</th>
    <td><apex:outputText value="{!Account.Owner.Name}"/></td>
    </tr>
<tr><th>Customer Since</th>
    <td><apex:outputText value="{0,date,long}">
        <apex:param value="{!Account.CreatedDate}"/>
        </apex:outputText></td>
    </tr>
</table>
    
</apex:page>

User-added image


Result:

User-added image
Hello, I have a XLSXGenerator apex. I want to start the apex by using a button. For now I can only start it by workbench.
In workbench i make apex execute with the command:
XLSXGenerator.generate(new List<String>{})

The XLSXGenarator code is:
 
public class XLSXGenerator {
    //public static String generate(List<String> textList) {
    public static String generate(List<String> AccList) {
        // Build XLSX File Content
        PageReference xlsxTemplate = page.XLSXTemplate;
    //    xlsxTemplate.getParameters().put('textList', System.JSON.serialize(textList));
        xlsxTemplate.getParameters().put('AccList', System.JSON.serialize(AccList));
        Blob xlsxContent;
        if (Test.isRunningtest()) {
            xlsxContent = Blob.valueOf('Sample');
        } else {
            xlsxContent = xlsxTemplate.getContent();
        }
        // Build XLSX File Frame
        StaticResource xlsxTemplateFrame = [SELECT Body FROM StaticResource WHERE Name = 'XLSXTemplateFrame' LIMIT 1];
        Zippex xlsx = new Zippex(xlsxTemplateFrame.Body);
        // Add the Content to the Frame to complete the File
        xlsx.addFile('xl/worksheets/sheet1.xml', xlsxContent, null);
        // Save XLSX File 
        ContentVersion cv = new ContentVersion();
        String title = 'XLSXExample';
        cv.Title = title;
        cv.PathOnClient = title + ' - ' + DateTime.now() + '.xlsx';
        cv.VersionData = xlsx.getZipArchive();
        insert cv;
        Id contentDocumentid = [SELECT Id FROM ContentDocument WHERE LatestPublishedVersionId = :cv.Id].Id;
        return URL.getOrgDomainUrl().toExternalForm() + '/sfc/servlet.shepherd/document/download/' + contentDocumentid;
    }

}

​​​​​​​
Hello, I have a component on account object. I want to render part of the component dependend on if the checkbox 'Urlaub__c' on the ownerUser is true. The problem I have is, that with the way I did it the section Is not showing up even tough the checkbox is true. Could you tell me what to change so that it works?
 
<aura:if isTrue="{!v.OwnerUser.Urlaub__c}">
            <lightning:layoutItem padding="around-small">                
                <br></br> 
                
                <div class="header-column" width="100%">
                    <div style="font-size: 15px;"><b>{!v.OwnerUser.Vertreter__c.Name}</b></div>
                    <div style="font-size: 10px;">Team {!v.OwnerUser.Team_2020__c}</div>
                    <div>
                        <a href="{!'tel:' + v.OwnerUser.Vertreter__c.MobilePhone}"><lightning:icon iconName="action:call" size="xx-small" alternativeText="Telefon" title="Telefon"   /></a>&nbsp;
                        <a href="{!'mailto:' + v.OwnerUser.Vertretung__c.Email}"><lightning:icon iconName="action:email" size="xx-small" alternativeText="E-Mail" title="E-Mail" /></a>&nbsp;
                        <a href="{!v.OwnerUser.Vertreter__c.Link_BookingTime__c}" target="_blank"><lightning:icon iconName="action:new_event" size="xx-small" alternativeText="BookingTime" title="BookingTime" /></a> 
                    </div>
                    
                </div>
                   
            </lightning:layoutItem>
              </aura:if>

 
Hello, I tried to make a test class for my apex but I still get errors.
Could you give me some support:

Apex class
public class Kampagne_Brief{
    
    public string camId {get;set;}
    
    @InvocableMethod(Label = 'Kampagne_Brief' description='')  
    
    public static void Kampagne_Brief(List<Id> CampaignId) {
        
        string camName = [SELECT Id, Name FROM Campaign WHERE Id =: CampaignId.get(0) LIMIT 1].Name;
        String strDate = String.valueOf(System.now().dateGmt()); // FORMAT YYYY-MM-DD
        // String strDate = System.now().format('yyyyMMdd'); // FORMAT YYYYMMDD
        
        PageReference page = Page.Kampagne_Brief_PDF;
        
        page.getParameters().put('Id', CampaignId.get(0));
        
        string camId= page.getParameters().put('Id', CampaignId.get(0));
        // string camName = page.getParameters().put('Campaign.Name', CampaignId.get(0));
        Blob contentBlob = page.getContentAsPDF();
        
        ContentVersion cv = new ContentVersion();
        cv.VersionData = contentBlob;
        cv.Title = strDate + '_' + camName;
        //    cv.Title =  System.today().year() + '_' + System.today().month() + '_' + System.today().day() + '_' + 'Serienbrief_'+ camName;
        cv.PathOnClient =  strDate + '_' + camName + '.pdf';
        //    cv.PathOnClient =  System.today().year() + '_' + System.today().month()  + '_' + System.today().day() + '_' + 'Serienbrief.pdf';
        cv.Vertraulichkeitsstufe__c = 'Intern';
        cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
        insert cv;
        
        cv = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];
        
        ContentDocumentLink cdl = new ContentDocumentLink();
        cdl.ContentDocumentId = cv.ContentDocumentId;
        cdl.ShareType = 'I';
        cdl.LinkedEntityId = camId;
        insert cdl;
    }
}

My test class to this point:
I get the error message: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LinkedEntityId]: [LinkedEntityId]
 
@isTest 
public with sharing class Kampagnen_Brief_Test  {        
    static testmethod void contentDocumentTest()        {  
            
Campaign cam                        = new Campaign();
        cam.Name                            = 'Test Briefkampagne';
        cam.RecordTypeId                    = '0127a000001lOti';
        cam.IsActive                        = True;
        insert cam;

        
        ContentVersion cv = new ontentVersion();
        cv.Title = '2022-03-10_John Campaign';
        cv.PathOnClient = '2022-03-10_John Campaign.pdf';
        cv.VersionData = Blob.valueOf('Test Content');
        cv.IsMajorVersion = true;
        cv.Vertraulichkeitsstufe__c = 'Intern';
        cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
        Insert cv;
        ContentVersion contentVersion_2 = [SELECT Id, Title, ContentDocumentId 
                                           FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];   
        ContentDocumentLink contentlink = new ContentDocumentLink();
        
        contentlink.contentdocumentid = contentVersion_2.contentdocumentid;
        contentlink.ShareType = 'V';
        insert contentlink;
        Kampagne_Brief KB = new Kampagne_Brief();             
        
    }
    
    
}

 
Hello, I have now tried for some time to create a screen flow thatgets the campaign Id to set the campaign to completed and create a PDF and stores it in the Campaign files. The only problem I have is, that I do not know how to get the campaign Id into my apex Class Invocable Method. Could you tell me how to implement a InvocableVariable or something like that, so I can insert the record Id into the class?

The Apex class:
 
public class SerienbriefSpeichern{


        
@InvocableMethod(Label = 'Serienbrief' description='')  
public static void Serienbriefspeichern() {

 
    
     PageReference page = Page.Campaign_PDF;
    
     Blob contentBlob = !Test.isRunningTest() ? page.getContentAsPDF() : Blob.valueOf('Hardcoded sample text for Test class');
     
    ContentVersion cv = new ContentVersion();
    cv.VersionData = contentBlob;
    cv.Title =  System.today().year() + '_' + System.today().month() + '_Serienbrief';
    cv.PathOnClient =  System.today().day() + '_' + System.today().month() + 'Serienbrief.pdf';
    cv.Vertraulichkeitsstufe__c = 'Intern';
    cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
    insert cv;                
    cv = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];
        
    ContentDocumentLink cdl = new ContentDocumentLink();
    cdl.ContentDocumentId = cv.ContentDocumentId;
    cdl.ShareType = 'I';
    cdl.LinkedEntityId = '7017a000000pVQnAAM';
    insert cdl;
    }
    }

 
Hello, could you help me with test class for my apex?
 
public class MonthlyReport4FDB{
 
@InvocableMethod(Label = 'MonthlyReport4FDB' description='')  
public static void MonthlyReport4FDB() {

     PageReference page = Page.MonthlyReport;
    
     Blob contentBlob = page.getContentAsPDF();
     
    ContentVersion cv = new ContentVersion();
    cv.VersionData = contentBlob;
    cv.Title =  System.today().year() + '_' + System.today().month() + '_FDB_Alle_Aktivitaeten';
    cv.PathOnClient =  System.today().year() + '_' + System.today().month() + '_FDB_Alle_Aktivitaeten.pdf';
    cv.Vertraulichkeitsstufe__c = 'Intern';
    cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)';
    insert cv;                
    cv = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];
        
    ContentDocumentLink cdl = new ContentDocumentLink();
    cdl.ContentDocumentId = cv.ContentDocumentId;
    cdl.ShareType = 'I';
    cdl.LinkedEntityId = '001b000000Zps12AAB';
    insert cdl;
    }
}

 
Hello, I have a report that I need to automatically save as a pdf at the last day of the month at 23:59 every month. But the pdf schould only include the records which where created in the month, so it is an actual month-report.

This pdf should be created automatically at 23:59 at the last day so i dont have to do anything and be save at files of a custom object

Hello, I have build a task datatable component and added the Who.Name as a column. It is working fine when the Who.Name field has content in it, otherwise I get an error message when leaving the field empty. Could you give me a solution for it?

User-added image


My code:

APEX
//Ü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, Who.Name, WhoId, ActivityDate, Status FROM Task WHERE ActivityDate< TODAY AND OwnerId=:userId AND Status !='Completed'];
}


JS
 
component.set('v.mycolumns', [
            {label: 'Thema', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
                 {label: 'Name', fieldName: 'whoName', type: 'text',
            typeAttributes: {label: { fieldName: 'Who.Name' }, target: '_blank'}},
        ]);
        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.whoName = record.Who.Name
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);

 
Hello friends, I have a task datatable component and added the Who.Name as a column. the problem is, that now I do get error messages whenever there is a task where Who.Name is empty. Could you give me a solution for it?

User-added image
My code:

APEX
@AuraEnabled
public static List<Task> loadTasks3(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, Who.Name, ActivityDate, Status FROM Task WHERE ActivityDate = TOMORROW AND OwnerId=:userId AND Status !='Completed'];
}



JS
component.set('v.mycolumns', [
            {label: 'Thema', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
                 {label: 'Name', fieldName: 'whoName', type: 'text',
            typeAttributes: {label: { fieldName: 'Who.Name' }, target: '_blank'}},
        ]);
        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.whoName = record.Who.Name
                });
                component.set("v.tasks", records);
            }
        });
        $A.enqueueAction(action);

 
Hello, I want to get the Who.Name in a datatable, but I struggle with it due to the value not displaying in my datatable component.
I'm quite confident that my query in my apex class is working:
@AuraEnabled
public static List<Task> loadTasks2(Id recordId){
    string userId = UserInfo.getUserId();
    return[SELECT Subject, Who.Name, ActivityDate, Status FROM Task WHERE ActivityDate = TODAY AND OwnerId=:userId AND Status !='Completed'];
}

I think I made a mistake in the Datatable Controller. Could you look in it and tell me what to change, so the Who.Name is shown?

Controller:
component.set('v.mycolumns2', [
            {label: 'Thema', fieldName: 'Subject', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},             
            {label: 'Name', fieldName: 'WhoName', type: 'lookup',
            typeAttributes: {label: { fieldName: 'Who.Name' }, target: '_blank'}},
        ]);
        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;
                    
                });
                component.set("v.tasks2", records);
            }
        });
        $A.enqueueAction(action);

 
Hello, I have a Visualforce template. I want to use an apex class with PageReference.getContentAsPDF() to create a pdf through a flow with the VF template. Could you give me an example of the Apex class to use for my "Visualforce code" that I can add to a flow to create a pdf. (I want to achive, that the fields of the visualforce like (!Account.Name) are filled with screen flow inputs)

Thank you in advance.
Greetings
Jonathan

My Visualforce code:
<apex:page standardController="Account" renderAs="pdf"  >
    
   
    
    <h1>Welcome to APP!</h1>
        
        <p>Thank you, <b><apex:outputText value=" {!Account.Name}"/></b>, for 
            working with APP.</p>
        
        <p>Your account details are:</p>
        
        <table>
            <tr><th>Account Name</th>
                <td><apex:outputText value="{!Account.Name}"/></td>
            </tr>
            <tr><th>Account Rep</th>
                <td><apex:outputText value="{!Account.Owner.Name}"/></td>
            </tr>
            <tr><th>Customer Since</th>
                <td><apex:outputText value="{0,date,long}">
                    <apex:param value="{!Account.CreatedDate}"/>
                    </apex:outputText></td>
            </tr>
        </table>
       
</apex:page>


 
Hello, my chefs wants me to inform myself about the steps we need to make befor the CORS release update.
I already looked if we have some URL under setup->CORS, but it was not the case.
Do I have to add every link that I have in salesforce to a page outside?

We use the sales cloud and never had any CORS problem so I am not sure about any needed changes to our org :D 

Greetings
Jonathan
Hi, I want to make a Visualforce table with input fields. The next step would be to convert the visualforce into a xlsx, but I could not find anything helpful. Could you give me a help how I can achive this with a code example or anything in this direction. It is important that the file type is .xlsx
 
Greetings
Jonathan
 
Hello I tried to delete an apex class by using destructiveChanges.xml and package.xml which I added to a zip-file. I deployed it to my workbench and got these errors. Could you tell me what to fix, so I could delete classes without facing this error?

User-added image