• Brad Nordling 9
  • NEWBIE
  • 45 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 15
    Replies
I am looking at this post online, like others I've seen, that shows how to do this with styleclass:

styleClass = "{! If(lstGrnRate.Status__c=='RED' ,'redColour', If(lstGrnRate.Status__c=='GREEN','greenColour', 'greyColour')) }" />

My question is the comparison includes a value from the current record on the left but on the right, it is hard coded (=='RED').  How can I specify a value from the controller on the right side? 

I'd like to do it something like this but it doesn't work:
styleClass = "{! If(lstGrnRate.Status__c=='{!Property}' ,'redColour', If(lstGrnRate.Status__c=='GREEN','greenColour', 'greyColour')) }" />
I have a batch apex job that builds a select statement for contact records for the start method.  When I am in the execute method, I loop through the account records and for each one, I have a select to go get something from a custom object for locations.  An account can have more than one location.

In the execute method the job fails because of that select within the for loop of accounts.  Too many account, to many loops with a select in it.

I'm thinking the original select in the start method should be modified to select the account and the locations.  But how do I do that?  I want the execute method to be handed a list of accounts with each one having a list of locations.

Does anyone know how to pass a list to the execute method where each record has one or more items in a list from another object?
 
I have a list view button that creates a pdf file from a VF page and saves it as an attachment on the parent object.  All seems to be working except it does not work to view the pdf on the SF mobile app.  You only see the first page of the pdf. 

So when I look at the list of attachments on the object, I see the files and can select one and it opens in a servlet.FileDownload page.  If I download and then attach the same pdf (or any pdf) to the object using the platform Upload Files button, then a couple things are different.  The attachment appears in the list with a pdf icon, whereas the one attached during the apex process does not.  When I click on this manually uploaded file, it does not open in a separate servlet.FileDownload window.  It opens in a pdf viewer within the current page with a little "X" in the corner to close it.  It also renders correctly in the mobile app and I can scroll through the pages.

Now these different behaviors make me thing that if I can attach the pdf file in a different way and make it look and act as if I uploaded it through the Upload Files button, then it should work on mobile.  Any ideas on why this difference exists? 

public class DSBAttachPDF {
    public DSBAttachPDF(ApexPages.StandardController stdController) {       
    }

public pageReference saveAttachment() {
        string DSB = 'Daily Safety Briefing';                    
        argrc__Committee__c comm = [SELECT Id from argrc__Committee__c WHERE Name = :DSB];   
        List<argrc__Committee_Meeting__c> pageMtgLst = [SELECT Id, Name FROM argrc__Committee_Meeting__c WHERE argrc__Committee__c = :comm.Id ORDER BY Meeting_Date__c DESC LIMIT 1]; 
        if (pageMtgLst.size() > 0) {
            PageReference pdf = Page.DSB_Meeting_Reports_PDF_Attachment;
            Attachment attach = new Attachment();
            Blob body = pdf.getContentAsPDF();
            
            pdf.getParameters().put('generatepdf','true');
            attach.Body = body;
            attach.Name = 'DSB Roll Summary.PDF';
            attach.IsPrivate = false;
            attach.contenttype = 'application/pdf';
            attach.ParentId = pageMtgLst[0].Id;
            insert attach;

            PageReference pageRef = new PageReference('/'+pageMtgLst[0].Id);   
            pageRef.setRedirect(true);
            return pageRef;
        }
        else {
            return null;
        }
    }
}

Here's how the files appear in the list view.  The PDF icons were manually uploaded.  Notice the size.  I click the Apex generated ones, they open in servlet.fileDownload.  I click the manually entered ones, they open in the pdf viewer.  Notice the file names. Any ideas?

User-added image
How can I customze the lookup to the contact object?  Can I add in a field to search in addition to "Name" and "All Fields"?
With the selectRadio component, if the text is too long it wraps and when it wraps, the entire text begins on the next line.  How can I make it so the text begins on the same line as the radio button and then wraps when it hits the margin?  I want the text to always start right next to the radio button, not below it.
I have a parent object whose lightning record page has a component for a child object related list.  I have created a custom button on the child object that opens a VF page for some bulk editing of child objects associtated with the parent.  When the button is clicked in the related list component, the page opens but I've tried twenty ways to  code something into the page to close itself but nothing works.  I've read that a popup can't close itself, it must be closed by the window that opened it.  But that was the lightning record page of the parent object.  So how can I get the popup window to close itself, or do I have to just tell the user to close the tab?
How do I close a window that was opened from a lightning record page?
I have a parent object whose lightning record page has a component for a child object related list.  I have created a custom button on the child object that opens a VF page for some bulk editing of child objects associtated with the parent.  When the button is clicked in the related list component, the page opens but I've tried twenty ways to close it in both the class and the VF page but nothing works.  I've read that a popup can't close itself, it must be closed by the window that opened it.  But that was the lightning record page of the parent object.  What's that best way to close the popup window other than telling the user to close the tab?
I have a parent object whose lightning record page has a component for a child object related list.  I have created a custom button on the child object that opens a VF page for some bulk editing of child objects associtated with the parent.  When the button is clicked in the related list component, the page opens but I've tried twenty ways to close it in both the class and the VF page but nothing works.  I've read that a popup can't close itself, it must be closed by the window that opened it.  But that was the lightning record page of the parent object.  What's that best way to close the popup window other than telling the user to close the tab?
I have a pageBlockTable on a VF page and I want to specify what records to populate it with.  If I use the RecordSetVar, it uses ALL the records in that object.  I want a sub-set of the records, with my specific parameters specified.  I tried a method in the controller extension and wanted to specify that in the value attribute of the pageBlockTable but the code never executed so that was a bust.  How else might I do this?

This is part of the page:
<apex:page standardController="Privilege_Assessment_Record__c" extensions="PrivilegeAssessmentObjectExtensionBulk" recordSetVar="NewBatch">

  <apex:form >
       <apex:pageBlock title="Enter Field Values" id="skills_list">        
          <apex:PageBlockTable value="{!NewBatch}" var="record">
            <apex:column value="{!record.Name}"/>                    
            <apex:column value="{!record.RecordType.Name}" headerValue="Record Type"/>

Here's the method in the controller:
    public static List<Privilege_assessment_record__c> NewBatch() { 
        string myParam = ApexPages.currentPage().getParameters().get('bulkBatchID');       
        return [
            SELECT Id, Name, Method_of_Review__c, Patient_MRN__c, 
                   Diagnosis_Procedure__c, Benchmark_Threshold_for_success__c, 
                   Result__c, recordType.Name, bulkBatchID__c
            FROM Privilege_assessment_record__c
            WHERE bulkBatchID__c = :myParam
        ];
    }
I have a Checkbox Group to display on a Screen Flow.  How do I select all checkboxes by default when the screen displays?
If I have the flow set up as a non-triggered flow, it works fine (update records component actually updates!)  When I create the same flow as a scheduled-Triggered flow, the update records piece fails.  Says the records I'm trying to update are null.  (It's a record collection variable).

If I create a new scheduled flow to run the non-triggered flow, the it causes the same error.  Any ideas?
 
I have a Contact object lookup field on the custom object to pick a person and another field called phone number, which should be populated with the phone number from the contact object as the user does the lookup.  I want to see the phone number change as the contact is chosen, not afterwards through a workflow.  TIA
I have a batch apex job that builds a select statement for contact records for the start method.  When I am in the execute method, I loop through the account records and for each one, I have a select to go get something from a custom object for locations.  An account can have more than one location.

In the execute method the job fails because of that select within the for loop of accounts.  Too many account, to many loops with a select in it.

I'm thinking the original select in the start method should be modified to select the account and the locations.  But how do I do that?  I want the execute method to be handed a list of accounts with each one having a list of locations.

Does anyone know how to pass a list to the execute method where each record has one or more items in a list from another object?
 
I have a list view button that creates a pdf file from a VF page and saves it as an attachment on the parent object.  All seems to be working except it does not work to view the pdf on the SF mobile app.  You only see the first page of the pdf. 

So when I look at the list of attachments on the object, I see the files and can select one and it opens in a servlet.FileDownload page.  If I download and then attach the same pdf (or any pdf) to the object using the platform Upload Files button, then a couple things are different.  The attachment appears in the list with a pdf icon, whereas the one attached during the apex process does not.  When I click on this manually uploaded file, it does not open in a separate servlet.FileDownload window.  It opens in a pdf viewer within the current page with a little "X" in the corner to close it.  It also renders correctly in the mobile app and I can scroll through the pages.

Now these different behaviors make me thing that if I can attach the pdf file in a different way and make it look and act as if I uploaded it through the Upload Files button, then it should work on mobile.  Any ideas on why this difference exists? 

public class DSBAttachPDF {
    public DSBAttachPDF(ApexPages.StandardController stdController) {       
    }

public pageReference saveAttachment() {
        string DSB = 'Daily Safety Briefing';                    
        argrc__Committee__c comm = [SELECT Id from argrc__Committee__c WHERE Name = :DSB];   
        List<argrc__Committee_Meeting__c> pageMtgLst = [SELECT Id, Name FROM argrc__Committee_Meeting__c WHERE argrc__Committee__c = :comm.Id ORDER BY Meeting_Date__c DESC LIMIT 1]; 
        if (pageMtgLst.size() > 0) {
            PageReference pdf = Page.DSB_Meeting_Reports_PDF_Attachment;
            Attachment attach = new Attachment();
            Blob body = pdf.getContentAsPDF();
            
            pdf.getParameters().put('generatepdf','true');
            attach.Body = body;
            attach.Name = 'DSB Roll Summary.PDF';
            attach.IsPrivate = false;
            attach.contenttype = 'application/pdf';
            attach.ParentId = pageMtgLst[0].Id;
            insert attach;

            PageReference pageRef = new PageReference('/'+pageMtgLst[0].Id);   
            pageRef.setRedirect(true);
            return pageRef;
        }
        else {
            return null;
        }
    }
}

Here's how the files appear in the list view.  The PDF icons were manually uploaded.  Notice the size.  I click the Apex generated ones, they open in servlet.fileDownload.  I click the manually entered ones, they open in the pdf viewer.  Notice the file names. Any ideas?

User-added image
How can I customze the lookup to the contact object?  Can I add in a field to search in addition to "Name" and "All Fields"?
With the selectRadio component, if the text is too long it wraps and when it wraps, the entire text begins on the next line.  How can I make it so the text begins on the same line as the radio button and then wraps when it hits the margin?  I want the text to always start right next to the radio button, not below it.
I have a parent object whose lightning record page has a component for a child object related list.  I have created a custom button on the child object that opens a VF page for some bulk editing of child objects associtated with the parent.  When the button is clicked in the related list component, the page opens but I've tried twenty ways to  code something into the page to close itself but nothing works.  I've read that a popup can't close itself, it must be closed by the window that opened it.  But that was the lightning record page of the parent object.  So how can I get the popup window to close itself, or do I have to just tell the user to close the tab?
How do I close a window that was opened from a lightning record page?
I have a parent object whose lightning record page has a component for a child object related list.  I have created a custom button on the child object that opens a VF page for some bulk editing of child objects associtated with the parent.  When the button is clicked in the related list component, the page opens but I've tried twenty ways to close it in both the class and the VF page but nothing works.  I've read that a popup can't close itself, it must be closed by the window that opened it.  But that was the lightning record page of the parent object.  What's that best way to close the popup window other than telling the user to close the tab?
I have a pageBlockTable on a VF page and I want to specify what records to populate it with.  If I use the RecordSetVar, it uses ALL the records in that object.  I want a sub-set of the records, with my specific parameters specified.  I tried a method in the controller extension and wanted to specify that in the value attribute of the pageBlockTable but the code never executed so that was a bust.  How else might I do this?

This is part of the page:
<apex:page standardController="Privilege_Assessment_Record__c" extensions="PrivilegeAssessmentObjectExtensionBulk" recordSetVar="NewBatch">

  <apex:form >
       <apex:pageBlock title="Enter Field Values" id="skills_list">        
          <apex:PageBlockTable value="{!NewBatch}" var="record">
            <apex:column value="{!record.Name}"/>                    
            <apex:column value="{!record.RecordType.Name}" headerValue="Record Type"/>

Here's the method in the controller:
    public static List<Privilege_assessment_record__c> NewBatch() { 
        string myParam = ApexPages.currentPage().getParameters().get('bulkBatchID');       
        return [
            SELECT Id, Name, Method_of_Review__c, Patient_MRN__c, 
                   Diagnosis_Procedure__c, Benchmark_Threshold_for_success__c, 
                   Result__c, recordType.Name, bulkBatchID__c
            FROM Privilege_assessment_record__c
            WHERE bulkBatchID__c = :myParam
        ];
    }

Hi,

I am facing an issue with the contentVersion. When I am inserting the contentVersion record from visualforce page action to attach the another VF page as pdf. Its getting attached in notes & attachment related list but I want to add that in files related list.
Please help here

User-added imageUser-added image

I have a Contact object lookup field on the custom object to pick a person and another field called phone number, which should be populated with the phone number from the contact object as the user does the lookup.  I want to see the phone number change as the contact is chosen, not afterwards through a workflow.  TIA