• JMPlayer22
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 21
    Replies

Hello,

 

Is there a way I can have a modal dialog box pop up over a standard object detail page?

 

My use case is:  If our sales team moves an opportunity into a certain stage we want a pop-up over the entire page to deliver some information to them regarding the opportunity based on certain criterea.

 

I've tried using jQuery and YUI via VF Pages but the modal popups only interact within the inline page.  Is there a way I could get it to pop up over the entire detail page without rebuilding the detail page in a custom VF Page?  Would an S-Control work?

 

Thanks

I'm having a hard time writing a test method for a custom object that has Formula Fields on them that are being used in the methods I am trying to cover.

 

When I debug the fields in the test method they are coming up as null, but, if I query the record it shows those fields as being updated correctly.

 

Where I run into a problem is when I have nested formula fields and then pass the final record I want tested to the method via a trigger.  The field that starts at the top level of the hierarchy hasn't made it all of the way to the final record.

 

Is there something I'm missing or do I need to query each and every object before associating it to the next in the hierarchy?  The final record doesn't have a direct reference to the fields in question but the class queries them based on a set criteria.

 

Any help would be appreciated.  Thanks!

I have an after insert trigger that executes a class when a check box on an opportunity is checked.

 

The problem is.. no matter if the check box is checked or not it always returns false.  I know I'm missing something here but I just can't nail it down.

 

Here's the code:

 

 

trigger ProjectAfterInsertOnly on SFDC_520_Quote__c (after insert) 
{
	for(SFDC_520_Quote__c nProj:Trigger.new)
	{
		if (nProj.Opportunity__r.Phased_Project__c)
		{
			ProjectClass2.PhasedProject(nProj);				
		}
	}	
}

 

 

Pretty straightforward trigger but if I run a debug check against any check box on the opp it returns false as well regardless.

 

What the heck am I missing?

 

Thanks!

 

Jason

Hello,

 

Is there a way I can have a modal dialog box pop up over a standard object detail page?

 

My use case is:  If our sales team moves an opportunity into a certain stage we want a pop-up over the entire page to deliver some information to them regarding the opportunity based on certain criterea.

 

I've tried using jQuery and YUI via VF Pages but the modal popups only interact within the inline page.  Is there a way I could get it to pop up over the entire detail page without rebuilding the detail page in a custom VF Page?  Would an S-Control work?

 

Thanks

Hello

 

I've had this issue before with commandLinks but now I'm having it with commandbuttons too. This used to work. Looking at the code it seems some javascript submits the form, but something is a tad wrong there. If I click the button the form submits, but most users are trying to press enter(like they used to do). This seems to be a problem on na7 but not on na6. My page,

 

 

<apex:page controller="EditStandardObjSites" cache="false"> <apex:form > <apex:pageblock > <apex:pageBlockSection > <apex:outputLabel value="{!acc.id}"/> <apex:inputText value="{!name}"/> <apex:commandButton value="Save" action="{!save}" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

The controller just has a public string property and and account object, along with a method to save said object. Note: this updates the account name when I press the button, but not if I simply press enter.

 

Any ideas?

 

Wes

 

 

Hi community,

 

I am working on a VisualForce element which is included in the page layout of my custom object "invoice".

The VF page gets two different lists of opportunities from the account where both, invoice and opptis are  connected to. From those lists you can select opptis and process them.

The basic function works just fine so far.

 

Now, here's my problem: Once the processing is complete I want to fully reload the invoice - the whole page, including the related lists and so on.

 

I tried setting PageReference for my action method and several javascript actions for onComplete.

The PageReference loads the invoice again in the iframe where my VF element was.

The javascripts don't load the whole page again. If I were able to get the current invoice ID this might work:

 

 

<apex:commandButton value="Add Selected" action="{!processSelectedAdd}" onComplete="parent.location.href = '/'"/>

 

 ... by adding the ID to the parent.location.href value.

 

Here's the part of my controller with the PageReference I tried. You see "return null;" is not active at the moment. I tried that too but it doesn't worked out. To get the javascript redirect working at all the return value for this must be null:

 

public PageReference processSelectedAdd() { List<Opportunity> selectedOpportunities = new List<Opportunity>(); for (oOpportunity oOpp : getOpportunities()) { if (oOpp.selected == true) { selectedOpportunities.add(oOpp.opp); } } //System.debug('processing the following:'); for (Opportunity opp : selectedOpportunities) { opp.Invoice__c = this.invoice.Id; update opp; } PageReference pageRef = new PageReference('/' + this.invoice.Id); pageRef.setRedirect(false); return pageRef; //return null; }

 

 And here's the whole VF object:

 

 

<apex:page standardController="CM_Invoice__c" extensions="OpptiListControllerWrapper" tabStyle="Opportunity"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Add Selected" action="{!processSelectedAdd}" onComplete="parent.location.href = '/'"/> </apex:pageBlockButtons> <!-- --> <apex:pageBlockTable value="{!opportunities}" var="o" id="table"> <apex:column > <!-- --> <apex:inputCheckbox value="{!o.selected}"/> </apex:column> <!-- --> <apex:column value="{!o.opp.Name}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Remove Selected" action="{!processSelectedDel}" /> </apex:pageBlockButtons> <!-- --> <apex:pageBlockTable value="{!opportunities2}" var="o" id="table2"> <apex:column > <!-- --> <apex:inputCheckbox value="{!o.selected}"/> </apex:column> <!-- --> <apex:column value="{!o.opp.Name}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

 Really thankful for any hints!

 

Best,

Hannes

 

  • September 16, 2009
  • Like
  • 0

Hi all,

 

I'm attempting to add to the default page layout of a case object with a Visual Force page.

 

My supposrt staff have mentioned that case comments require too many clicks and page loads to get done, and would like a simple input field on the case page with a save button under it. Entering text, and then clicking save adds the comment to the case and clears the box for the next comment.

 

 

I've attempted to create this but without success. I can't figure out how to put an input field for a new child object on a visual force page.

 

My page looks like this:

 

<apex:page standardController="Case" extensions="caseLogisticsPageCtrlr" tabStyle="Case" > <apex:pageBlock> <apex:form > <apex:pageBlockTable rows="5" value="{!case.CaseComments}" var="cCom"> <apex:column> <apex:inputField value="{!cCom.CommentBody}"/> </apex:column> </apex:pageBlockTable> </apex:form> </apex:pageBlock> </apex:page>

 But as I'm sure you can tell... It just shows input fields from existing comments. 

 

My controller is this:

 

public class caseLogisticsPageCtrlr{ private final Case cse; public caseLogisticsPageCtrlr(ApexPages.StandardController stdController) { this.cse = (Case)stdController.getRecord(); } public Case getCase() { return [select id, CaseNumber, (select id, CommentBody, ParentId from CaseComments limit 5) from Case where id = :System.currentPageReference() .getParameters().get('id')]; } public String getName() { return 'caseLogisticsPageCtrlr'; } }

 

 I think I'm on the wrong track... Can anyone please help me out?

 

Thanks,

Jnic

 

 

 

  • August 07, 2009
  • Like
  • 0

I'm new to sfdc developing and i would like to pre-populate a field value when someone clicks the new button on any given object.

 

To my limited understanding there is no trigger that fires at this point. Is there a way to pre-populate field values using apex when someone clicks the new button? Thanks!

  • April 29, 2009
  • Like
  • 0

When you build page layouts in SF, you can create a new Section, and one of the properties is "Tab-key Order", options are "Left-Right" or "Top-Down".

 

How can I create the same effect in Visual Force?

 

The pageBlockSection has the "columns" attrubute, but not the order direction.

 

Then I looked at the inputFields to see if I can change their index, but there is no easily exposed attribute. 

 

This seems like an oversight.  I figured that I could create similiar layouts/flow with VisualForce.

 

Am I missing someplace?

 

Thanks,

Steve 

Hi All,

 

I want to write test methods for apex classes can any one provide me some usefull links. I created test methods for all my Triggers all are working fine. But i am not getting how to write test methods for apex classes. Plz any one help me.

 

Thanks,

Aswath.

  • March 20, 2009
  • Like
  • 0

I'm trying to send a Visualforce email template with custom object information that also lists out some child items. It's a pretty simple idea, but I'm getting a compile error because it doesn't like my child object reference. Can anyone help me correct this? I have bolded the problem line.

 

 

<messaging:emailTemplate subject="Changeover Order Form APPROVED"
recipientType="User" relatedToType="Changeover_Order_Form__c">
<messaging:plainTextEmailBody >

Details:
Account: {!relatedTo.Account__c}

Ingoing Order Amount: {!relatedTo.Ingoing_Order_Amount__c}
Package: {!relatedTo.Package_Options__c}
Gift Card Level: {!relatedTo.Gift_Card_Level__c}
Gift Card dollars used: {!relatedTo.Total_Gift_Card_dollars_used__c}

GIFT CARD SELECTION:
<apex:repeat var="gx" value="{!relatedTo.Gift_Card_Selection}">
Vendor: {!gx.Vendor_Card__c} ] - # of Cards: {!gx.of_Cards__c} ]
</apex:repeat>

View the record: http://www.salesforce.com/{!relatedTo.Id}

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

 

I made sure that the Child Relationship Name field was filled in with "Gift_Card_Selection."

Am I missing something else?

 

 

I have a visualforce page that renders perfectly fine in HTML. However, when I set Renderas="pdf" I get a gray header box labelled "VisualForce Error" and below it "Index:0, Size:0"
 
Are there any gotchas for renderas="pdf" that would return this error? I've done other pages that did similar functions and rendered fine as a pdf. The only thing I can think of is I have a lot of HTML and some Javascript on the page. I tried removing the javascript - but still receive the index:0 size:0 error.
 
What would cause the page to look great in HTML but not work in PDF?


Message Edited by BrianWK on 12-18-2008 10:09 AM
I'm merging in product line items into a visualforce template and I'd like the products to sort the same way they are in the Opportunity. Does anyone know how to do this? Here is my code..

Thanks, Chris
Code:
<messaging:emailTemplate subject="Product Quote" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >       
<html>
        <body>
         <STYLE type="text/css">
               Body {font-size: 11px; font-face: verdana } 
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
             <font face="arial" size="2">
 <p>Dear {!recipient.name},</p>
         <table border="0" >
                 <tr > 
                     <th>Product Name</th><th>Quantity</th><th>Total Price</th><th>Monthly Fee</th>
                  </tr>
  <apex:repeat var="oli" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td>{!oli.PricebookEntry.Product2.Name}</td>
           <td>{!oli.Quantity}</td>
           <td>${!oli.TotalPrice}</td>
           <td>${!oli.Extended_Monthly_Fee__c}</td>
       </tr>
 </apex:repeat> 


    </table>
    <p>
<apex:repeat var="opp" value="{!relatedTo}">
<p>
Total Subscription fees: ${!opp.X1St_Yr_ACV_Subscript__c}<br>
Total Services fees: ${!opp.Professional_Services__c}<br>
</p>
 </apex:repeat>     
    
    <p>
        Please contact me with any questions,
<apex:repeat var="o" value="{!relatedTo.Owner}">
<p>
{!o.Name}<br>
{!o.CompanyName}<br>
{!o.Phone}<br>
<a href="mailto:{!o.Email}">{!o.Email}</a><br>
</p>
 </apex:repeat> 
       <p />
 </font>
        </body>
    </html>


</messaging:htmlEmailBody>       
</messaging:emailTemplate>

 

  • November 19, 2008
  • Like
  • 0
I have created a Visualforce email template that automatically attaches a PDF rendering of a quote from the opportunity object. It works fine when manually selecting the template from the email author page.

However, if I create a custom button on the opportunity page to take me to the email author page with the whoid, whatid, and template id defined in the URL, the email subject and body show up just fine but there is no attachment. Anyone else run into this? Any ideas on a fix?

Message Edited by trsmith on 11-17-2008 01:08 PM

Message Edited by trsmith on 11-17-2008 01:10 PM
Hello,

I have been trying to get a field on a Visualforce page (the Account ID - a custom field which is a standard lookup) to pre-populate from a query parameter in the url. It does *not* work.

The general use case is that we have a related list on the Account Page for a custom object called Checklist. When we use the standard New button to create a new record, the Account ID is pre-populated on the page since the ID and name are passed in as query parameters.

We had to create a small Visualforce page instead of using the standard page, and overrode the New button. Now when you select New, the page loads without the Account ID pre-populated even though the ID and name are still in the url as query parameters. I took some JavaScript code to pull out those values and have been trying for the past day to figure out how to pass them to the standard controller so it recognizes the Account. The point here is that the end user should not have to re-select the Account from a lookup field when they just came from the Account page.

Since you can't simply View Source on a Visualforce page to see what the field name "{!Checklist__c.Checklist_Template__c}" resolves to (it's just escaped yet not interpreted at that point) I was forced to use a program to view the post request. It would appear that the <apex:inputfield> tag when referring to a lookup actually generates 6 input fields for it.

So... I used those 6 fields, populated them exactly as the lookup field would populate them, and still no luck.
Here is the code:
Code:
<apex:page standardcontroller="Checklist__c" tabstyle="Checklist__c">

  <apex:sectionHeader title="Checklist" subtitle="Create Checklist"/>
  <apex:form id="form1">
    <apex:pageBlock >
  <apex:pageBlockButtons location="top" >
   <apex:commandButton action="{!save}" onclick=" gup();" value="Save" />
  </apex:pageBlockButtons>
  <apex:pageBlockSection >
   <apex:pageBlockSectionItem >
    <apex:outputLabel value="Checklist Template" />
    <apex:inputField value="{!Checklist__c.Checklist_Template__c}" required="true" /> 
   </apex:pageBlockSectionItem>
     </apex:pageBlockSection> 
    </apex:pageBlock>
  
<!-- Here are the 6 fields that are generated by the lookup field -->
  <input type="text" id="AccountID_lkid" name="j_id0:form1:j_id2:j_id5:j_id6:AccountID_lkid"  />
  <input type="text" id="AccountID_lkold" name="j_id0:form1:j_id2:j_id5:j_id6:AccountID_lkold"  />
  <input type="text"  name="j_id0:form1:j_id2:j_id5:j_id6:AccountID_lspf" value="0"  />
  <input type="text"  name="j_id0:form1:j_id2:j_id5:j_id6:AccountID_mod" value="0"  />
  <input type="text"  name="j_id0:form1:j_id2:j_id5:j_id6:AccountID_lktp" value="001"  />
  <input type="text" id="AccountID" name="j_id0:form1:j_id2:j_id5:j_id6:AccountID"  />
  
<!-- Here is the code to pull the Account ID and Name out of the url. This definitely works -->
<script type="text/javascript">

   var regexS = "[\\—&]CF00NS0000000M2Je_lkid=([^&#]*)";
   var regex = new RegExp( regexS );
   var results = regex.exec( window.location.href );
   document.getElementById('AccountID_lkid').value = results[1];
 
 var regexS2 = "[\\–&]CF00NS0000000M2Je=([^&#]*)";
   var regex2 = new RegExp( regexS2 );
   var results2 = regex2.exec( window.location.href );
   document.getElementById('AccountID').value = results2[1];
   document.getElementById('AccountID_lkold').value = results2[1];
  </script>
  </apex:form>
</apex:page>

 
Now I realize I can override the Standard controller and just grab the ID out of the request and it would work just fine, but I really want to understand why this does not work with just the standard controller. This is a pretty big loss of functionality when the page used to pre-populate with the Account ID and then when you write a Visualforce page it no longer does.

Thanks,
Sara
  • October 13, 2008
  • Like
  • 0
Hey everyone,
I just wrote my first apex script today, all it does is autofill some boxes based on information it can pull based on the case number. I am extremely confused, and to be honest, quite angry with this whole testing, code coverage thing. It doesn't make any sense to me at all, I don't need freaking big brother forcing me to error check my code, I'd rather deal with errors than have to put up with this crap. Anyway, I am wondering how I would write the required code to make this test and be able to be deployed.

public class AutoFillPete
{
public static void PETEFILL(PETE_Items__c[] pete)
{
for (PETE_Items__c p:pete)
{
CASE[] contactResult = [SELECT ContactId,AccountId FROM CASE WHERE id = :p.Case__c];
ACCOUNT[] accountResult = [SELECT CID__c FROM ACCOUNT WHERE id = :contactResult[0].AccountId];

if(contactResult.size() > 0)
{
p.Contact__c = contactResult[0].ContactId;
p.Account__c = contactResult[0].AccountId;
p.CID__c = accountResult[0].CID__c;
}
}
}
}

Can someone help me write the code that will be needed to make this deployable (I am still working on sifting through the 14 different guides that are needed to deploy an app to production, I have no idea what I'm doing on that either, something about ant, and such).