• xxyyzz
  • NEWBIE
  • 30 Points
  • Member since 2009

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

Hi,

 

I am trying to override the new button on contacts with the following code taken from  the cookbook.

var newUrl = "{!URLFOR( $Action.Contact.NewContact, null,
        [con4_lkid= Account.Id,
         con4 = Account.Name,
         con19city = Account.BillingCity,
         con19state = Account.System_State_Code__c, 
         con19street = Account.BillingStreet,
         con19zip = Account.BillingPostalCode,
         con19country = Account.BillingCountry,
         retURL=$Request.retURL] ,true)}";
            
window.parent.location.replace(newUrl);

 The idea is to populate the Mailing State/Province field on Contact with the custom field System_State_Code__c. I think there is a Salesforce bug here as the code does not work if I leave in the lines:

 

con4_lkid= Account.Id,
con4 = Account.Name,

 If I remove these lines, the Mailing State/Province does get populated, however the Account lookup on the contact will be blank. 

I have a requirement where I need to be able to pass the name of a batch apex class to a function as a string. The function will then call Database.ExecuteBatch using the string as the name of the class.

 

E.G.

 

public void executeBatch(String className, String parameter1){

    //This is where I am stuck
    className classToExecute = new className(parameter1);

    Database.ExecuteBatch(classToExecute, 5);

}

 How do I dynamically create an instance of the class?

  • December 01, 2011
  • Like
  • 0

I have recently come across an issue on a Visualforce page with rerendering an <apex:detail> section which contains a roll-up summary field. It appears that the rerender is performed before the roll-up summary field is recalculated  so the field on the VF page will always display the previous value

 

 

 

<apex:pageblock id="pageBlockToRerender">    
    <apex:detail relatedlist="False" subject="{!Stock_Order__c.id}"/>    		
</apex:pageblock>


<apex:commandbutton value="Add To Order" action="{!addToOrder}" rerender="pageBlockToRerender"/>  





 

 

In the example, clicking the command button creates a new order line item (which is a master detail of Stock_Order__c). The apex:detail contains a roll-up summary field which counts the number of order line items. The apex:detail section does get rerendered but this happens before the roll-up summary field is incremented.

 

Has anybody come across this issue before?

 

 

 

  • March 11, 2011
  • Like
  • 0

Hi,

 

I have a visualforce email template which is related to a custom object. In the template I have the following line where Agenda_Objective__c is a long text area.

 

 

<apex:outputText value="{!relatedTo.Agenda_Objective__c}"/>

 

 If there are any line breaks in the field in the custom object, they do not come through in the email template.

E.G. if the field contains the text:

 

Test1

Test2

Test3

 

the mail will display

 

Test1 Test2 Test3

 

Is there any way of preserving the line breaks? I could use outputfield instead of outputtext but this puts extra javascript into the mail which causes an error in my email client.

 

  • December 14, 2009
  • Like
  • 0

Hi,

 

I have a visualforce email template which is related to a custom object. In the template I have the following line where Agenda_Objective__c is a long text area.

 

 

<apex:outputText value="{!relatedTo.Agenda_Objective__c}"/>

 

 If there are any line breaks in the field in the custom object, they do not come through in the email template.

E.G. if the field contains the text:

 

Test1

Test2

Test3

 

the mail will display

 

Test1 Test2 Test3

 

Is there any way of preserving the line breaks? I could use outputfield instead of outputtext but this puts extra javascript into the mail which causes an error in my email client.

 

  • December 14, 2009
  • Like
  • 0

I need to create VF page with button which creates new element related to current and add it to list. I want to fill automatically master field and maybe some additional fields.

 

Can I extend code below some how to make it?:

 

 <apex:commandButton action="{!URLFOR($Action.CF_OtherOp__c.New)}" value="new bussines opportunity"/>

 

If not how its possible to implement? 

  

Thanks,

  Kostja