• Prakash T 13
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am not able to see SenderEmail Field on the User object pagelayout. but i can see SenderEmail on object level , Please help me to what configuration i missed.

Thanks
Vamsikrishna
 
Hope you're all in good health. Can anyone help how to reduce the width of the first column in my pageBlockSection VF page? There's just too much space for checkbox fields.
<apex:page standardController="Contact" sidebar="false" >
   <apex:form >
   <apex:inlineEditSupport />
   <apex:pageBlock mode="maindetail" >
   <apex:pageBlockSection columns="4" >

         <apex:pageBlockSectionItem > <apex:outputText > <b> Hard Pref </b> </apex:outputText> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputText > <b>Category</b> </apex:outputText> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputText > <b>Preferences</b> </apex:outputText> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem >  <apex:outputText > <b>Notes</b> &nbsp; &nbsp;&nbsp;</apex:outputText> </apex:pageBlockSectionItem>
           
        
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.Handle_with_care__c}" /> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputText > Geography </apex:outputText> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.Geographic_HWC__c}" /> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.Geographic_Preferences_Notes__c}" /> </apex:pageBlockSectionItem>
         
      
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.Handle_with_care__c}" /> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputText > Travel </apex:outputText> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.Travel_HWC__c}" /> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputField value="{!Contact.HwC_Preferences_Notes__c}" /> </apex:pageBlockSectionItem>

   </apex:pageBlockSection>
      <div align="center"> <apex:commandButton action="{!quicksave}" value="Save" /> </div>
   </apex:pageBlock>
   </apex:form>
</apex:page>

pageBlockSection
Hi all-
I'm taking my first stab at visualforce pages. I am trying to generate a pdf of an opportunity record and having it attach to the record via a custom button. I feel like i'm close because I can see the pdf working when I just load the VF page (with fields populated), and then the button I created is "generating" an attachment on the record, but I'm missing something in the middle becuase the pdf attachment fields are empty. I've pieced together code samples I found online.

The first thing I did was create a VF page, pdfOpp:

<apex:page standardController="Opportunity" renderAs="pdf">
<center>
<h1>PRE-ADMISSION PHONE SCREEN</h1>
</center>

<table>
<b>DETAILS:</b>
<hr/>
<tr><th>Pre-Admission Phone Screen Name:</th>
    <td><apex:outputText value="{!Opportunity.Name}"/></td>
    </tr>
<tr><th>Owner:</th>
    <td><apex:outputText value="{!Opportunity.Owner.Name}"/></td>
    </tr>
<tr><th>Created Date:</th>
    <td><apex:outputText value="{0,date,long}">
        <apex:param value="{!Opportunity.CreatedDate}"/>
        </apex:outputText></td>
    </tr>
 <tr><th>Account Name:</th>
    <td><apex:outputText value="{!Opportunity.Account.Name}"/></td>
    </tr>
 <tr><th>Stage:</th>
    <td><apex:outputText value="{!Opportunity.StageName}"/></td>
    </tr>
</table>
</apex:page>



I then created an apex class:

*/
public class attachPDFToOpportunity2 {
    
    private final Opportunity a; //Opportunity object
    
    //constructor
    public attachPDFToOpportunity2(ApexPages.StandardController standardPageController) {
        a = (Opportunity)standardPageController.getRecord(); //instantiate the Opportunity object for the current record
    }
    
    //method called from the Visualforce's action attribute
    public PageReference attachPDF() {
        
        //generate and attach the PDF document
        PageReference pdfPage = Page.pdfOpp; //create a page reference to our pdfOpp Visualforce page
        Blob pdfBlob; //create a blob for the PDF content
        if (!Test.isRunningTest()) { //if we are not in testing context
            pdfBlob = pdfPage.getContent(); //generate the pdf blob
        } else { //otherwise, we are in testing context and getContent() 
            pdfBlob = Blob.valueOf('Some Text');
        }
        Attachment attach = new Attachment(parentId = a.Id, Name = 'pdfAttachmentDemo.pdf', body = pdfBlob); //create the attachment object
        insert attach; //insert the attachment
        
        //redirect the user
        PageReference pageWhereWeWantToGo = new ApexPages.StandardController(a).view(); //we want to redirect the User back to the Opportunity detail page
        pageWhereWeWantToGo.setRedirect(true); //indicate that the redirect should be performed on the client side
        return pageWhereWeWantToGo; //send the User on their way
    }
}

I next created the second VF page called attachPDFtoOpportunity:

<apex:page action="{!attachPDF}" extensions="attachPDFToOpportunity2" standardController="Opportunity">

    <apex:pageMessages ></apex:pageMessages><!-- included for display of errors should they occur -->
    <apex:detail inlineEdit="true" relatedList="true"></apex:detail> <!-- included so Opportunity detail information is visible when errors occur -->
</apex:page>

Lastly, I created a custom button. When I click on my Generate PDF button, it does generate a pdf and saves it to my Opportunity record, but it only includes headers and field names. No fields are actually populated.

Thank you!!!
Megg