• p999_dfs
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 14
    Replies

I want to display a list of all the active currency in my org and its conversion rates.

 

I am able to get it from CurrencyType object.

 

Select c.IsoCode, c.IsCorporate, c.IsActive, c.DecimalPlaces, c.ConversionRate From CurrencyType c

 

But I am not able to show the IsoCode description. If I look at the IsoCode properites then I can see all the currency descriptions aas picklist values but how can I display the currency name in my visualforce page.

 

This is very urgen, can someone please help!!!!!!

 

thanks

 

We want to create a custom button to add PDF Attachement to the object record. We havea visuaforce page which generates a PDF document. We are creating another button on the details page to add this PDf document as a attachment. We want this attachment to be added automatically when user clicks on this button. We do not want to include another intermediate page to get user confirmation.

 

Inititially our page was working when we created a page by just calling the attach method from action on <apex:page> it self.

 

In order to avoid Cross-Site Request Forgery (CSRF), we are trying out the action poler or java script to auto execute the action when detail page button is clicked.

 

It is generating folloiwng error when we try to open the attachment in notes & attachment section

 

File does not begin with '%PDF-'

 

Following is the apex controller code

 

public with sharing class WorkOrderPDFExtensionCon {
	ApexPages.StandardController controller;
	Id id;
	public WorkOrderPDFExtensionCon (ApexPages.StandardController c) {
		 id = ApexPages.currentPage().getParameters().get('id');
		 controller = c;
	}
	public PageReference attachWorkOrder() {
		   WorkOrder__c WO = [Select id, name from WorkOrder__c where id = :id];
		   PageReference pdfPage = Page.gii__WorkOrderPDFDocument;
			PageReference WOPage = new PageReference('/' + id) ;
			WOPage.setRedirect(true);

		   //  set the Work Order id on the page definition 
			pdfPage.getParameters().put('id',id);

			// generate the pdf blob 
			Blob pdfBlob = pdfPage.getContent();
			
			// create the attachment against the Work Order
			Attachment a = new Attachment(parentId = id, name=WO.name + '.pdf', body = pdfBlob);
			// insert the attachment 
			insert a;
			return WOPage;
	  }
}

 

 

Follwoing is the Vf page for with action poler. It is generating error File does not begin with '%PDF-' when attachment is viewed.

 

 

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
      <apex:form id="mainform">   
      <apex:actionFunction name="executeAction" action="{!attachWorkOrder}"/>
      <script>window.setTimeout(executeAction,500)</script> 
    </apex:form>
</apex:page>

Gives Error - File does not begin with '%PDF-'

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
      <apex:form id="mainform">   
      <apex:actionPoller id="executeAction" action="{!attachWorkOrder}" interval="5"/>
     
    </apex:form>
</apex:page>

Gives Error - File does not begin with '%PDF-'

 

 

And Following code works perfectly when attachment is created by clicking on a button

 

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
    <apex:form id="mainform">   
        <apex:pageBlock >
		    Are You Sure :
           <apex:pageBlockSection collapsible="false" title="Attach" columns="2">
                    <br/> Are You Sure ?
           </apex:pageBlockSection>
           <apex:pageBlockButtons location="bottom">  
               <apex:commandButton id="confirm" style="btn" value="{!$Label.Attach}"  action="{!attachWorkOrder}" />&nbsp;&nbsp;
               <apex:commandButton id="cancel" style="btn" value="{!$Label.Cancel}" action="{!cancel}" />
           </apex:pageBlockButtons> 
        </apex:pageBlock>     
    </apex:form>
</apex:page>

 

 

I want to know how we can avoid a intermediate confirmation page witout getting error File does not begin with '%PDF-'. and also what actually this error is and why we are getting this error.

 

Any ideas,, any help is much appreciated.

 

thanks

 

 

 

 

 

 

 

 

We want to know if any one has experienced any limitations with deplying the visualforce pages in the customer portal. We are not able to use any visuaforce pages which are using activities or task.

 

We want to know what are the other limitations with customer / partnet portals.

Message Edited by p999_dfs on 03-22-2010 05:51 PM

We are looking for ways to create the help pages for our application which can support diffenrent languages with double byte charaters as well.

 

We want to know what is the best way so we can display the help pages in different languages.

 

Please let me know with any possible examples.

We are looking for ways to create the help pages for our application which can support diffenrent languages with double byte charaters as well.

 

We want to know what is the best way so we can display the help pages in different languages.

 

Please let me know with any possible examples.

 

Message Edited by p999_dfs on 02-28-2010 10:16 PM

We need to print address on some visuaforce pdf documents.

 

These address needs to be dynamically formatted based on user locale. 

 

Any examples will help, The Account Shipping and Billing address are automatically formatted ased on user locale, we want to know how do we accomplish it for the custom objects.

 

Thanks

We have a managed package, we want to know how does the LMA work when a managed application is accessed through force.com sites.

 

What kind of licenses are required??

 

Thanks

We have several Visualforce pages and we are using custom labels to display any heading. These are mostly displayed using <apex:smileysurprised:utputtext> tag. We are not using any spceal css to set the fonts.

<apex:page controller="InvController" showheader="false" renderAs="pdf" > ... <apex:outputtext value="{!$Label.gii__Invoice_title}"> ... <apex:outputtext value="{!$Label.gii__Footer_Heading_2}"/> ... </apex:page>

 

We need to use japanese transalation. When this page is executed all the custom labels are displayed as Blank.

 

Does any one know how to display resolve this issue, so we can use one visualforce page which can be transalated in any lanuage.

We are not using any static text in our VF page, either we are displaying the text from customer labels or

we are using the field labels.

 

We need this urgently, Any Suggetions!!!!!!!!

We have several Visualforce pages and we are using custom labels to display any heading. These are mostly displayed using <apex:outputtext> tag. We are not using any spceal css to set the fonts.

 

<apex:page controller="InvController" showheader="false" renderAs="pdf" > ... <apex:outputtext value="{!$Label.gii__Invoice_title}"> ... <apex:outputtext value="{!$Label.gii__Footer_Heading_2}"/> ... </apex:page>

 

 

We need to use japanese transalation. When this page is executed all the custom labels are displayed as Blank.

 

Does any one know how to display resolve this issue, so we can use one visualforce page which can be transalated in any lanuage.

We are not using any static text in our VF page, either we are displaying the text from customer labels or

we are using the field labels.

 

 Has anyone used  the Lightbox Visualforce component provided by force.com labs to call a visualforce page

 

The link for the App on Appexchage is 

 

http://sites.force.com/appexchange/apex/listingDetail?listingId=a0N30000001g3u0EAA

 

 This is a free app which has a visual force component <c:lightbox>

 

I want to show some visuaforce code in it. 

 

 

thanks

 

I installed the Chatter Combo Pack into my Chatter-Enabled sandbox mainly to use the Follow Object component that it says can be re-used on a VisualForce page. Yet, when I insert the following line into my code as described on the About Tab for the Combo Pack, I get an error for Save error: Component c:followobject does not exist.

 

 

<c:followObject oid="{!Opportunity.Id}" />

 

 

What am I missing?

 

Thanks,

 

Mike

I want to display a list of all the active currency in my org and its conversion rates.

 

I am able to get it from CurrencyType object.

 

Select c.IsoCode, c.IsCorporate, c.IsActive, c.DecimalPlaces, c.ConversionRate From CurrencyType c

 

But I am not able to show the IsoCode description. If I look at the IsoCode properites then I can see all the currency descriptions aas picklist values but how can I display the currency name in my visualforce page.

 

This is very urgen, can someone please help!!!!!!

 

thanks

 

We want to create a custom button to add PDF Attachement to the object record. We havea visuaforce page which generates a PDF document. We are creating another button on the details page to add this PDf document as a attachment. We want this attachment to be added automatically when user clicks on this button. We do not want to include another intermediate page to get user confirmation.

 

Inititially our page was working when we created a page by just calling the attach method from action on <apex:page> it self.

 

In order to avoid Cross-Site Request Forgery (CSRF), we are trying out the action poler or java script to auto execute the action when detail page button is clicked.

 

It is generating folloiwng error when we try to open the attachment in notes & attachment section

 

File does not begin with '%PDF-'

 

Following is the apex controller code

 

public with sharing class WorkOrderPDFExtensionCon {
	ApexPages.StandardController controller;
	Id id;
	public WorkOrderPDFExtensionCon (ApexPages.StandardController c) {
		 id = ApexPages.currentPage().getParameters().get('id');
		 controller = c;
	}
	public PageReference attachWorkOrder() {
		   WorkOrder__c WO = [Select id, name from WorkOrder__c where id = :id];
		   PageReference pdfPage = Page.gii__WorkOrderPDFDocument;
			PageReference WOPage = new PageReference('/' + id) ;
			WOPage.setRedirect(true);

		   //  set the Work Order id on the page definition 
			pdfPage.getParameters().put('id',id);

			// generate the pdf blob 
			Blob pdfBlob = pdfPage.getContent();
			
			// create the attachment against the Work Order
			Attachment a = new Attachment(parentId = id, name=WO.name + '.pdf', body = pdfBlob);
			// insert the attachment 
			insert a;
			return WOPage;
	  }
}

 

 

Follwoing is the Vf page for with action poler. It is generating error File does not begin with '%PDF-' when attachment is viewed.

 

 

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
      <apex:form id="mainform">   
      <apex:actionFunction name="executeAction" action="{!attachWorkOrder}"/>
      <script>window.setTimeout(executeAction,500)</script> 
    </apex:form>
</apex:page>

Gives Error - File does not begin with '%PDF-'

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
      <apex:form id="mainform">   
      <apex:actionPoller id="executeAction" action="{!attachWorkOrder}" interval="5"/>
     
    </apex:form>
</apex:page>

Gives Error - File does not begin with '%PDF-'

 

 

And Following code works perfectly when attachment is created by clicking on a button

 

<apex:page standardController="WorkOrder__c"  extensions="WorkOrderPDFExtensionCon" setup="false" sidebar="false">
     <apex:sectionHeader Subtitle="{!WorkOrder__c.name}" title="Attach Work Order"/>                
    <apex:form id="mainform">   
        <apex:pageBlock >
		    Are You Sure :
           <apex:pageBlockSection collapsible="false" title="Attach" columns="2">
                    <br/> Are You Sure ?
           </apex:pageBlockSection>
           <apex:pageBlockButtons location="bottom">  
               <apex:commandButton id="confirm" style="btn" value="{!$Label.Attach}"  action="{!attachWorkOrder}" />&nbsp;&nbsp;
               <apex:commandButton id="cancel" style="btn" value="{!$Label.Cancel}" action="{!cancel}" />
           </apex:pageBlockButtons> 
        </apex:pageBlock>     
    </apex:form>
</apex:page>

 

 

I want to know how we can avoid a intermediate confirmation page witout getting error File does not begin with '%PDF-'. and also what actually this error is and why we are getting this error.

 

Any ideas,, any help is much appreciated.

 

thanks

 

 

 

 

 

 

 

 

Hi All,

I built a VF page with custom controller which calls another VF page that returns a PDF. The PDF is is extracted via getContent(), and attached to an email. It all works fine in the sandbox through the UI, but the test method fails, unfortunately without detailed log information.

 

I already found these two threads but none really points to an explanation why it fails in test methods while working fine in the UI:

http://community.salesforce.com/t5/Apex-Code-Development/error-quot-System-VisualforceException-quot-at-getContent/td-p/173307?view=by_date_ascending

 

http://community.salesforce.com/t5/Apex-Code-Development/RageReference-getContent-failing-on-Spring-10-release/td-p/168272

 

Here is the relevant code from the action method:

 

    public PageReference send(){

        for (string address:CCAddresses)
        {
        	if(!address.endsWith('@symmetricom.com')) address += '.full';
        }
        
        PageReference pdfPage = Page.quotePDF;
        pdfPage.getParameters().put('id',theQuote.ID);
        //pdfPage.setRedirect(true);
        System.Debug('pdfPage::::::::::::::::::::::::::::::::::::::: ' + pdfPage);
        transient Blob theBlob;
        theBlob = pdfPage.getContent();
        
        transient Attachment a = new Attachment (
            parentID = theQuote.ID,
            name = 'SymmQuote ' + theQuote.Name + '.pdf',
            body = theBlob);
        

 It fails at the line theBlob = pdfPage.getContent(); when called from the test method, otherwise it works fine. Error message is:

System.VisualforceException: List has no rows for assignment to SObject

The quotePDF page uses the same controller and I was wondering if that causes the issue. Maybe the test cannot handle another instance of the same controller? The PageReference for the pdfPage is created correctly

 

here is the test method:

 

		PageReference pageRef2 = Page.quoteSend;
		Test.setCurrentPage(pageRef2);
		ApexPages.currentPage().getParameters().put('id',quote1.Id);
		quoteLineEdit_v1 editController2 = new quoteLineEdit_v1();
		
		editController2.send();

 

 

 

 

 

 

 

 

 

First of all, good work on adding XSRF (cross-site request forgery) to the security scanner.

 

Secondly, I'd like to ask for some tips on a more secure way of doing things.

 

Currently I have a button for a ticketing system that most compeditors have, one that takes ownership of the current record. Currently I have this implemnted as a visualforce page something like this:

 

 

<apex:page standardController="ticket__c" extensions="sObjectUtils" action="{!takeOwnership}">
<apex:outputPanel rendered="false">
<!-- here to let the standardController.getRecord() method rather than SOQL -->
	{!ticket__c.ownerId}
</apex:outputPanel>

Ownership taken.
</apex:page>

 

The problem is I can't see a way to put a button on a detail page that doesn't open me up to XSRF without requiring an exta step. I'd love it if I could call an action with a button directly, which would mitigate the XSRF issues, but that's currently not supported by the platfrom.

 

So mighty security gurus, what's the "proper" way of implementing this button?

 

I am wondering how to do the following which should be easy but I have yet to get anything but a datalist of the same value which is the last value in the List<List<String>>

 

Here is my visual force and controller methods

 

<apex:dataList value="{!FieldValues}" var="reports"> <apex:repeat value="{!reports}" var="fieldvals"> <apex:outputText value="{!fieldvals}" /> </apex:repeat> </apex:dataList>

 

public List<List<String>> getFieldValues(){ List<List<String>> returnVal = new List<List<String>>(); List<String> fieldRow = new List<String>(); for(integer i = 0; i<finalObjects.size(); i++){ fieldRow.clear(); for(String related : relatedLabels){ fieldRow.add((String)finalObjects[i].get(related)); } returnVal.add(fieldRow); } return returnVal; }

 

finalObjects is just a List<sObject> with a list of different sObjects, such as Accounts and Contacts

 

relatedLabels is just a List<String> that is a list of string names of the fields that Accounts and Contacts have in common.

 

I know that finalObjects and relatedLabels have the correct values since I have tested them with many other methods that my reporting tools is using.

 

Basically I just need to know if I am doing something incorrect or how to go about iterating over a List<List<String>> in some manner to at least display the values in a table, datalist, or just output them to the visualforce page.

 

I need to output the results of a generic SOQL query made as follows that assigns a set of results to: List<sObject> currentList as follows:

 

 

List<sObject> currentList = new List<sObject>(); for(String obj_type : selectedObjectsLabels) { currentList = Database.query('select ' + relatedFields + ' from ' + obj_type); finalObjects.addAll(currentList); }

 

 Currently, the output is organized using a JSON object, but this will not work with renderas="PDF" as it requires JScript.

 

 

 

<apex:page controller="QueryFilterController" showHeader="false" renderAs="pdf"> <apex:form > <h3>Report Results</h3> <br /> <apex:dataList value="{!currentList}" var="reports"> <apex:repeat value="{!reports}" var="report">{!report}</apex:repeat> </apex:dataList> </apex:form> </apex:page>

 

 Any thoughts?

 

 

 Has anyone used  the Lightbox Visualforce component provided by force.com labs to call a visualforce page

 

The link for the App on Appexchage is 

 

http://sites.force.com/appexchange/apex/listingDetail?listingId=a0N30000001g3u0EAA

 

 This is a free app which has a visual force component <c:lightbox>

 

I want to show some visuaforce code in it. 

 

 

thanks