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

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 93
    Questions
  • 61
    Replies
Hello, I want to make a visualforce and apex class on Campaign. In this visualforce I want to have a the names of the campaign members. Due to my issue, that I want to make a pdf and on every page there should be another campaign member name, I think I need the repeat function. Could you give me a code sample how I can make it? :)

Thank you,
Jonathan 
Hello, I want to build a List button, that does create a pdf for every member of a campaign that is selected in List view. I cant achive to query the campaign member name (I am very unexperienced in this.) Could you change my code so so The repeat function shows a pdf side for every member in the selected campaign?

Visualforce

<apex:page standardController="Account" renderAs="pdf" recordSetVar="accounts" extensions="AccountListPDFController"> <apex:repeat value="{!accounts}" var="Account">
<div style="page-break-after:always;">
<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>
</div>
</apex:repeat>
</apex:page>

APEX

public class CampaignListPDFController {
     public List<Campaign> campaigns{get;private set;}
    public List<CampaignMember> campaignMembers { get; private set; }
    public CampaignListPDFController(ApexPages.StandardSetController stdSetController){
        campaigns = (List<Campaign>) stdSetController.getSelected();
         campaignMembers = [
            SELECT Campaign.Name, Campaign.Startdate, Campaign.Type FROM CampaignMember
            

        ];  
    }

}
Hello, I want to build a Visualforce + Apex class to show informations of campaign members. The problem is, that I want the visualforce to be in a List button, but the List button and checkbox selection is only available in campaign and not in campaign members. Could you give me a code sample that when I select a campaign, it choses all campaign members and shows their names + adress?

Greetings
Jonathan
Hello, I get an error when I want to build an apex class:
User-added imageCould you give me a guide how I can solve this error?
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 aura component with a datatable. It includes a checkbox in the datatable section. Now I would like to add a fuctionality to this checkbox, but I dont know how to achive this. Could you look over my code and help me to achive this functionality: I want to change the status of the task to "Completed" when the checkbox is clicked.
Should I share you my code so you can implement it?





 
Hello, I have a very special question, nobody could have helped me with. I made a Visualforce that queries to account fields and displays them. I want these VFs to be printed and I used the convert to pdf option. Now to the issue I need to solve:

I want to create a list button for accounts. For every account that I chose, salesforce should automatically print the individual pdf for every account after the mass list button is clicked. I dont know if it is possible. Can you just tell me if I can do it and if yes, please give me a guide. I need an answer very urgent due to our plans in the company :)

Greetings
Jonathan
Hello, I made a Visualforce page to show fields from accounts. I want to make a List Button to print the PDF for every account I chose. 
Can you give me a guide how to do it?

My VF:

<apex:page standardController="Account" renderAs="pdf" > <h1>Welcome to Universal Samples!</h1> <p>Thank you, <b><apex:outputText value=" {!Account.Name}"/></b>, for becoming a new account with Universal Samples.</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, I made a permission set for some of my users so they have object permissions  to edit users. I logged in as the users but they are still not able to edit details of other users. So what can I do about it?
Hello, I made a pdf that contan fields of the account object. I want to use the pdf visualforce on my account object side as a tab. In addition I would like to make a button on the account list view,so when I chose many accounts, salesforce does print the pdf for every account that I chose.
Greetings
Hello, I want to build a permission set for a certain group of people to be able to edit the field email, mobile and phone on user details. Could you give me a guide how it can be made?
Hello, I build a pdf template in Visualforce. Now I would like to create mass pdfs so I can chose many accounts and salesforce fills the data in the pdfs and make it possible to create a single pdf for every account
 
Hello, I would like to change my component datatable code so if the checkbox is checked the status of the task shown is marked as completed? Does somebody know how it can be made? If you like I share my code sample
Hello, I want to make it possible to add files to a group when it is uploaded in the file component. Is there a possibility in content version to achive this. My goal is, that certain files are only visible to some people in the file section?
Do you have a guide how to achive this?
Hello, I want to build a flow in account page to create a pdf that includes the account details.
Could you give me a guide how to build flows and how I can achive the required pdf

Sincerly
Jonathan
Hello, I want  to create a flow in contact where I can chose picklist fields. These fields and certain fields of the contact page should be display in a pdf which is printed out.
I never made a flow so could you tell me how to achive this?
 
Greetings
Jonathan
Hello, I want to restrict some users to upload files on a cetain page type like i.e. campaigns. Is there a possibility to restrict the upload on a specific page only for some users? Do I have to make it with a flow or could I make it with the SF functionality?
Hello, I made a datatable for the task title and status. I want to use the checkbox on the datatable to mark the tasks as completed. 
To this day nobody could help me with this issue. Could somebody offer me a help with it? 
Hello, I build a lightning carousel with slds code. Now I would like to add a second description for every page. Could you tell me how it can be achived. The second description should display under the first description but with another color, so thats why I can't use the normal description field:

COMP
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >

    <aura:attribute name="imagelink1" type="String"/> 
    <aura:attribute name="header1" type="String"/>     
    <aura:attribute name="link1" type="String"/>  
    <aura:attribute name="description1" type="String"/>
    <aura:attribute name="alternativetext1" type="String"/>

<div class="slds-box slds-box_x-small slds-align_absolute-center" style="background-color: white;">    
    <lightning:carousel disableAutoRefresh="false" disableAutoScroll="false">
        <lightning:carouselImage
            src = "{!v.imagelink1}"
            header = "{!v.header1}"
            description = "{!v.description1}"
            alternativeText = "{!v.alternativetext1}"
            href = "{!v.link1}">
        </lightning:carouselImage>

</lightning:carousel>
</div>
        
</aura:component>

Design

<design:component label="Cockpit_Carousel">
    
    <design:attribute name="imagelink1" label="Image Link1" description="Provide the image 1 url here"/>
    <design:attribute name="header1" label="Header 1" description="Provide the header 1 here"/>   
    <design:attribute name="link1" label="Link 1" description="Provide the Link 1 here"/>  
    <design:attribute name="description1" label="Description 1" description="Provide the Description 1 here"/> 
    <design:attribute name="alternativetext1" label="Alternative Text 1" description="Provide the Alternative Text 1 here"/> 

</design:component>
Hello, I build a Tab to create pdf with account fields. Now I would like to make fill in fields that can be changed (I saw something like that on the internet) Could you tell me how to change my visualforce code so the fields are fillable or changeable?

User-added image

<apex:page standardController="Account" renderAs="pdf">
 
 
<h1>Willkommen bei der APP!</h1>
 
<p>Vielen Dank, <b><apex:outputText value=" {!Account.Name}"/></b>, dass Sie sich für uns entschieden haben.</p>
 
<p>Ihre Daten:</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, 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 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 aura component with a datatable. It includes a checkbox in the datatable section. Now I would like to add a fuctionality to this checkbox, but I dont know how to achive this. Could you look over my code and help me to achive this functionality: I want to change the status of the task to "Completed" when the checkbox is clicked.
Should I share you my code so you can implement it?





 
Hello, I made a pdf that contan fields of the account object. I want to use the pdf visualforce on my account object side as a tab. In addition I would like to make a button on the account list view,so when I chose many accounts, salesforce does print the pdf for every account that I chose.
Greetings
Hello, I want to build a permission set for a certain group of people to be able to edit the field email, mobile and phone on user details. Could you give me a guide how it can be made?
Hello, I would like to change my component datatable code so if the checkbox is checked the status of the task shown is marked as completed? Does somebody know how it can be made? If you like I share my code sample
Hello, I made a datatable for the task title and status. I want to use the checkbox on the datatable to mark the tasks as completed. 
To this day nobody could help me with this issue. Could somebody offer me a help with it? 
Hello, I have build a trigger before delete on ContentDocument. Could you give me a code sample for the test class?



trigger DokumentenklasseDelete on ContentDocument (before delete) {

    
    map<id,ContentDocument> documentMap = new map<id,ContentDocument>([SELECT id,(SELECT Id,FileType,Dokumentenklasse__c from ContentVersions) from ContentDocument where id IN :trigger.old]);
 
        for(ContentDocument con : Trigger.old){
           List<ContentVersion> versionList = documentMap.get(con.Id).ContentVersions;
            if (versionList.size() > 0) {
                for (contentVersion cv : versionList) {
                    if(cv.Dokumentenklasse__c =='Geschäftsbrief' || cv.Dokumentenklasse__c == 'Vertragsdokument' || cv.Dokumentenklasse__c == 'Wichtige Dokumentation oder Entscheidung' ) {
                        con.adderror('Dokumente der Dokumentenklassen "Geschäftsbrief", "Vertragsdokument", "Wichtige Dokumentation oder Entscheidung" dürfen aus rechtlichen Gründen vor Ablauf der Aufbewahrungsfrist nicht gelöscht werden.');
                    }
                 }
            }
            
        }
Hello, I have a before delete Trigger on Content Version. A user here told me that there is a limitation that does not allow before delete triggers to work on content version. Do you know a possibility how to overcome this problem?
The trigger code is:

trigger ContentVersionTrigger on ContentVersion (before delete) { Set<Id> contentDocumentIdSet = new Set<Id>();

if(trigger.IsDelete){ for(ContentVersion con : Trigger.old){

if(con.ContentDocumentId != null) { contentDocumentIdSet.add(con.ContentDocumentId); } } ContentDocumentLink cdl = [SELECT ContentDocumentId,

LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN:contentDocumentIdSet Limit 1];

for(ContentVersion con : Trigger.old){

if(con.Dokumentenklasse__c =='Geschäftsbrief'){
if(cdl!=null){

con.addError('You cant delete the file');
}
}
}
}
}
Hello, I have a multo section task component. I added a checkbox to mark thhe tasks as completed when checkbox is clicked. Could you tell me where my error is and how to make the component working:

Component
<aura:component controller="TaskController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="recordId" type="Id" />    
    <aura:attribute name="tasks" type="Task[]"/>
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>    
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="doSelect" type="List"/>
     
   
    <lightning:card iconName="standard:task" title="Aufgaben">
        <div class="slds-card__body slds-card__body_inner">
             <div style="padding-left: 62%; margin-top: -2rem;">
            <lightning:button label="Aufgaben Anzeigen" onclick="{! c.openTask}"/>
            </div>
            
        </div>
    
        
  <div style= "font-size: 15px; font-weight: bold; margin-left:15px; margin-top:10px;">
      Überfällig        

  </div>
           
    <div>
        
        </div>    
        <div>
           
            <aura:if isTrue="{!not(empty(v.tasks))}">
                <lightning:datatable data="{!v.tasks }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="false"
                         onrowselection="{! c.doSelect}" 
                                     />
                <aura:set attribute="else">
                    <div Style="text-align : center"> Keine Aufgaben</div>
                </aura:set>
            </aura:if>
        </div>

        
    </lightning:card>
     
</aura:component>

JS

({
    doInit: function(component, event, helper) {
    
       component.set('v.mycolumns', [
            {label: 'Thema', fieldName: 'SubjectName', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
                {label: 'Status', fieldName: 'Status', type: 'picklist', fixedWidth: 160 },
                
        ]);
        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);
                 
   
   },
    openTask: function(component, event, helper) {
       window.open('');
    
    },
          
          doSelect : function(component, event, helper) {
        
        var selectedRows = event.getParam('selectedRows'); 
        var ids = [];
        for ( var i = 0; i < selectedRows.length; i++ ) {
            
            ids.push(selectedRows[i].id);

        }
        
        var action = cmp.get("c.loadTasks");
        action.setParams(
        { 
            recordId : ids,
        }
        )}
    
   
})

Apex Conroller:

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(List<Id> recordId){
    string userId = UserInfo.getUserId();
    List<Task>  taskObj=[select id, Subject, ActivityDate, Status from task where id IN:recordId];
    
    for(Task tsk : taskObj){
        tsk.Status='Completed';
    }
    
    if(taskObj.size() > 0)
    update taskObj;
    
    return[SELECT Subject, ActivityDate, Status  FROM Task WHERE ActivityDate< TODAY AND OwnerId=:userId AND Status !='Completed'];
}
}
Hello, I build a trigger on ContentVersion that should block deletation of FILES when they have "Geschäftsbrief" in "Dokumentenklasse" - picklist. Sadly the error does not occure when I delete a file with this field :(
Please correct my code:
 
  
trigger ContentVersionTrigger on ContentVersion (before delete) {
    set<Id> contentId = new set<Id>();
     if(trigger.IsDelete){
         
        for(ContentVersion con : Trigger.old){
            contentId.add(con.Id);
        }
                List<Attachment> at=[select name,body,contentType from Attachment where parentid in: contentId];
              
 for(ContentVersion con : Trigger.old){
 if(con.Dokumentenklasse__c =='Geschäftsbrief'){
                       if(at.size()>0){
                       con.addError('You cant delete the file');
                       }
                       }
        }
    }
}
Hello ,

I have a field on Content Version called Dokumentenklasse__c that has the type picklist. It is a required field for file upload
Can someone help me to write a trigger to prevent deletation of all files with the picklist value "Geschäftsbrief" in the dokument object field.
No user should be able to delete this files

I appreciate every kind of help.
Greetings
Jonathan
Hello,
I made a searchbar component to show accounts which include the search word. Now I would like to make the account name in the component clickable how it is in the standart. To make it more understandable I show you the outputs I have in both searchbars. So in this example I want to make the coluumn name ("katholische Sozialstation..") clickable

User-added image
User-added image

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="GlobalSearchController">
 
    <!-- handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
 
    <!-- attributes -->
    <aura:attribute name="showSearchResults" type="Boolean" default="false"/>
    <aura:attribute name="searchKey" type="String"/>
    <aura:attribute name="accountList" type="List" default="Account[]"/>
    <aura:attribute name="accountColumns" type="List"/>
    
 
    <lightning:layout multipleRows="true">
        <lightning:layoutItem padding="around-small" size="9">
            <lightning:input name="searchKey" placeholder="Enter search key" value="{!v.searchKey}"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="around-small" size="3">
            <lightning:button variant="brand" label="Search" title="Search" onclick="{!c.search}" class="customButton"/>
        </lightning:layoutItem>
    </lightning:layout>
 
    <aura:if isTrue="{!v.showSearchResults}">
        <lightning:layout multipleRows="true">
            <lightning:layoutItem padding="around-small" size="12">
                Account
                <lightning:datatable keyField="id"
                                     data="{!v.accountList}"
                                     columns="{!v.accountColumns}"
                                     hideCheckboxColumn="true"/>
            </lightning:layoutItem>
            
        </lightning:layout>
    </aura:if>
 
</aura:component>

JS:

({
    init: function (component, event, helper){
        component.set('v.accountColumns', [
            {label: 'Name', fieldName: 'Name', type: 'text'},
            {label: 'Account Number', fieldName: 'AccountNumber', type: 'text'},
            {label: 'Website', fieldName: 'Website', type: 'url', typeAttributes: { target: '_self'}}
        ]);
        
    },
 
    search : function(component, event, helper) {
        helper.getSearchResultsFromApex(component, event, helper);
        component.set("v.showSearchResults",true);
    }
})


({
    init: function (component, event, helper){
        component.set('v.accountColumns', [
            {label: 'Name', fieldName: 'Name', type: 'text'},
            {label: 'Account Number', fieldName: 'AccountNumber', type: 'text'},
            {label: 'Website', fieldName: 'Website', type: 'url', typeAttributes: { target: '_self'}}
        ]);
        
    },
 
    search : function(component, event, helper) {
        helper.getSearchResultsFromApex(component, event, helper);
        component.set("v.showSearchResults",true);
    }
})

Helper:

({
    getSearchResultsFromApex : function(component, event, helper){
     
        var action = component.get("c.getSearchResult");
        action.setParams({ searchKey : component.get("v.searchKey") });
     
        // Create a callback that is executed after
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                // SOSL will always return the list in the order they were queried
                component.set("v.accountList",result[0]);
                
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
                else if (state === "ERROR") {
                    var errors = response.getError();
                    if (errors) {
                        if (errors[0] && errors[0].message) {
                            console.log("Error message: " +
                                        errors[0].message);
                        }
                    } else {
                        console.log("Unknown error");
                    }
                }
        });
        $A.enqueueAction(action);
    }
})



APEX:

public class GlobalSearchController {
 
    @AuraEnabled(cacheable=true)
    public static List<List<sObject>> getSearchResult(String searchKey){
     
        List<List<sObject>> searchResult = [FIND :searchKey
                                            IN ALL FIELDS RETURNING
                                            Account (Id, Name, AccountNumber, Website)
                                            ];
        return searchResult;
     
    }
}