• nindra
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I have a page where I have included an inline page. This inline page has fields which are editable. If I test this page alone fields are editable. But when I test the main page which has inline page. The fields are not editable. How can I make them editable.
I tried to use <APEX:detail inlineedit = 'true'/> but is displaying the content from standard layout also . So there is a duplication of content but the fields are editable. How can i avoid the duplicate content?
Please help.
  • February 24, 2017
  • Like
  • 0
Is using REST API only way to upload documents to BOX in salesforce?? Can we upload document without using REST APIs
  • January 06, 2017
  • Like
  • 0
I want to see Id as query string parameter in URL of my custom page. How can I get it and set it?
 
  • January 04, 2017
  • Like
  • 0
I created a VF page which uses standard  controller and extension controller. This page uses 3 fields from contact . Extension controller gets Id using these three VF page fields. Attachment is uploaded to the row with this Id. Looks like SOQL is not fetching rows when I used bind variables, When i hardcoded values for bind variables it worked.

Here is the code for VF page
<apex:page standardController="contact"  extensions="AttachmentUploadController1" >  
  <apex:sectionHeader title="Visualforce Example" subtitle="Attachment Upload Example"/>

  <apex:form enctype="multipart/form-data">
    <apex:pageMessages />
    <apex:pageBlock title="Upload a Attachment">

   
      <apex:pageBlockButtons >
        <apex:commandButton action="{!upload}" value="Save"/>
      </apex:pageBlockButtons>

      <apex:pageBlockSection showHeader="false" columns="2" id="block1">

      


        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File Name" for="fileName"/>
          <apex:inputText value="{!attachment.name}" id="fileName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File" for="file"/>
          <apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Description" for="description"/>
          <apex:inputTextarea value="{!attachment.description}" id="description"/>
        </apex:pageBlockSectionItem>
        
         
      <!--  <apex:outputLabel value="{!contact.email}" for="Email"/> 
        <apex:inputText id="email"/> -->
        
         <apex:inputField value="{!contact.Firstname}"/>
          <apex:inputField value="{!contact.Lastname}" />
          <apex:inputField value="{!contact.email}"/>
         
        

      
    
      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>
</apex:page>
                

********Here is the code for Extension controller*******************

public with sharing class AttachmentUploadController1 {
     
   
   public contact con{get;set;}           
   //Contact con1 = new contact();

   public AttachmentUploadController1() {
    }
   public Id recId  { get;set; } 
    
   
  public AttachmentUploadController1(ApexPages.StandardController ctlr) {
   // con =  [SELECT Id FROM contact WHERE Firstname = 'testsignup' and Lastname = 'name1']; 
   try
   {
  // this.con =  [SELECT Id FROM contact WHERE Firstname = :con1.Firstname and Lastname = :con1.Lastname]; 
    this.con =  [SELECT Id FROM contact WHERE Firstname = :con.Firstname and Lastname = :con.Lastname]; 
    
    }
  
  Catch(Exception e)
  {
  System.debug('There was an exception');
  }
    
    } 
    
    
  public Attachment attachment {
  get {
      if (attachment == null)
        attachment = new Attachment();
      return attachment;
    }
  set;
  }

  public PageReference upload() {

    //attachment.OwnerId = UserInfo.getUserId();
    //attachment.ParentId = '0033600000dNJly';  //the record the file is attached to 
  // attachment.ParentId = '0033600000h5lTMAAY'; 
 // attachment.ParentId = ' ';
 // system.debug('recid is' + this.con.id);
   attachment.ParentId = this.con.id;
   system.debug('recid is' + this.con.id);
    attachment.IsPrivate = true;
     

    try {
      insert attachment;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
      return null;
    } finally {
      attachment = new Attachment(); 
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
    return null;
  }

}


Somehow the bind variables not getting values from page. Check SELECT statement.
Please help.
 
  • January 04, 2017
  • Like
  • 0
I need to create email template for fields derived from three different objects.
I  could not find anywhere how to do it.Pls help. 
  • November 22, 2016
  • Like
  • 0
I want to see Id as query string parameter in URL of my custom page. How can I get it and set it?
 
  • January 04, 2017
  • Like
  • 0
I created a VF page which uses standard  controller and extension controller. This page uses 3 fields from contact . Extension controller gets Id using these three VF page fields. Attachment is uploaded to the row with this Id. Looks like SOQL is not fetching rows when I used bind variables, When i hardcoded values for bind variables it worked.

Here is the code for VF page
<apex:page standardController="contact"  extensions="AttachmentUploadController1" >  
  <apex:sectionHeader title="Visualforce Example" subtitle="Attachment Upload Example"/>

  <apex:form enctype="multipart/form-data">
    <apex:pageMessages />
    <apex:pageBlock title="Upload a Attachment">

   
      <apex:pageBlockButtons >
        <apex:commandButton action="{!upload}" value="Save"/>
      </apex:pageBlockButtons>

      <apex:pageBlockSection showHeader="false" columns="2" id="block1">

      


        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File Name" for="fileName"/>
          <apex:inputText value="{!attachment.name}" id="fileName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File" for="file"/>
          <apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Description" for="description"/>
          <apex:inputTextarea value="{!attachment.description}" id="description"/>
        </apex:pageBlockSectionItem>
        
         
      <!--  <apex:outputLabel value="{!contact.email}" for="Email"/> 
        <apex:inputText id="email"/> -->
        
         <apex:inputField value="{!contact.Firstname}"/>
          <apex:inputField value="{!contact.Lastname}" />
          <apex:inputField value="{!contact.email}"/>
         
        

      
    
      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>
</apex:page>
                

********Here is the code for Extension controller*******************

public with sharing class AttachmentUploadController1 {
     
   
   public contact con{get;set;}           
   //Contact con1 = new contact();

   public AttachmentUploadController1() {
    }
   public Id recId  { get;set; } 
    
   
  public AttachmentUploadController1(ApexPages.StandardController ctlr) {
   // con =  [SELECT Id FROM contact WHERE Firstname = 'testsignup' and Lastname = 'name1']; 
   try
   {
  // this.con =  [SELECT Id FROM contact WHERE Firstname = :con1.Firstname and Lastname = :con1.Lastname]; 
    this.con =  [SELECT Id FROM contact WHERE Firstname = :con.Firstname and Lastname = :con.Lastname]; 
    
    }
  
  Catch(Exception e)
  {
  System.debug('There was an exception');
  }
    
    } 
    
    
  public Attachment attachment {
  get {
      if (attachment == null)
        attachment = new Attachment();
      return attachment;
    }
  set;
  }

  public PageReference upload() {

    //attachment.OwnerId = UserInfo.getUserId();
    //attachment.ParentId = '0033600000dNJly';  //the record the file is attached to 
  // attachment.ParentId = '0033600000h5lTMAAY'; 
 // attachment.ParentId = ' ';
 // system.debug('recid is' + this.con.id);
   attachment.ParentId = this.con.id;
   system.debug('recid is' + this.con.id);
    attachment.IsPrivate = true;
     

    try {
      insert attachment;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
      return null;
    } finally {
      attachment = new Attachment(); 
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
    return null;
  }

}


Somehow the bind variables not getting values from page. Check SELECT statement.
Please help.
 
  • January 04, 2017
  • Like
  • 0