• jhelbling
  • NEWBIE
  • 25 Points
  • Member since 2011

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

Hello,

 

For a Unit Test, I need to ensure a validation rule gets correctly fired. I want to avoid having a hard coded string variable within the test containing the message I'm suppose to receive.

 

What is the easiest way, from APEX, in order to parse a Validation Rule metadata and get its error message ?

 

Thanks ouy very much.

Hi everyone,

 

I have a column that uses a facet to display a header as follow :

<apex:column >
   <apex:facet name="header">
       <apex:commandLink value="myvalue" action="..." rerender="..." style="...">
          <apex:param name="..." value="discount" ..."/>
       </apex:commandLink>
    </apex:facet>      
</apex:column>

 

This is working well.

 

Now if I add another text, like for example :

 

<apex:column >
   <apex:facet name="header">
       <apex:commandLink value="myvalue" action="..." rerender="..." style="...">
          <apex:param name="..." value="discount" ..."/>
       </apex:commandLink>
       <br/>
       test
    </apex:facet>      
</apex:column>

 

My header will only display "test", and I don't see anymore the value of the commandLink object.

 

Is it expected ?

 

Thanks.

Hi everyone,

 

When running the following code (anonymous APEX) :

 

Opportunity o1 = new Opportunity(Name='test',StageName='6',CloseDate=Date.newInstance(2013,4,4));
OpportunityLineItem oli1 = new OpportunityLineItem(Quantity=2);
List<OpportunityLineItem> listOli1 = new List<OpportunityLineItem>{oli1};
Map<Opportunity,List<OpportunityLineItem>> m = new Map<Opportunity,List<OpportunityLineItem>>{};
m.put(o1,listOli1);
List<Opportunity> listOpp = new List<Opportunity>{};
listOpp.addall(m.keySet());
insert listOpp;
For(Opportunity o : listOpp) {
	System.Debug(m.get(o));
}

 

My Debug message only shows "null" ....

 

Why can't I find the OLI within my Map ?

 

Thanks

 

P.S. : I can provide further information regarding the background explaining why I need to proceed this way ... but maybe somebody sees a stupid thing I don't see myself ...

Hello,

 

The following will work :

 

Map<ID,Account> m = new Map<ID,Account>{};
(insert values into m)
m.get(id).get("fieldName") = "a value";

 

Now I would like to use "fieldName" in the following, but it won't work :

 

Map<ID,Account> m = new Map<ID,Account>{};
m.put(id, new Account(id=id, "fieldName"="a value"));

 

Does anybody have a workaround ?

 

Is it somehow possible to create a new object by referencing a field name using a variable ?

 

Thank you very much.

 

 

 

Hello all,

 

Using renderas="pdf", I'm rendering a VF Page to PDF. My VFP uses a table having a header repeated on each page. In order to do that I'm using the following HTML tag :

 

 

 

<thead>
<tr>
<th>
 </th>
etc ..

 

With the following CSS :

 

table {-fs-table-paginate: paginate;}

 

This is working fine.

 

However in some situations (when the table doesn't have any further rows to be displayed) I don't want the header to be displayed on the last page.

 

Does anybody know how to achieve this ?

 

Thank you very much.

Hi all,

 

I have 2 customized buttons on a layout that called 2 different VF Pages. However these 2 VF Pages only have few differences.

 

I would like to use only a single VF Page and hide some elements depending from which button the VF Page has been called.

 

What I'm missing : how can I determine from my VF Page which button has been clicked ?

 

Thank you very much.

Julien

Hi all,

 

Probably easy but I can't figure out ...

 

In my VF Page, I need to access the Quote allowEmail field embedded in the Status picklist (http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_picklist.htm).

 

Does anybody know how to do that ?

 

The best I could find until now if the following code but it only returns me the value of the PickList ... and not this specific allowEmail field :

 

        List<SelectOption> options = new List<SelectOption>();
        Schema.DescribeFieldResult F = Quote.Status.getDescribe();
             List<Schema.PicklistEntry> Ple = F.getPicklistValues();
             for(Schema.PicklistEntry p : ple){
                options.add(new SelectOption(p.getlabel(),p.getlabel()));
p.getLabel();
             }

 

Thank you very much.

 

Hi all,

 

I'm using the emailAuthor within a VF Page and I'm looking for a description of the available parameters. I could for example find the following sample code :

 

var url = "https://na3.salesforce.com/email/author/emailauthor.jsp?";
  url += "p2_lkid=" + contactIdForToAddress;
  url += "&p3_lkid=" + relatedObjectId;
  url += "&template_id=" + templateId;
  url += "&new_template=1";
  url += "&retURL=%2F" + relatedObjectId;
  url += "&nosave=0";   // not sure what this parameter does, or if it's really needed
  url += "&save=1";   // send it now - don't just bring us to the "send email" page

 

However is there somewhere a description of the different parameters ? (saying for example that "p2_lkid" matches the "To" address.

 

Thank you very much.

 

Hi all,

 

I have the following code in a VF Page in order to create a PDF :

 

<apex:repeat>
  <apex:outputtext>text 1</apex:outputtext>
  <apex:repeat>
     <apex:outputtext>text 2</apex:outputtext>
  </apex:repeat>
</apex:repeat>

 

My code will be used to issued PDF with the following structure :

 

Group 1
  SubGroup 1.1
  SubGroup 1.2
Group 2
  SubGroup 2.1
  SubGroup 2.2
Group 3
  SubGroup 3.1
  SubGroup 3.2

 

I'm encoutering some issues with the pagination. I don't want a main Group (like "Group 1") to be "cut" on 2 pages.

 

Does anybody know if the apex:repeat tag has some options in order to mention that a repeat loop has to overflow on the next page if not enough space is avaialble to display the content on the current page ?

 

Thank you very much.

 

Hi all,

 

Using a VF Page and the renderas property set to "PDF", I can correctly create a PDF. Using the following in the <style> tag allows me to set the margin for my PDF :

 

@page { 
  size: letter portrait;
  margin-top: 50px;
  margin-bottom: 300px;
}

 

My question is : is there a way to have a different margin-bottom only for my last page ?

 

Thank you very much.

Hello,


I guess this question has been raised several times already but I couldn't make it working even with some example found on the Web ...

I have an APEX class containing a variable for which I need to get a value from a VF Page. Then I have another method that should return the value of this variable (nothing useful ... just an example). My class contains the following :

 


public class myClass {
    public string myVariable;
  
    public string getTheValue() {    
        return myVariable;
    }
    
    public void setMyVariable(string s) {
        myVariable = s;
    }
}

 

An my page is as follow :

<apex:page standardController="Quote" renderas="pdf">
    <html>
        <body>    
            <div style="border-width:1px; border-style:solid; position:fixed; top:450px; right:1px">
<apex:outputText value="{!theValue}">
<apex:param assignTo="{!myVariable}" value="Hello World"/>
</apex:outputText>
            </div>
        </body>
    </html>
</apex:page>

 

But I never get anything displayed in the outputText tag. I tried to put the apex:param part before the outuputText as I thought that maybe it has not been initialized ... but it didn't help.

Does anybody have an idea about what's wrong ?

Hi all,

 

Is it possible to clone a standard tab like the "Case" one ? If yes, is there any documentation related with that ?

 

Many thanks

Hi everyone,

 

I have a column that uses a facet to display a header as follow :

<apex:column >
   <apex:facet name="header">
       <apex:commandLink value="myvalue" action="..." rerender="..." style="...">
          <apex:param name="..." value="discount" ..."/>
       </apex:commandLink>
    </apex:facet>      
</apex:column>

 

This is working well.

 

Now if I add another text, like for example :

 

<apex:column >
   <apex:facet name="header">
       <apex:commandLink value="myvalue" action="..." rerender="..." style="...">
          <apex:param name="..." value="discount" ..."/>
       </apex:commandLink>
       <br/>
       test
    </apex:facet>      
</apex:column>

 

My header will only display "test", and I don't see anymore the value of the commandLink object.

 

Is it expected ?

 

Thanks.

Hi everyone,

 

When running the following code (anonymous APEX) :

 

Opportunity o1 = new Opportunity(Name='test',StageName='6',CloseDate=Date.newInstance(2013,4,4));
OpportunityLineItem oli1 = new OpportunityLineItem(Quantity=2);
List<OpportunityLineItem> listOli1 = new List<OpportunityLineItem>{oli1};
Map<Opportunity,List<OpportunityLineItem>> m = new Map<Opportunity,List<OpportunityLineItem>>{};
m.put(o1,listOli1);
List<Opportunity> listOpp = new List<Opportunity>{};
listOpp.addall(m.keySet());
insert listOpp;
For(Opportunity o : listOpp) {
	System.Debug(m.get(o));
}

 

My Debug message only shows "null" ....

 

Why can't I find the OLI within my Map ?

 

Thanks

 

P.S. : I can provide further information regarding the background explaining why I need to proceed this way ... but maybe somebody sees a stupid thing I don't see myself ...

Hello all,

 

Using renderas="pdf", I'm rendering a VF Page to PDF. My VFP uses a table having a header repeated on each page. In order to do that I'm using the following HTML tag :

 

 

 

<thead>
<tr>
<th>
 </th>
etc ..

 

With the following CSS :

 

table {-fs-table-paginate: paginate;}

 

This is working fine.

 

However in some situations (when the table doesn't have any further rows to be displayed) I don't want the header to be displayed on the last page.

 

Does anybody know how to achieve this ?

 

Thank you very much.

Hi,

 

I have a VF page; which I am rendering as a PDF. In the page; I have a table which displays "QuoteLineItems".

I want that the table header should be repeated if the contents of "Table" goes over a page.

 

After doing research I found out that there is a css property which can be used to achieve this. But when I try to implement the solution it is not working. I have used following code(just a part of HTML)

 

Css that I have used -

<style>

thead { display: table-header-group;}

</style>

 

VF Page Code - 

<table border="0" width="100%" id="table4">
        <thead>
            <tr>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quotePosition}</font></th>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteDescription}</font></th>
               <!--<td bgcolor="#C0C0C0"><font face="Arial">Image</font></td>-->
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteQuantity}</font></th>
               <th bgcolor="#C0C0C0"><font face="Arial">{!$Label.quoteTotalPerPosition}</font></th>
            </tr>
        </thead>
        <tr>
            <apex:repeat value="{!lstQuoteLineItems}" var="quoteLineItemObj"> 
                <tr>
                     <td style="vertical-align:top">{!quoteLineItemObj.Position__c}</td>
                     <td style="vertical-align:top">{!quoteLineItemObj.Description}<br/>
                         <apex:outputField value="{!quoteLineItemObj.Product_Detail__c}"/> 
                     </td>            
                     <td style="vertical-align:top"><apex:outputText value="               {!quoteLineItemObj.Quantity}" /></td>
                     <td style="vertical-align:top"><apex:OutputField value=" {!quoteLineItemObj.Total_Per_Position__c}"/></td>
                 </tr>
                 <tr><td><br/></td></tr>
           </apex:repeat>
       </tr></table>

 

Does anybody implemented this sought of functionality; if yes, could you please share your thought or tell me what I am doing wrong here!!

 

Thanks in advance!!

 

Hi all,

 

I have the following code in a VF Page in order to create a PDF :

 

<apex:repeat>
  <apex:outputtext>text 1</apex:outputtext>
  <apex:repeat>
     <apex:outputtext>text 2</apex:outputtext>
  </apex:repeat>
</apex:repeat>

 

My code will be used to issued PDF with the following structure :

 

Group 1
  SubGroup 1.1
  SubGroup 1.2
Group 2
  SubGroup 2.1
  SubGroup 2.2
Group 3
  SubGroup 3.1
  SubGroup 3.2

 

I'm encoutering some issues with the pagination. I don't want a main Group (like "Group 1") to be "cut" on 2 pages.

 

Does anybody know if the apex:repeat tag has some options in order to mention that a repeat loop has to overflow on the next page if not enough space is avaialble to display the content on the current page ?

 

Thank you very much.

 

Hi all,

 

Using a VF Page and the renderas property set to "PDF", I can correctly create a PDF. Using the following in the <style> tag allows me to set the margin for my PDF :

 

@page { 
  size: letter portrait;
  margin-top: 50px;
  margin-bottom: 300px;
}

 

My question is : is there a way to have a different margin-bottom only for my last page ?

 

Thank you very much.

Hello,


I guess this question has been raised several times already but I couldn't make it working even with some example found on the Web ...

I have an APEX class containing a variable for which I need to get a value from a VF Page. Then I have another method that should return the value of this variable (nothing useful ... just an example). My class contains the following :

 


public class myClass {
    public string myVariable;
  
    public string getTheValue() {    
        return myVariable;
    }
    
    public void setMyVariable(string s) {
        myVariable = s;
    }
}

 

An my page is as follow :

<apex:page standardController="Quote" renderas="pdf">
    <html>
        <body>    
            <div style="border-width:1px; border-style:solid; position:fixed; top:450px; right:1px">
<apex:outputText value="{!theValue}">
<apex:param assignTo="{!myVariable}" value="Hello World"/>
</apex:outputText>
            </div>
        </body>
    </html>
</apex:page>

 

But I never get anything displayed in the outputText tag. I tried to put the apex:param part before the outuputText as I thought that maybe it has not been initialized ... but it didn't help.

Does anybody have an idea about what's wrong ?

Hi all,

 

Is it possible to clone a standard tab like the "Case" one ? If yes, is there any documentation related with that ?

 

Many thanks

Hi, 

 

I want to get the last modified date of a custom object definition in Apex or via WS.  Schema.DescribeSObjectResult doesn't have a method like getLastModifiedDate.  But this info is clearly available in the custom object definition detail page.  Is there anyway to get this in the Apex code?  Similarly I want to know the last modified date of a custom field definition, and I'm facing the same issue.

 

I also check the meta data API reference and cannot find anyway to get the last modified date of custom object definition.

 

Please point me to the right direction.

 

Thanks,

 

-Qin zhang

  • January 21, 2011
  • Like
  • 0

I have a Change Set that I'm trying to deploy from my Sandbox. My classes all work properly and my Test methods are getting appropriate coverage in the Sandbox. However, when I try to validate the Inbound Change Set on my production site I get an error that isn't appearing in my Sandbox:

 

quoteExtentionTest2.QuotePdfTest() Line 98

Failure Message: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, This field is required: [VersionData]", Failure Stack Trace: "Class.quoteExtension.quoteSave: line 98, column 9 Class.quoteExtentionTest2.QuotePdfTest: line 64, column 9 External entry point"

 

The line of code generating the error is inserting a QuoteDocument object; I used http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_quotedocument.htm as my reference for what fields are required. VersionData seems to be a field for a ContentVersion object - which is an object I am not dealing with currently. How do I deal with that error?

  • January 03, 2011
  • Like
  • 0

When using table headers and footers in a pdf, I'd like these headers and footers to be repeated on every page (as outlined in the w3c html spec), however the renderer does ignore this and only include one header at the beginning and one footer at the end of the table. (see code below)

 

Any idea how this can be activated? Or is this an unsupported feature?

 

Help would be highly appreciated to allow creation of e.g. quotes with dynamic content.

 

 

(http://www.w3.org/TR/REC-html40/struct/tables.html#edef-TFOOT  --> "When long tables are printed, the table head and foot information may be repeated on each page that contains table data.")

 



<table border="1" rules="groups">
<thead>
<tr>
<th>
HEADER
</th>
</tr>
</thead>
<tfoot>
<tr>
<td>FOOTER</td>
</tr>
</tfoot>
<tbody>
<tr><td>Line 1</td></tr>
.
.
.
<tr><td>Line 100</td></tr>
</tbody>
</table>


  • January 28, 2009
  • Like
  • 0