• naresh.sfdc1.3885733215764783E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 0
    Replies
Hi Folks,

i implemented one VF Page for showing Data in XML format.Its showing very perfetly but when i click on Save button on this page,i need to save this Data in Attachments as an XML file.Any ideas....

VF Page:

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c" >
                <apex:outputText value="{!xmldata}" style="width:1000px;"/>
</apex:page>

Class :
public class CLS_xmlGeneration {

    public String xmldata { get; set; }
 
    public ID recid{get;set;}
 
    public Reward__c rew{get;set;}
 

 
    Public CLS_xmlGeneration(){
        recid=ApexPages.CurrentPage().getParameters().get('Id');

        rew =new Reward__c();
        rew = [select id,name,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:recid];

        Dom.Document doc = new Dom.Document();
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
       // w.writeStartElement(null, 'quotas', null);
    
              w.writeStartElement(null, 'Reward', null);
        
              w.writeStartElement(null, 'Id', null);
              w.writeCharacters(rew.id);
              w.writeEndElement();
    
              w.writeStartElement(null, 'Name', null);
              w.writeCharacters(rew.name);
              w.writeEndElement();

              w.writeStartElement(null, 'UserId', null);
              w.writeCharacters(rew.User__c);
              w.writeEndElement();

              w.writeStartElement(null, 'TimeId', null);
              w.writeCharacters(rew.Time_Based_Mgmnt__c);
              w.writeEndElement();
    
              w.writeStartElement(null, 'RewardAmount', null);
              w.writeCharacters(string.valueof(rew.Rward_Amount__c));
              w.writeEndElement();
    
              w.writeEndElement();
    
       //  w.writeEndElement();
        w.writeEndDocument();
       xmldata  = w.getXmlString();
          w.close();
       // doc.LoadXml(xmlOutput);
       // system.debug('XML is '+doc.toXmlString());
       // xmldata = doc.toXmlString();

    }
    public pagereference insrtattacmnt(){
         PageReference csvPage = Page.VF_XMLinsert_intoAttachment;
         csvPage.getParameters().put('Id', recid);
         Blob csvBlob = csvPage.getContent();
      
       //    dom.Document doc = new dom.Document();
       //    doc.load(csvPage.getContent().toString());
     
         Attachment attachment = new Attachment();
            attachment.Body = csvBlob ;
            attachment.Name = 'Rewardfile.xml';
            attachment.ParentId = rew.Id;
          insert attachment;

       
      return null;
    }
}
Hi Folks,

i implemented one VF Page for showing Data in XML format.Its showing very perfetly but when i click on Save button on this page,i need to save this Data in Attachments as an XML file.Any ideas....

VF Page:

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c" >
                <apex:outputText value="{!xmldata}" style="width:1000px;"/>
</apex:page>

Class :
public class CLS_xmlGeneration {

    public String xmldata { get; set; }
  
    public ID recid{get;set;}
  
    public Reward__c rew{get;set;}
  

  
    Public CLS_xmlGeneration(){
        recid=ApexPages.CurrentPage().getParameters().get('Id');

        rew =new Reward__c();
        rew = [select id,name,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:recid];

        Dom.Document doc = new Dom.Document();
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
       // w.writeStartElement(null, 'quotas', null);
     
              w.writeStartElement(null, 'Reward', null);
         
              w.writeStartElement(null, 'Id', null);
              w.writeCharacters(rew.id);
              w.writeEndElement();
     
              w.writeStartElement(null, 'Name', null);
              w.writeCharacters(rew.name);
              w.writeEndElement();

              w.writeStartElement(null, 'UserId', null);
              w.writeCharacters(rew.User__c);
              w.writeEndElement();

              w.writeStartElement(null, 'TimeId', null);
              w.writeCharacters(rew.Time_Based_Mgmnt__c);
              w.writeEndElement();
     
              w.writeStartElement(null, 'RewardAmount', null);
              w.writeCharacters(string.valueof(rew.Rward_Amount__c));
              w.writeEndElement();
     
              w.writeEndElement();
     
       //  w.writeEndElement();
        w.writeEndDocument();
       xmldata  = w.getXmlString();
          w.close();
       // doc.LoadXml(xmlOutput);
       // system.debug('XML is '+doc.toXmlString());
       // xmldata = doc.toXmlString();

    }
    public pagereference insrtattacmnt(){
         PageReference csvPage = Page.VF_XMLinsert_intoAttachment;
         csvPage.getParameters().put('Id', recid);
         Blob csvBlob = csvPage.getContent();
       
       //    dom.Document doc = new dom.Document();
       //    doc.load(csvPage.getContent().toString());
      
         Attachment attachment = new Attachment();
            attachment.Body = csvBlob ;
            attachment.Name = 'Rewardfile.xml';
            attachment.ParentId = rew.Id;
          insert attachment;

        
      return null;
    }
}
Hi Folks,

i implemented one VF Page for showing Data in XML format.Its showing very perfetly but when i click on Save button on this page,i need to save this Data in Attachments as an XML file.Any ideas....

VF Page:

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c" >
                <apex:outputText value="{!xmldata}" style="width:1000px;"/>
</apex:page>

Class :
public class CLS_xmlGeneration {

    public String xmldata { get; set; }
  
    public ID recid{get;set;}
  
    public Reward__c rew{get;set;}
  

  
    Public CLS_xmlGeneration(){
        recid=ApexPages.CurrentPage().getParameters().get('Id');

        rew =new Reward__c();
        rew = [select id,name,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:recid];

        Dom.Document doc = new Dom.Document();
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
       // w.writeStartElement(null, 'quotas', null);
     
              w.writeStartElement(null, 'Reward', null);
         
              w.writeStartElement(null, 'Id', null);
              w.writeCharacters(rew.id);
              w.writeEndElement();
     
              w.writeStartElement(null, 'Name', null);
              w.writeCharacters(rew.name);
              w.writeEndElement();

              w.writeStartElement(null, 'UserId', null);
              w.writeCharacters(rew.User__c);
              w.writeEndElement();

              w.writeStartElement(null, 'TimeId', null);
              w.writeCharacters(rew.Time_Based_Mgmnt__c);
              w.writeEndElement();
     
              w.writeStartElement(null, 'RewardAmount', null);
              w.writeCharacters(string.valueof(rew.Rward_Amount__c));
              w.writeEndElement();
     
              w.writeEndElement();
     
       //  w.writeEndElement();
        w.writeEndDocument();
       xmldata  = w.getXmlString();
          w.close();
       // doc.LoadXml(xmlOutput);
       // system.debug('XML is '+doc.toXmlString());
       // xmldata = doc.toXmlString();

    }
    public pagereference insrtattacmnt(){
         PageReference csvPage = Page.VF_XMLinsert_intoAttachment;
         csvPage.getParameters().put('Id', recid);
         Blob csvBlob = csvPage.getContent();
       
       //    dom.Document doc = new dom.Document();
       //    doc.load(csvPage.getContent().toString());
      
         Attachment attachment = new Attachment();
            attachment.Body = csvBlob ;
            attachment.Name = 'Rewardfile.xml';
            attachment.ParentId = rew.Id;
          insert attachment;

        
      return null;
    }
}
How can i create a page in site.com to search data daynamically and display it in table?

For this i have try salesforce ajax toolkit on site.com's custom  page and use vf-page in site.com page using <iframe> tag also. Both are not working even apex class functionality is also not working on vf page in site.com.

And i wanted to use chatter also on site.com's page, getting stuck here also. How can i do this?
Hi ,

I want to Send an Email to my customer which he gave in VF Page along with i want to send Thank you Image.
This Image is in Documents. I retrieved that Document in Apex based on Name but am not able to add this image in Sended Email.
Query :       Document DC= [Select id,Name from Document where Name = 'Ajelite site/Contact us Thank you Image'];

I tried with this code,but am not able to send image.
String  strDocUrl = '/servlet/servlet.FileDownload?file='+lstDocument.Id;
        System.Debug('The body of the mail is '+strDocUrl);
        String htmlBody =  strDocUrl +' <br/> </b> Dear' + c.First_Name__c +', </b> <br/> ';

How can i add this document image in Email.
Hi Folks,

i implemented one VF Page for showing Data in XML format.Its showing very perfetly but when i click on Save button on this page,i need to save this Data in Attachments as an XML file.Any ideas....

VF Page:

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c" >
                <apex:outputText value="{!xmldata}" style="width:1000px;"/>
</apex:page>

Class :
public class CLS_xmlGeneration {

    public String xmldata { get; set; }
  
    public ID recid{get;set;}
  
    public Reward__c rew{get;set;}
  

  
    Public CLS_xmlGeneration(){
        recid=ApexPages.CurrentPage().getParameters().get('Id');

        rew =new Reward__c();
        rew = [select id,name,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:recid];

        Dom.Document doc = new Dom.Document();
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
       // w.writeStartElement(null, 'quotas', null);
     
              w.writeStartElement(null, 'Reward', null);
         
              w.writeStartElement(null, 'Id', null);
              w.writeCharacters(rew.id);
              w.writeEndElement();
     
              w.writeStartElement(null, 'Name', null);
              w.writeCharacters(rew.name);
              w.writeEndElement();

              w.writeStartElement(null, 'UserId', null);
              w.writeCharacters(rew.User__c);
              w.writeEndElement();

              w.writeStartElement(null, 'TimeId', null);
              w.writeCharacters(rew.Time_Based_Mgmnt__c);
              w.writeEndElement();
     
              w.writeStartElement(null, 'RewardAmount', null);
              w.writeCharacters(string.valueof(rew.Rward_Amount__c));
              w.writeEndElement();
     
              w.writeEndElement();
     
       //  w.writeEndElement();
        w.writeEndDocument();
       xmldata  = w.getXmlString();
          w.close();
       // doc.LoadXml(xmlOutput);
       // system.debug('XML is '+doc.toXmlString());
       // xmldata = doc.toXmlString();

    }
    public pagereference insrtattacmnt(){
         PageReference csvPage = Page.VF_XMLinsert_intoAttachment;
         csvPage.getParameters().put('Id', recid);
         Blob csvBlob = csvPage.getContent();
       
       //    dom.Document doc = new dom.Document();
       //    doc.load(csvPage.getContent().toString());
      
         Attachment attachment = new Attachment();
            attachment.Body = csvBlob ;
            attachment.Name = 'Rewardfile.xml';
            attachment.ParentId = rew.Id;
          insert attachment;

        
      return null;
    }
}
Hi Folks,

i implemented one VF Page for showing Data in XML format.Its showing very perfetly but when i click on Save button on this page,i need to save this Data in Attachments as an XML file.Any ideas....

VF Page:

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c" >
                <apex:outputText value="{!xmldata}" style="width:1000px;"/>
</apex:page>

Class :
public class CLS_xmlGeneration {

    public String xmldata { get; set; }
  
    public ID recid{get;set;}
  
    public Reward__c rew{get;set;}
  

  
    Public CLS_xmlGeneration(){
        recid=ApexPages.CurrentPage().getParameters().get('Id');

        rew =new Reward__c();
        rew = [select id,name,Rward_Amount__c,Time_Based_Mgmnt__c,User__c from Reward__c where id=:recid];

        Dom.Document doc = new Dom.Document();
        XmlStreamWriter w = new XmlStreamWriter();
        w.writeStartDocument(null, '1.0');
       // w.writeStartElement(null, 'quotas', null);
     
              w.writeStartElement(null, 'Reward', null);
         
              w.writeStartElement(null, 'Id', null);
              w.writeCharacters(rew.id);
              w.writeEndElement();
     
              w.writeStartElement(null, 'Name', null);
              w.writeCharacters(rew.name);
              w.writeEndElement();

              w.writeStartElement(null, 'UserId', null);
              w.writeCharacters(rew.User__c);
              w.writeEndElement();

              w.writeStartElement(null, 'TimeId', null);
              w.writeCharacters(rew.Time_Based_Mgmnt__c);
              w.writeEndElement();
     
              w.writeStartElement(null, 'RewardAmount', null);
              w.writeCharacters(string.valueof(rew.Rward_Amount__c));
              w.writeEndElement();
     
              w.writeEndElement();
     
       //  w.writeEndElement();
        w.writeEndDocument();
       xmldata  = w.getXmlString();
          w.close();
       // doc.LoadXml(xmlOutput);
       // system.debug('XML is '+doc.toXmlString());
       // xmldata = doc.toXmlString();

    }
    public pagereference insrtattacmnt(){
         PageReference csvPage = Page.VF_XMLinsert_intoAttachment;
         csvPage.getParameters().put('Id', recid);
         Blob csvBlob = csvPage.getContent();
       
       //    dom.Document doc = new dom.Document();
       //    doc.load(csvPage.getContent().toString());
      
         Attachment attachment = new Attachment();
            attachment.Body = csvBlob ;
            attachment.Name = 'Rewardfile.xml';
            attachment.ParentId = rew.Id;
          insert attachment;

        
      return null;
    }
}