• r_boyd_848
  • NEWBIE
  • 145 Points
  • Member since 2010

  • Chatter
    Feed
  • 5
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 41
    Replies

Hi All,

 

What is the difference between salesforce and Salesforce platform license?

 

Thanks

Santosh Duvvuri

Hi,

As ideas do not support subcategories, we have displayed the categories by hardcoding the super category. For example if we had categories x,y,z related to A and p,q,r related B. In the visualforce page we have displayed the categories as follows:

 

A

  x

  y

  z

B

 p

 q

 r

 

A & B are hardcoded. Now what I am trying to do is,  Initially when the page is loaded, I should display the list as follows


A

B

 

When I click on A, the display should change as follows

 

A

 x

 y

 z

B

 

i.e... When I click on A, the list should expand. Again when I click on it, it should collapse.

 

I tried all means, but not getting the exact idea how to accomplish this.

Anybody has any idea how to accomplish this task.

 

Thanks in Advance.

  • February 09, 2011
  • Like
  • 0

We've been developing some functionality for a client that was orginally intended for Customer Portal but will now be going out on Salesforce Communties. We set up Communties on dev org and quickly discovered that custom buttons running javascript break if they reference libraries; including SF connection.js. We get a 404 not found error for connection.js.

 

The button works on Internal view but when the users switches to the portal it breaks.

 

Javascript using the same Ajax Toolkit library, JQuery etc running on a VF page works fine

 

Example:

 

Custom Button that contains this reference {!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')} works in internal mode but gives a 404 externally. The library isn't the issue, Jquery libraries even saved as a static resource fail

 

I would appreciate some assistance on this

We are updating our internal security documentation. As ISV we can order an ISV Admin login. Is there an extra step required in provisioning the order that requires verification by the ISV customer authorising us to have such a login?

I'm just reading through the ISV documentation for Winter 12.  Whats the difference between a  Trialforce Management Organization and a Trialforce Org. I know what the latter is but I'm not sure what this new type of Org is?

 

It seems that a Trialforce Management Organization is place to setup branding and the custom login page, should this be the dev org from which the managed package is created. That is the org we currently setup email branding on.

 

What is a template v a snapshot? Our Trialforce Master Org has been upgraded to winter 12 but I can't see the new menu options

So you want to control if something appears on a Visualforce page based on some underlying premission on the object.

 

Everytime I go to use this syntax (but can't remember it exactly) I find it difficult to find in the Salesforce documentation. I don't know way. So I thought I would post it here so it might be easier to find in the future

 

In these examples I'm going to control if a button appears based on the users underlying permission on an object. Lets just say the button opens a Visualforce page that uses myCustomObject__c as its controller.

 

<!-- show if the object accessible to the User -->
<apex:commandButton action=”{!viewRec}” value=”New” rendered=”{!$ObjectType.myCustomObject__c.accessible}” />
<!-- show if user create new record --> <apex:commandButton action=”{!newRec}” value=”New” rendered=”{!$ObjectType.myCustomObject__c.createable}” /> <!-- show if user can edit --> <apex:commandButton action=”{!editRec}” value=”Edit” rendered=”{!$ObjectType.myCustomObject__c.updateable}” /> <!--show if user can delete--> <apex:commandButton action=”{!delRec}” value=”Delete” rendered=”{!$ObjectType.myCustomObject__c.deletable}” />

 You can use this on any VF mark up that supports the rendered attribute. It also works with disabled as well, although I found this not t be the case if the button was being used in a table.

 

Any way this should be easier to find

Here's one for all you builders of managed packages. I wanted to place a Custom Button the on Accounts page that you recalculate a value. To do this I needed to call a class, this can be achieved by setting the Custom Button to call some Javascript and then wire up an Ajax call. The code is straightforward

 

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

var bal = sforce.apex.execute("PaymentEngine","getAccountBalance", {id:"{!Account.Id}"});

//more code

 

 

The class needs to be Global and the method static and prefixed with WebService. All good.

 

HOWEVER if this is App is converted into a managed package the call will fail as the class requires that it has the Namespace prepended to it. The Ajax Toolkit allows you to add the Namespace via sforce.connection.defaultNamespace ="myNamespace". But I have to know the namespace in the first place. Moving between dev, deployment and product orgs it is not feasible to do this. Inspired by this article I created the following:

 

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

var result = sforce.connection.describeGlobal();
var TOKEN_OBJ = "Patient__c";  //ensure we get our Apps Namespace not someoneelses
var sobjects = result.getArray("sobjects");
var ns = "";

for(var i=0; i<sobjects.length; i++) {
     var sobjName = sobjects[i].name;
     //sforce.debug.log('Object Found: ' + sobjName);
     //describeResult = sforce.connection.describeSObject(sobjName); //dont call this makes it reallt slow
   //  sforce.debug.log('Is Custom: ' + describeResult.custom);

         var str = sobjName.split("__");
          //if there are 3 values there is a namespace
         if (str.length == 3){
             sforce.debug.log(sobjName + ' has namespace');
             //Is it one of ours?
             var sobj = str[1].valueOf() +'__c';
             if(sobj == TOKEN_OBJ) {
                    ns = str[0].valueOf();
             }else{
// just for debugging and testing
  // sforce.debug.log(sobjName + ' is not in my namespace'); } }else{

  // sforce.debug.log(sobjName + ' has no namespace'); } } if(ns != ""){ // sforce.debug.log(('I have a namespace called ' + ns');
sforce.connection.defaultNamespace =ns;
}else{
    // sforce.debug.log(('I have no namespace called');
}
//now do stuff
var bal = sforce.apex.execute("PaymentEngine","getAccountBalance", {id:"{!Account.Id}"});
window.alert("Balance updated to: " + bal );

 

So it works, but its crazy. Please Mr Salesforce can you make it easier to get the Namespace via AJAX, Javascript, jQuery. How about sforce.connection.getNamespaceFor('MyCustomObject__c');

 

 

 

 

 

 

I wanted to Email a PDF version of an Invoice page (PrintInvoice) I had created so I went about doing the usual stuff by creating a VF page that used the just the StandardController for a Custom Object called Invoice__c with the attribute renderAs="PDF"

 

Like so

 

 

<apex:page Standardcontroller="Invoice__c"  showheader="false"  renderAs="pdf">

<!-- all the rest of the page. THIS IS A SIMPLIFIED VERSION -->
<apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputText style="font-weight: bold;margin-right: 5px; font-size: medium;"
                        value="{!$Organization.Name}" />
                </apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection title="Charges for Patient: {!Invoice__c.patient__r.Patient_Name__c}  ({!Invoice__c.patient__r.ChartID__c})">
        <apex:dataTable headerClass="invLineHdr" columnClasses="invLineCentre" value="{!Invoice__c.Invoice_Line_Items__r}" var="li">
<!-- Columns and values -->

</apex:dataTable>
            
        </apex:pageBlockSection>

</apex:page>

 This all worked fine, I could preview the page from another page using an iFrame and Print the page using <apex:outputLink value="{!$Page.PrintInvoice}?id={!Invoice__c.id}" target="_blank">Print Invoice</apex:outputLink>

 

All good. However note that the page only uses the Standard Controller. I then wrote a class to email the invoice as a PDF attachment using the examples specified in Salesforce

 

 

 

public pageReference emailInvoice(){
		
		Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
		PageReference pdf = Page.PrintInvoice;
		
		//prep attachment	
     		pdf.getParameters().put('id', invoiceId);
     		//pdf.setRedirect(true); //does not seem to be required
     		
     		Blob b = pdf.getContent();
     	
     		Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     		
     		efa.setFileName('invoice.pdf');
     		efa.setBody(b);
			
		string[] toAddr = new string[] {patient.Email__c};
		mail.setToAddresses(toAddr);
			
		mail.setSubject('Your Invoice from ' + UserInfo.getOrganizationName() + ' : Invoice No  ' + invoice.Name);
			
		mail.setHtmlBody('Thanks for attending:<b> ' + UserInfo.getOrganizationName() +' </b><p>'+
     			' Your Invoice is attached.');
 
     		mail.setFileAttachments(new Messaging.Emailfileattachment[] {efa});	
     		
     		Messaging.SendEmailResult [] r = 
			Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});  
     		
     		addInfo('Email Send result: '+ r[0].isSuccess());
			
		
		return null;
	}

 

 

When I ran the code I started getting errors along the following lines

 

SObject row was retrieved via SOQL without querying the requested field: Invoice__c.Account__r

 

On further testing I couldn't even access fields on the main Invoice__c object. It seems that the getContent() call doesn't quite do it in terms of getting the object field values. (By the way . setRedirect() has no impact, you'll notice I commented it out). So far I didn't have to write any code to get the PrintInvoice page to display and as I was using the cool new FieldSets ability, I really didn't want to have go and write a entire custom controller to create a page that would work as a PDF attachment.

 

Extension Controllers to the rescue!!! Poking around the help files I noticed that if you call the getRecord() method on a Standard controller it will return all the fields specifed on the associated Visualforce page. In other words getRecord() should get all the fields from Invoice__c and any related object field names I've specified on the page.

 

So the solution was to create a controller extension:

 

 

public with sharing class InvoicePrintControllerExtension {

	private final Invoice__c invoice;
	
	
	public InvoicePrintControllerExtension(ApexPages.StandardController controller){
		
		
		this.invoice = (Invoice__c)controller.getRecord();
		
		
	}

}

 and the modify the apex page

 

 

<apex:page Standardcontroller="Invoice__c" extensions="InvoicePrintControllerExtension"  showheader="false"  renderAs="pdf">

 

 

This seems to force Apex to call the query to populate the VF page. It seems the getContent() by itself doesn't do enough to get the fields to populate on the page. The extension controller gets around this and so my Invoice feature happily fires off an email and I only had to write a couple of lines of code. Happy days!

 

Hope this helps someone

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I want to use Fieldsets in a managed package. The documentation states:

If a Visualforce page is added to a managed package and distributed, subscribers can edit the properNames field set. The logic for generating the Visualforce page remains the same, while the presentation differs based on each subscriber's implementation. To reference a field set from a managed package, you must prepend the field set with the organization's namespace

But if the custom object is in the same managed package as the fieldset does the namespace still need to be prepended?

I'm sure we're all delighted to hear that IE9 is out :-(. More wasted hours of torterous debugging the IE only problem that causes our beautifully crafted VF page to break. Now we can look forward to the delights of debugging IE7, 8 and 9!

 

So we downloaded IE9 to test it with our Visualforce Pages (may as well face the pain early) and got the following error from the A4JAjax library that Saleforce uses for all their javascript magic. I've logged a case so this is just to alert the community.

 

Hear is the error:


3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41
SCRIPT16386: No such interface supported

The error occurs if the page controller uses a method to render selectlists, checkboxes or radio buttons.

Example:

<apex:outputLabel value="Choose a Consultation Fee"/>
<apex:selectList value="{!SelectedConsultationFee}" id="conFees" size="1">
<apex:selectOptions value="{!ConsultationFees}"/>
</apex:selectList>

Controller Code snippet

public List<SelectOption> getConsultationFees() {
// rest of code
}

I ran into the following issue when testing code in a manage package. A test needed to get the Id's of the RecordTypes associated with different records in a custom object.

The sample code in SF is this:

 

 

List<RecordType> rtypes = [SELECT Name, id FROM RecordType WHERE sObjectType='Account' and isActive=true];

 of course this works because Accont is a native object. But the following code fails in a managed package

 

 

List<RecordType> rtypes = [SELECT Name, id FROM RecordType WHERE sObjectType='MyObject__c' and isActive=true];
 Map<String, String> accRecTypes = new Map<String, String>();
   for(RecordType rt: rtypes){
      accRecTypes.put(rt.name, rt.id);
   }

 

This fails because the custom object is appended with the Namespace so the sObjectType value should be MyNameSpace__MyObject__c. This is pain if you're moving from Dev, to Staging Orgs, Beta etc as you need to change the query each time. The solution is simple - leave out the sObjectType param in the Where clause and then get the types you want. The number of RecordTypes is generally small so its not a big deal.

 

List<RecordType> rtypes = [SELECT Name, id FROM RecordType WHERE isActive=true];

 

//now get the types you want
string MyType1Id = accRecTypes.get('My Record Type 1'); string MyType2Id = accRecTypes.get('My Record Type 2');

 



 

 

//this will fail reporting a size of 0
string s = 'first.second';
string[] part;
part = s.split('.');
System.DEBUG(part.size());

//this will work reporting a size of 2
string s = 'first_second';
string[] part;
part = s.split('_');
System.DEBUG(part.size());

 

I'm usign API version 20. Paste this into the Execute Anonymous window of the IDE. Anyone have any ideas?

 

I understand that the Translation Workbench allows for the values in a pick list to be converted to an other langauge. What is the impact on SOQL queries that use he value of a picklist in its WHERE clause

 

Will 

select name from account where type = 'prospect'

Still work if the picklist is localised to say German or does the SOQl statement need to be changed to

select name from account where type = 'aussicht'

 

I'm working in a two man dev team - we're using the IDE and each of use have our own dev org. We're using Subclipse for version control. We came across what I think is bug or prehaps we're doing something wrong. Here goes

 

Dev1 changes the name of a field (Acct to Acc) in a sObject (insurance_policy__c) in his org and syncs the change to his IDE. This field has a lookup relationship with Account called insurance_policies. All changes are checked into svn.

 

Dev2 gets the latest version from SVN and loads it into his IDE. It sees that the sObject has changes. He then does a Save to Server  - it fails with an error that says that there is already a relationship called insurance_policies. It fails to recognise that only the field name has change and that this not a new field. The only work around is to manually rename the field directly in SF,  or rename the relationship name in the local metadata. The latter results in a new field and new relationships.

 

During a Save to Server SF should check and compare the incoming metadata and drop the fields that have been removed including relationships and accept the changed field and its relationships or even better just recognise a simple name change.

I'm trying to pass a value to the attribute of a component from a query parameter value. I need to change the value passed to the attribute based on the query string value. Here's the code:

 

 

showPreviousBtn="{!CASE($CurrentPage.Parameters.step,"0","false","true")}"
showNextBtn="{!CASE($CurrentPage.Parameters.isLast,"false","true","true","false","true")}"
				

 

 

Line 2 in the code 'showNextBtn' works fine, its the first line that returns the following error:


Save error: Attribute name "false" associated with an element type "apex:componentReference" must be followed by the ' = ' character. at line 31  

 

I did try this hack, thinking the CASE function didn't like just one statement, but the same error occurred

 

 

showPreviousBtn="{!CASE($CurrentPage.Parameters.step,"0","false","1","true","true")}"

 The only difference in the parameters is that the first uses a digit and the latter true/false. But it shouldn't matter as anything in the query param is treated as a string. As soon as I remove the offending line everything works again. I also tried using the IF function but it doesn't seem to like non-boolean values

 

Heres how the attribute appears in the component

 

 

<apex:attribute name="showPreviousBtn"
description="display/hide button" type="string" required="false"
assignTo="{!showPreviousButton}"  />

 

 

 

I see that there's to be a Dreameforce again this year in the US with a very nice competition for startups- but it's only open to US company's :-(.

 

We innovate this side of the pond as well!  So any word on a European Event - Dublin, for example, has some great locations - and  the Guinness is good-  just a suggestion :-)

I'm developing a wizard that lets user choose the steps they want to use based on pre-existing visualforce pages. And its coming along nicely. However it did raise a question in testing - which led to a thought :manhappy:.

 

Good testing practice indicates that you should not assume that data, such as a particular account, exists and that you should create test data in the Test Buildup. In this case I'm using an SObject to store the URL's of certain VisualForce pages, yes I know I could populate the SObject in the Test Code with known VF pages (which is what I'll probably have to do).

 

BUT, and this is out of technical curiousity, is there a way to dynamically (i.e. use APEX) to create a visualforce page?

I wanted to Email a PDF version of an Invoice page (PrintInvoice) I had created so I went about doing the usual stuff by creating a VF page that used the just the StandardController for a Custom Object called Invoice__c with the attribute renderAs="PDF"

 

Like so

 

 

<apex:page Standardcontroller="Invoice__c"  showheader="false"  renderAs="pdf">

<!-- all the rest of the page. THIS IS A SIMPLIFIED VERSION -->
<apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputText style="font-weight: bold;margin-right: 5px; font-size: medium;"
                        value="{!$Organization.Name}" />
                </apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection title="Charges for Patient: {!Invoice__c.patient__r.Patient_Name__c}  ({!Invoice__c.patient__r.ChartID__c})">
        <apex:dataTable headerClass="invLineHdr" columnClasses="invLineCentre" value="{!Invoice__c.Invoice_Line_Items__r}" var="li">
<!-- Columns and values -->

</apex:dataTable>
            
        </apex:pageBlockSection>

</apex:page>

 This all worked fine, I could preview the page from another page using an iFrame and Print the page using <apex:outputLink value="{!$Page.PrintInvoice}?id={!Invoice__c.id}" target="_blank">Print Invoice</apex:outputLink>

 

All good. However note that the page only uses the Standard Controller. I then wrote a class to email the invoice as a PDF attachment using the examples specified in Salesforce

 

 

 

public pageReference emailInvoice(){
		
		Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
		PageReference pdf = Page.PrintInvoice;
		
		//prep attachment	
     		pdf.getParameters().put('id', invoiceId);
     		//pdf.setRedirect(true); //does not seem to be required
     		
     		Blob b = pdf.getContent();
     	
     		Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     		
     		efa.setFileName('invoice.pdf');
     		efa.setBody(b);
			
		string[] toAddr = new string[] {patient.Email__c};
		mail.setToAddresses(toAddr);
			
		mail.setSubject('Your Invoice from ' + UserInfo.getOrganizationName() + ' : Invoice No  ' + invoice.Name);
			
		mail.setHtmlBody('Thanks for attending:<b> ' + UserInfo.getOrganizationName() +' </b><p>'+
     			' Your Invoice is attached.');
 
     		mail.setFileAttachments(new Messaging.Emailfileattachment[] {efa});	
     		
     		Messaging.SendEmailResult [] r = 
			Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});  
     		
     		addInfo('Email Send result: '+ r[0].isSuccess());
			
		
		return null;
	}

 

 

When I ran the code I started getting errors along the following lines

 

SObject row was retrieved via SOQL without querying the requested field: Invoice__c.Account__r

 

On further testing I couldn't even access fields on the main Invoice__c object. It seems that the getContent() call doesn't quite do it in terms of getting the object field values. (By the way . setRedirect() has no impact, you'll notice I commented it out). So far I didn't have to write any code to get the PrintInvoice page to display and as I was using the cool new FieldSets ability, I really didn't want to have go and write a entire custom controller to create a page that would work as a PDF attachment.

 

Extension Controllers to the rescue!!! Poking around the help files I noticed that if you call the getRecord() method on a Standard controller it will return all the fields specifed on the associated Visualforce page. In other words getRecord() should get all the fields from Invoice__c and any related object field names I've specified on the page.

 

So the solution was to create a controller extension:

 

 

public with sharing class InvoicePrintControllerExtension {

	private final Invoice__c invoice;
	
	
	public InvoicePrintControllerExtension(ApexPages.StandardController controller){
		
		
		this.invoice = (Invoice__c)controller.getRecord();
		
		
	}

}

 and the modify the apex page

 

 

<apex:page Standardcontroller="Invoice__c" extensions="InvoicePrintControllerExtension"  showheader="false"  renderAs="pdf">

 

 

This seems to force Apex to call the query to populate the VF page. It seems the getContent() by itself doesn't do enough to get the fields to populate on the page. The extension controller gets around this and so my Invoice feature happily fires off an email and I only had to write a couple of lines of code. Happy days!

 

Hope this helps someone

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I'm just reading through the ISV documentation for Winter 12.  Whats the difference between a  Trialforce Management Organization and a Trialforce Org. I know what the latter is but I'm not sure what this new type of Org is?

 

It seems that a Trialforce Management Organization is place to setup branding and the custom login page, should this be the dev org from which the managed package is created. That is the org we currently setup email branding on.

 

What is a template v a snapshot? Our Trialforce Master Org has been upgraded to winter 12 but I can't see the new menu options

Here's one for all you builders of managed packages. I wanted to place a Custom Button the on Accounts page that you recalculate a value. To do this I needed to call a class, this can be achieved by setting the Custom Button to call some Javascript and then wire up an Ajax call. The code is straightforward

 

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

var bal = sforce.apex.execute("PaymentEngine","getAccountBalance", {id:"{!Account.Id}"});

//more code

 

 

The class needs to be Global and the method static and prefixed with WebService. All good.

 

HOWEVER if this is App is converted into a managed package the call will fail as the class requires that it has the Namespace prepended to it. The Ajax Toolkit allows you to add the Namespace via sforce.connection.defaultNamespace ="myNamespace". But I have to know the namespace in the first place. Moving between dev, deployment and product orgs it is not feasible to do this. Inspired by this article I created the following:

 

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

var result = sforce.connection.describeGlobal();
var TOKEN_OBJ = "Patient__c";  //ensure we get our Apps Namespace not someoneelses
var sobjects = result.getArray("sobjects");
var ns = "";

for(var i=0; i<sobjects.length; i++) {
     var sobjName = sobjects[i].name;
     //sforce.debug.log('Object Found: ' + sobjName);
     //describeResult = sforce.connection.describeSObject(sobjName); //dont call this makes it reallt slow
   //  sforce.debug.log('Is Custom: ' + describeResult.custom);

         var str = sobjName.split("__");
          //if there are 3 values there is a namespace
         if (str.length == 3){
             sforce.debug.log(sobjName + ' has namespace');
             //Is it one of ours?
             var sobj = str[1].valueOf() +'__c';
             if(sobj == TOKEN_OBJ) {
                    ns = str[0].valueOf();
             }else{
// just for debugging and testing
  // sforce.debug.log(sobjName + ' is not in my namespace'); } }else{

  // sforce.debug.log(sobjName + ' has no namespace'); } } if(ns != ""){ // sforce.debug.log(('I have a namespace called ' + ns');
sforce.connection.defaultNamespace =ns;
}else{
    // sforce.debug.log(('I have no namespace called');
}
//now do stuff
var bal = sforce.apex.execute("PaymentEngine","getAccountBalance", {id:"{!Account.Id}"});
window.alert("Balance updated to: " + bal );

 

So it works, but its crazy. Please Mr Salesforce can you make it easier to get the Namespace via AJAX, Javascript, jQuery. How about sforce.connection.getNamespaceFor('MyCustomObject__c');

 

 

 

 

 

 

I wanted to Email a PDF version of an Invoice page (PrintInvoice) I had created so I went about doing the usual stuff by creating a VF page that used the just the StandardController for a Custom Object called Invoice__c with the attribute renderAs="PDF"

 

Like so

 

 

<apex:page Standardcontroller="Invoice__c"  showheader="false"  renderAs="pdf">

<!-- all the rest of the page. THIS IS A SIMPLIFIED VERSION -->
<apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputText style="font-weight: bold;margin-right: 5px; font-size: medium;"
                        value="{!$Organization.Name}" />
                </apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection title="Charges for Patient: {!Invoice__c.patient__r.Patient_Name__c}  ({!Invoice__c.patient__r.ChartID__c})">
        <apex:dataTable headerClass="invLineHdr" columnClasses="invLineCentre" value="{!Invoice__c.Invoice_Line_Items__r}" var="li">
<!-- Columns and values -->

</apex:dataTable>
            
        </apex:pageBlockSection>

</apex:page>

 This all worked fine, I could preview the page from another page using an iFrame and Print the page using <apex:outputLink value="{!$Page.PrintInvoice}?id={!Invoice__c.id}" target="_blank">Print Invoice</apex:outputLink>

 

All good. However note that the page only uses the Standard Controller. I then wrote a class to email the invoice as a PDF attachment using the examples specified in Salesforce

 

 

 

public pageReference emailInvoice(){
		
		Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
		PageReference pdf = Page.PrintInvoice;
		
		//prep attachment	
     		pdf.getParameters().put('id', invoiceId);
     		//pdf.setRedirect(true); //does not seem to be required
     		
     		Blob b = pdf.getContent();
     	
     		Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     		
     		efa.setFileName('invoice.pdf');
     		efa.setBody(b);
			
		string[] toAddr = new string[] {patient.Email__c};
		mail.setToAddresses(toAddr);
			
		mail.setSubject('Your Invoice from ' + UserInfo.getOrganizationName() + ' : Invoice No  ' + invoice.Name);
			
		mail.setHtmlBody('Thanks for attending:<b> ' + UserInfo.getOrganizationName() +' </b><p>'+
     			' Your Invoice is attached.');
 
     		mail.setFileAttachments(new Messaging.Emailfileattachment[] {efa});	
     		
     		Messaging.SendEmailResult [] r = 
			Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});  
     		
     		addInfo('Email Send result: '+ r[0].isSuccess());
			
		
		return null;
	}

 

 

When I ran the code I started getting errors along the following lines

 

SObject row was retrieved via SOQL without querying the requested field: Invoice__c.Account__r

 

On further testing I couldn't even access fields on the main Invoice__c object. It seems that the getContent() call doesn't quite do it in terms of getting the object field values. (By the way . setRedirect() has no impact, you'll notice I commented it out). So far I didn't have to write any code to get the PrintInvoice page to display and as I was using the cool new FieldSets ability, I really didn't want to have go and write a entire custom controller to create a page that would work as a PDF attachment.

 

Extension Controllers to the rescue!!! Poking around the help files I noticed that if you call the getRecord() method on a Standard controller it will return all the fields specifed on the associated Visualforce page. In other words getRecord() should get all the fields from Invoice__c and any related object field names I've specified on the page.

 

So the solution was to create a controller extension:

 

 

public with sharing class InvoicePrintControllerExtension {

	private final Invoice__c invoice;
	
	
	public InvoicePrintControllerExtension(ApexPages.StandardController controller){
		
		
		this.invoice = (Invoice__c)controller.getRecord();
		
		
	}

}

 and the modify the apex page

 

 

<apex:page Standardcontroller="Invoice__c" extensions="InvoicePrintControllerExtension"  showheader="false"  renderAs="pdf">

 

 

This seems to force Apex to call the query to populate the VF page. It seems the getContent() by itself doesn't do enough to get the fields to populate on the page. The extension controller gets around this and so my Invoice feature happily fires off an email and I only had to write a couple of lines of code. Happy days!

 

Hope this helps someone

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I want to use Fieldsets in a managed package. The documentation states:

If a Visualforce page is added to a managed package and distributed, subscribers can edit the properNames field set. The logic for generating the Visualforce page remains the same, while the presentation differs based on each subscriber's implementation. To reference a field set from a managed package, you must prepend the field set with the organization's namespace

But if the custom object is in the same managed package as the fieldset does the namespace still need to be prepended?

I have recently uploaded a new Beta version. 
When I am trying to install the product using the installation link 
the process reaches up to the second step and then I get an "Install Failed" error, and the following message 

"Your requested install failed. Please try this again. 

None of the data or setup information in yoursalesforce.com organization should have been affected by this error. 

If this error persists, contact salesforce.comSupport through your normal channels and reference number: 786836172-4609 (-387707325)"

 

 

Is there a place when I can view the installation error log ? 

 

I filed a customer support case: #05105381.

 

 

 

 

  • April 03, 2011
  • Like
  • 0

I'm sure we're all delighted to hear that IE9 is out :-(. More wasted hours of torterous debugging the IE only problem that causes our beautifully crafted VF page to break. Now we can look forward to the delights of debugging IE7, 8 and 9!

 

So we downloaded IE9 to test it with our Visualforce Pages (may as well face the pain early) and got the following error from the A4JAjax library that Saleforce uses for all their javascript magic. I've logged a case so this is just to alert the community.

 

Hear is the error:


3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41
SCRIPT16386: No such interface supported

The error occurs if the page controller uses a method to render selectlists, checkboxes or radio buttons.

Example:

<apex:outputLabel value="Choose a Consultation Fee"/>
<apex:selectList value="{!SelectedConsultationFee}" id="conFees" size="1">
<apex:selectOptions value="{!ConsultationFees}"/>
</apex:selectList>

Controller Code snippet

public List<SelectOption> getConsultationFees() {
// rest of code
}

Hello.

We are finishing the development of our application and would like to customize the installation process.

Actually we are interested in such behavior: 

The installation request user if he interested to put the application to the default layout. If yes we should add it to his layout. In other case do nothing. 

If such behavior is not possible, how can we put the application to the users default layout during the installation without the request?

Hi

 

My visualforce page was working fine on IE8 with ajax being used. But on IE9 it gives an error

 

 

SCRIPT16386: No such interface supported
 
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

SCRIPT16386: No such interface supported 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

Any idea how it can be solved? 

  • March 21, 2011
  • Like
  • 0

Hi Everyone,

 

I was wondering if someone can help me with the errors I'm experiencing trying to deploy a package using the Force.com IDE to a trial org I have set up:

 

Failures:

   objects/Case.object

                Case.Adverse_Event : Picklist value: Twitter in picklist : Origin not found

                Case.General_Request : Picklist value: Twitter in picklist : Origin not found

                Case.Medical_Inquiry : Picklist value: Twitter in picklist : Origin not found

                Case.Samples_Request : Picklist value: Twitter in picklist : Origin not found

                Case.Product_as_per_Speciality_for_Sample_Req : Field Specialty_1_vod__c does not exist. Check spelling.

 

Here's the code surrounding the errors in the Case object:

 

<picklistValues>
            <picklist>Origin</picklist>
            <values>
                <fullName>Email</fullName>
                <default>false</default>
            </values>
            <values>
                <fullName>Phone</fullName>
                <default>false</default>
            </values>
            <values>
                <fullName>Twitter</fullName>
                <default>false</default>
            </values>
            <values>
                <fullName>Web</fullName>
                <default>false</default>
            </values>
        </picklistValues>

 

<validationRules>
        <fullName>Product_as_per_Speciality_for_Sample_Req</fullName>
        <active>false</active>
        <errorConditionFormula>AND(RecordTypeId = &apos;012A0000000lXFv&apos; ,
    AND( TEXT(Product__c) =&apos;Praxil&apos; , TEXT(Account.Specialty_1_vod__c)  &lt;&gt; &apos;Cardiovascular&apos;) ,
    AND(TEXT(Product__c) =&apos;Dilaclor&apos; ,  TEXT(Account.Specialty_1_vod__c)  &lt;&gt; &apos;Oncology&apos;),
    AND(TEXT(Product__c) =&apos;Varwiz&apos; ,  TEXT(Account.Specialty_1_vod__c)  &lt;&gt; &apos;Respiratory&apos;),
    AND(TEXT(Product__c) =&apos;Quivliax&apos; ,  TEXT(Account.Specialty_1_vod__c)  &lt;&gt; &apos;Rheumatology&apos;),
    AND(TEXT(Product__c) =&apos;Ruvizah&apos; ,  TEXT(Account.Specialty_1_vod__c)  &lt;&gt; &apos;Vaccines&apos;)
)</errorConditionFormula>
        <errorMessage>Select Product base on Specialty
If Product = Praxil, Then = Cardiovascular; If Product = Dilaclor, Then = Oncology, If Product = Varwiz, Then = Respiratory, If Product = Quivliax, Then = Rheumatology, If Product = Ruvizah, Then = Vaccines</errorMessage>
    </validationRules>

  

Any help would be greatly appreciate!

 

Thanks a lot!

 

Hi,

I was wondering if there was any information on how S2S and Trialforce work together.  Let me explain my use case first and then what I am trying to do.

 

Use case: We require data sharing between our customers' orgs (who will be using our managed app - a standalone app that will be used by non-SFDC CRM customers) and our own "Central" org.  The "Central" org will host data that will be accessed by the "Customer" orgs.  The "Central" org collects data from a variety of sources, processes it, and makes it avaiable for the "Customer" orgs.  The "Customer" orgs further process this data by combining it with some of their own, proprietary data.  Salesforce to Salesforce seems to be the ideal model to make this sharing happen.  Using Apex to do this as per some other posts seems to be a very narly affair that I would like to try and avoid.

 

We would like to use Trialforce to deploy the "Customer" org.  In order to give our customers a painless out of the box experience, we would like to configure the Trialforce Master org to have S2S enabled and configured to automatically connect with our "Central" org and automatically subscribe to the Custom objects that the "Central" org publishes.  In addition, we would like the Master org to be configured to automatically accept all records that the "Central" org pushes out.

 

Is something like this possible?  What have others done?  If this is not possible, what are the alternatives?

 

Thanks,

 

Sumit

  • September 03, 2010
  • Like
  • 0

Hi All,


I'm the Product Manager for packaging here at salesforce.com.  We're currently working on a feature that would allow fields and objects to be removed from managed packages.  This is a popular request and something we're hoping to deliver very soon, but we need your help.  Please respond to this post with any thoughts around this topic.  I've included a few questions to get the conversation going:


  • Why do you want to remove these?  No longer used?  Customers didn't like them?  Replace with a new field?
  • When you deprecate a field/object, what should happen for existing customers?  New customers?
  • Would you have to remove all usage of a field/object in your app before you can deprecate it?  What happens if you've included the field in another formula field, etc?  
Thanks for your time and input!
Message Edited by A_Smith on 02-20-2009 05:55 PM