• PSteves91
  • NEWBIE
  • 30 Points
  • Member since 2009

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

Hello

 

I'm having an issue rerendering a pageblocktable after a record is inserted via a simple modal javascript/visualforce form. The strange thing is that I can see that the method that populates the table is called after the insert (I've checked the debug log) and that the number of rows returned is 1 more than before the insert. If I refresh the page it displays the record. The code follows:

 

VisualForce

 

<apex:page controller="RecipeController"> <!-- Javascript removed to ease readability --> <!-- datatable with list --> <apex:sectionHeader title="Recipes"/> <apex:form > <apex:actionStatus id="status" startText="Updating..."></apex:actionStatus> <apex:pageBlock title="Current Recipes" id="recipeList"> <apex:pageblocktable value="{!recipes}" var="recipe"> <apex:column > <apex:facet name="header">Name</apex:facet> <apex:outputfield value="{!recipe.name}"/> </apex:column> <apex:column > <apex:facet name="header">Short Description</apex:facet> <apex:outputfield value="{!recipe.ShortDescription__c}"/> </apex:column> <apex:column > <apex:facet name="header">Rating</apex:facet> <apex:outputfield value="{!recipe.Rating__c}"/> </apex:column> </apex:pageblocktable> <apex:pageblockbuttons location="top"> <apex:commandButton value="New" onComplete="YAHOO.recYippee.showMe();" rerender="recipeEdit"/ > <apex:commandbutton value="Refresh" status="status"/> </apex:pageblockbuttons> </apex:pageBlock> </apex:form> <!-- Modal window opened by javascript --> <div id="EditNew" style="display: none" > <div class="hd"> <apex:outputText value="Recipe Details" /> </div> <div class="bd"> <apex:actionregion > <apex:form id="RecipeEdit"> <apex:pageBlock title="List of stored recipes"> <apex:pageblocksection > <apex:inputField value="{!r.name}"/> <apex:inputField value="{!r.ShortDescription__c}" /> <apex:inputField value="{!r.Ingredients__c}" /> <apex:inputField value="{!r.CookingInstructions__c}" /> <apex:inputField value="{!r.CostPerPerson__c}" /> </apex:pageblocksection> <apex:pageblockButtons location="bottom"> <apex:commandButton value="Save" action="{!saveRecipe}"/> <apex:commandButton value="Cancel" immediate="true" oncomplete="YAHOO.recYippee.hideMe();" /> </apex:pageblockButtons> </apex:pageBlock> </apex:form> </apex:actionregion> </div> <div class="ft" style="font-size: 10px;"> <apex:outputPanel layout="block"> Please click the 'Save' button to store the recipe or cancel to return to the previous page. </apex:outputPanel> </div> </div> </apex:page>

 

 Apex Code

 

public class RecipeController{ private Recipe__c recipe = new Recipe__c(); private List<Recipe__c> recipes = new List<Recipe__c>(); public Recipe__c r{get{return recipe;}set{recipe=value;}} public RecipeController(){} public List<Recipe__c> getRecipes(){ recipes = [SELECT name, shortDescription__c, rating__c, costPerPerson__c, cookingInstructions__c, ingredients__c FROM recipe__c]; return recipes; } public void setRecipes(){} public PageReference SaveRecipe(){ upsert r; return null; } }

 

The javascript is not the issue, as I've used it in other places and it works fine. Any ideas?

 

 

 

Hello All,

 

I realize that this is a silly question, but when I try to update my Force IDE in Eclipse 3.4, using software updates, it states that no updates are available.

 

So I downloaded Eclipse 3.5 Galileo and tried installing the Force.com plugin, but the version number shows:  Force.com IDE    16.0.0.200906151227.

 

Is this the correct version for the Spring 10 release? I was under the impression that we should be using 18.x?

 

Thanks...

Hello,

 

Does anyone know how to display error messages to a custom Visualforce page?

Code:

VF:

<apex:page standardController="Opportunity" id="OppItem" extensions="AddNewProducts">
    <apex:form >
        <h1>Opportunity Product Management</h1><br/><hr/><br/><apex:messages /><br/>
        <apex:panelgrid width="100%" columns="2">
            <apex:pageBlock title="Product Search" >
                <apex:pageBlockButtons location="bottom">
                    <apex:commandButton action="{!goToProducts}" value="Normal Product Load"/>
                </apex:pageBlockButtons>
                <apex:pageblockSection title="Opportuntiy Information" columns="1" collapsible="false">
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Opportunity Name: "></apex:outputLabel>
                        <apex:outputText value="{!oppName}"></apex:outputText>
                    </apex:pageblocksectionItem>
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Close Date: "></apex:outputLabel>
                        <apex:outputText value="{!oppCloseDate}"></apex:outputText>
                    </apex:pageblocksectionItem> 
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Contract Renewal Date: "></apex:outputLabel>
                        <apex:outputText value="{!oppRenewDate}"></apex:outputText>
                    </apex:pageblocksectionItem>                 
                </apex:pageblockSection>
                <apex:pageBlockSection title="Use 'TAB' key to search for products." columns="1" collapsible="false">
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Product Style#: " tabindex="0"></apex:outputLabel>
                        <apex:inputText id="pstyle" value="{!prodStyleNum}">
                            <apex:actionSupport event="onchange" action="{!productSearch}" reRender="out"/>
                        </apex:inputText>
                    </apex:pageblocksectionItem>
                </apex:pageBlockSection>
            </apex:pageBlock>
            <apex:pageBlock title="Line Item Load" mode="edit">
                <apex:outputPanel id="out">
                   <apex:actionstatus id="status" startText="Fetching data...">
                       <apex:facet name="stop"> 
                               <apex:panelgrid columns="2">
                                   <apex:outputText value="{!actMsg}" /><br/><br/>
                                   <apex:outputLabel value="Quantity: " />
                                   <apex:inputText id="quant" value="{!quantified}" tabindex="1"/>
                                   <apex:outputLabel value="End User Price: "/>
                                   <apex:inputText id="up" value="{!userPrice}" tabindex="2"/>
                                   <apex:outputLabel value="Dealer Price: "/>
                                   <apex:outputText id="dp" value="{!dipper}"/>
                                   <apex:outputLabel value="Date: "/>
                                   <apex:inputText id="sd" value="{!serviceD}" tabindex="3"/>
                                   <apex:outputLabel value="Award Probability: "/>
                                   <apex:inputText id="awardprob" value="{!Award}" tabindex="4">
                                       <apex:actionSupport event="onchange" action="{!save}" focus="pstyle" reRender="OppItem"/>
                                   </apex:inputText>
                               </apex:panelgrid>
                       </apex:facet>
                   </apex:actionstatus>
               </apex:outputPanel>                 
            </apex:pageBlock>
        </apex:panelgrid>
    </apex:form>
    <apex:pageBlock title="Related Opportunity Line Items">
        <apex:pageBlockSection title="Results">
            <apex:outputPanel id="oppStatus">
                <apex:actionstatus id="oliStatus" startText="Fetching records...">
                    <apex:facet name="stop">
                        <apex:pageblockTable value="{!oppLI}" var="oppLineItems" align="center">
                            <apex:column value="{!oppLineItems.PricebookEntry.Name}"/>
                            <apex:column value="{!oppLineItems.Quantity}"/>
                            <apex:column value="{!oppLineItems.UnitPrice}"/>
                            <apex:column value="{!oppLineItems.ServiceDate}"/>
                            <apex:column value="{!oppLineItems.Award_Probability__c}"/>
                        </apex:pageblockTable>
                   </apex:facet>
               </apex:actionstatus>
            </apex:outputPanel>
        </apex:pageBlockSection>  
    </apex:pageBlock>
</apex:page>

 

 

I see that the System Log window has changed.  I'm trying to run some ad-hoc apex and get my System.debug prints to show up.  No matter what I put for the Filter options, I don't see the output off my System.debug calls.

 

Any ideas?

 

An error is being thrown when page throws a FileSave dialog.

I've created a VF page using this markup:
{!ExportXML}


The error shown on file save dialog is this:
"unable to download from na6.visual.force.com"

Please Note that the File is downloaded fine in Firefox, it throws error in IE only. Can anyone tell me why so it is happening in IE only?
  • February 16, 2010
  • Like
  • 0

I'm 99% to a page with a decent layout for internal users.  This is probably trivial, but for whatever reason, I can't find it.  We only have one community, and it seems really stupid to force people to choose the community when they are creating an idea.

 

How do I 'hard code' the communityid in the VF page.

 

Here is my code that works, if I search and then select, my one community:

 

<apex:page standardController="idea">

<apex:form >

<apex:pageBlock title="New Idea">

<apex:pageBlockButtons >

<apex:commandButton action="{!save}" value="Save"/>

</apex:pageBlockButtons>

<apex:pageBlockSection title="Idea Details" columns="1">

<apex:inputField style="width:250px" value="{!idea.title}"/>

<apex:inputField required="true" value="{!idea.CommunityId}"/>

<apex:inputField required="true" value="{!idea.category}"/>

<apex:inputField required="true" value="{!idea.Requested_Priority__c}"/> <apex:inputField required="true" style="width:600px" value="{!idea.Business_Case__c}"/>

<apex:inputField required="true" style="width:600px" value="{!idea.body}"/>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 I've tried various tags, but there should be some way to just say that {!idea.communityid} = <id>

 

Also, I hope the answer isn't that I have to write a controller extension JUST to hard code this value... 

Message Edited by BarryPlum on 12-22-2009 09:37 AM
Is there any API support available to access fiscal years (Setup->Company Profile->Fiscal Year). Can i access and do CRUD operations on Fiscal Year from apex code?

For any of you who have experienced an error "org.eclipse.wst.sse.ui.StructuredTextEditor.isBlockSelectionModeEnabled()Z" upon opening the

Editor in Eclipse version 3.4 when trying to access your Force.com Project here is the fix.

 

1. Help -> Software Updates 
2. Click on "Revert Configuration 
3. My current (broken) configuration had "Eclipse XML editors and 
tools" version 3.1 
4. Find the configuration that has Eclipse XML editors..." version 
3.0.4.<date><key> 
5. select that configuration and click "Finish" 
6. The workbench will restart 

 

The "XML Editors" version that works for me is 
3.0.4v200811211541<key> .

It got broken when I updated to 

3.1.0,v200905240756<key>.  

 

Hope that helps someone

Hello Friends,

 

My requirement is that, i need to generate an XML out of my VF page. For this, i specified the "ContentType="application/xml" on my page header and then included the DOCTYPE tags to generate a standard XML out of it.

 

But somehow, i am not able to get the XML styling in the generated page and it shows me the shole page elements intead of just showing me the data.

 

Can you please let me know where i am going wrong or is this possible in VF? Pasting my VF page code below:

 

 

<apex:page cache="true" Controller="TestController" contentType="application/xml" showHeader="false">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/html" xml:lang="en" lang="en">
<body>
<apex:form >
<apex:pageblock id="exportDocs">
<apex:pageBlockTable value="{!exportValues}" var="actual">
<apex:column headerValue="Id" value="{!actual.Id}"/>
<apex:column headerValue="Act Name" value="{!actual.Name}"/>
<apex:column headerValue="MType" value="{!actual.A_Type__c}"/>
<apex:column headerValue="Country" value="{!actual.Country__c}"/>
<apex:column headerValue="B" value="{!actual.B__c}"/>
<apex:column headerValue="Actual C" value="{!actual.C__c}"/>
<apex:column headerValue="Actual G" value="{!actual.G__c}"/>
<apex:column headerValue="Actual I" value="{!actual.I__c}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</body>
</html>
</apex:page>

 

Any help/guidance would be highly appreciated!!

 

Many Thanks,

Cool_D

Hello,

 

Does anyone know how to display error messages to a custom Visualforce page?

Code:

VF:

<apex:page standardController="Opportunity" id="OppItem" extensions="AddNewProducts">
    <apex:form >
        <h1>Opportunity Product Management</h1><br/><hr/><br/><apex:messages /><br/>
        <apex:panelgrid width="100%" columns="2">
            <apex:pageBlock title="Product Search" >
                <apex:pageBlockButtons location="bottom">
                    <apex:commandButton action="{!goToProducts}" value="Normal Product Load"/>
                </apex:pageBlockButtons>
                <apex:pageblockSection title="Opportuntiy Information" columns="1" collapsible="false">
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Opportunity Name: "></apex:outputLabel>
                        <apex:outputText value="{!oppName}"></apex:outputText>
                    </apex:pageblocksectionItem>
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Close Date: "></apex:outputLabel>
                        <apex:outputText value="{!oppCloseDate}"></apex:outputText>
                    </apex:pageblocksectionItem> 
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Contract Renewal Date: "></apex:outputLabel>
                        <apex:outputText value="{!oppRenewDate}"></apex:outputText>
                    </apex:pageblocksectionItem>                 
                </apex:pageblockSection>
                <apex:pageBlockSection title="Use 'TAB' key to search for products." columns="1" collapsible="false">
                    <apex:pageblocksectionItem >
                        <apex:outputLabel value="Product Style#: " tabindex="0"></apex:outputLabel>
                        <apex:inputText id="pstyle" value="{!prodStyleNum}">
                            <apex:actionSupport event="onchange" action="{!productSearch}" reRender="out"/>
                        </apex:inputText>
                    </apex:pageblocksectionItem>
                </apex:pageBlockSection>
            </apex:pageBlock>
            <apex:pageBlock title="Line Item Load" mode="edit">
                <apex:outputPanel id="out">
                   <apex:actionstatus id="status" startText="Fetching data...">
                       <apex:facet name="stop"> 
                               <apex:panelgrid columns="2">
                                   <apex:outputText value="{!actMsg}" /><br/><br/>
                                   <apex:outputLabel value="Quantity: " />
                                   <apex:inputText id="quant" value="{!quantified}" tabindex="1"/>
                                   <apex:outputLabel value="End User Price: "/>
                                   <apex:inputText id="up" value="{!userPrice}" tabindex="2"/>
                                   <apex:outputLabel value="Dealer Price: "/>
                                   <apex:outputText id="dp" value="{!dipper}"/>
                                   <apex:outputLabel value="Date: "/>
                                   <apex:inputText id="sd" value="{!serviceD}" tabindex="3"/>
                                   <apex:outputLabel value="Award Probability: "/>
                                   <apex:inputText id="awardprob" value="{!Award}" tabindex="4">
                                       <apex:actionSupport event="onchange" action="{!save}" focus="pstyle" reRender="OppItem"/>
                                   </apex:inputText>
                               </apex:panelgrid>
                       </apex:facet>
                   </apex:actionstatus>
               </apex:outputPanel>                 
            </apex:pageBlock>
        </apex:panelgrid>
    </apex:form>
    <apex:pageBlock title="Related Opportunity Line Items">
        <apex:pageBlockSection title="Results">
            <apex:outputPanel id="oppStatus">
                <apex:actionstatus id="oliStatus" startText="Fetching records...">
                    <apex:facet name="stop">
                        <apex:pageblockTable value="{!oppLI}" var="oppLineItems" align="center">
                            <apex:column value="{!oppLineItems.PricebookEntry.Name}"/>
                            <apex:column value="{!oppLineItems.Quantity}"/>
                            <apex:column value="{!oppLineItems.UnitPrice}"/>
                            <apex:column value="{!oppLineItems.ServiceDate}"/>
                            <apex:column value="{!oppLineItems.Award_Probability__c}"/>
                        </apex:pageblockTable>
                   </apex:facet>
               </apex:actionstatus>
            </apex:outputPanel>
        </apex:pageBlockSection>  
    </apex:pageBlock>
</apex:page>

 

 

Hi - we currently do not like the fact we have to click through several screens just to add a product.  Therefore, what we have done is create a custom button that goes to a custom object, and the custom object does an insert into the real oppLineItem in the background.  However, the way we tie this custom opp line item back to the opportunity is by passing the opportunity name to the custom opp line item via the URLFOR function.  Unfortunately, it doesn't seem like you can use the opportunityId as one of the params for this function.  This causes a problem when there are two opps with the same name, or similar names (i.e., opp 01 vs. opp 011)

 

Has anyone overridden the adding of opp products in their org?  Any pointers on how it was done?

I created a send email class that accepts a bunch of parameters. It's currently used by two visualforce pages and 1 trigger/class.

 

The trigger/class setup is currently failing when I deploy to production. However, when I run the tests in the sandbox it comes back completely fine. The trigger is fired on an update of a case. When I update the case to fire the trigger - I get the expected result (an email).

 

I am creating my objects in the test class - except my Email Template and SF user (which are in both sandbox and production). All other objects - Account, Contact, and Case are created in the test class directly.

 

I added a system.debug('THIS IS THE MAIL:" + mail); to my send email class and this is what I see in the debug log when I deploy.

 

20090417151127.818:Class.Send_Single_Email_Class.SendEmail: line 111, column 9: THIS IS THE MAIL:Messaging.SingleEmailMessage[getBccAddresses=();getCcAddresses=();getCharset=null;getDocumentAttachments=null;getFileAttachments=null;getHtmlBody=null;getPlainTextBody=null;getTargetObjectId=005700000017EbwAAE;getTemplateId=00X70000001F7ESEA0;getToAddresses=(support@pharmacyonesource.com);getWhatId=50070000008R2QFAA0;isUserMail=false;] System.EmailException: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: Argument Error: Parameter value is null

 

 

You can see it stats Unknown_Exception - then tells me a parmaeters is null. I've compared these lines to a successful test that's run (using the same class but on different objects) - and with the exception of the TemplateID (not used) and the specific Email Address/WhatID it looks 100% the same.

 

I thought it might be my template problem - but I'm setting it like this

***Trigger's Class*** EmailTemplate ThisTemplate = [Select e.Id From EmailTemplate e where e.developerName= 'Case_Notification_of_New_Task_or_Comment']; ID TemplateID = ThisTemplate.Id; ***Send Email Class*** mail.setTemplateId(TemplateID); system.debug('Template is Valid: ' + TemplateID);

 

I'm really scratching my head on this one. I figured I must be missing something when I pass things over. But the SendEmail class works with my visualforce pages - just not this Trigger/Class. The main difference is I'm using a template ID and not setting the mail.setToAddresses to anything other than null.

 

Current UnitTest - The Trigger loops through trigger.new and assigns to variables the items passed over to each send email.

 

static testMethod void testTriggerCase_Interface_Before_Insert_Before_Update() 
{
	RecordType CaseRecordType = [Select r.SobjectType, r.Id, r.DeveloperName From RecordType r where r.DeveloperName='Standard' and sObjectType = 'Case'];
	User CSRQueue = [Select u.Username, u.UserRoleId, u.ProfileId, u.ManagerId, u.LastName, u.IsActive, u.Id, u.FirstName, u.Name,u.Email, u.CommunityNickname, u.Alias From User u where u.Id = '005700000017Ebw' and u.IsActive = True limit 1];
			
		Account NewAccount1 = new Account(name='Test Code Account',
			Hospital_Bed_Size__c = -1,
			BillingStreet = '7780 Elmwood Ave',
			BillingCity = 'Middleton', 
			BillingState = 'WI', 
			BillingPostalCode = '5356'
	   	);
	        insert NewAccount1;
		Contact NewContact = new Contact(
	   		LastName='Test',
	   		firstname='Contact',
	   		Email=CSRQueue.Email,
	   		AccountId = NewAccount1.id
	   	);	
	   	insert NewContact;	    
		Implementation__c NewS7IF = new Implementation__c 
	   	(
	   		RecordTypeId = '012500000009EQZ',
	   		Name = 'Test Code Implementation',
	   		Account__c = NewAccount1.id,
	   		//i.Product__c = 'Unit Stock',
	   		Sale_Date__c = date.Today(),
	   		Implementer__c = '005700000017Ebw', //CSR Queue   			
	   		Action_Requirement__c = 'POS',
	   		Stage__c = 'Initiation',
	   		Status__c = 'Moving Along',
	   		Status_Reason__c = 'N/A',
	   		Product__c = 'Sentri7 Interfaces',
	   		Interface_Products__c = 'Quantifi',
	   		Feed_Status__c = 'No Data Received Yet'
	   	);	
	   	insert NewS7IF;	   	
		Case NewStandardCase = new Case
		(
		  OwnerId = '005700000017Ebw', //CSR Queue 
		  //Implementation_Issue__c = ImpIssueTestUnit().id, //Issue to be used 
		  Type = 'Interfaces', 
		  Project_Type__c = 'Hold',
		  Implementation__c = NewS7IF.Id,
		  Products__c = 'Interfaces',		  
		  ContactId = NewContact.Id,
		  Origin = 'Internal',
		  Subject = 'This is a test subject used to test trigger',
		  RecordTypeId = CaseRecordType.Id		
		);
		Case NewStandardCase2 = new Case
		(
		  OwnerId = CSRQueue.ID, //'005700000017Ebw', //CSR Queue 
		  //Implementation_Issue__c = ImpIssueTestUnit().id, //Issue to be used 
		  Type = 'Interfaces', 
		  Project_Type__c = 'Hold',
		  Implementation__c = NewS7IF.Id,
		  Products__c = 'Interfaces',		  
		  ContactId = NewContact.Id, 
		  Origin = 'Internal',
		  Subject = 'This is a test subject used to test trigger2',
		  RecordTypeId = CaseRecordType.Id		
		);
		list<case> InsertCases = new list<case>();
		
		InsertCases.add(NewStandardCase);
		InsertCases.add(NewStandardCase2);			
		insert InsertCases;
		
        NewStandardCase.Notification_to_Owner__c = 1;
        NewStandardCase2.Notification_to_Owner__c = 0;
        list<case> UpdateCases = new list<case>();
        UpdateCases.add(NewStandardCase);
        UpdateCases.add(NewStandardCase2);        
        update UpdateCases;	
				
	} 

 

The Class that calls the SendEmail Class - this is done on a before update. Trigger is fired before update of case, and only cases with Notification_To_Owner__c set to 1 are sent to the NotificationToOwner class method below. The class loops through the list pulling the information and sending the e-mail and also returns the value to Notification_To_Owner__c to 0.

There's a lot of "empty" variables here since they get passed in other classes that use the SendEmail class. When I tested it doesn't appear that anything goes wrong if these are null as long as the required items are also present. (Example either a TemplateID or a HTMl/Plain body)

 

public static void NotificationToOwner(list<case> TheseCases) { set<id> OwnerID = new set<id>(); for(case c: TheseCases) { OwnerID.add(c.OwnerID); } map<id, User> MapUsers = new map<id,user>([Select u.Title, u.ManagerId, u.Id, u.Email From User u where u.id in :OwnerID]); /*Required SendEmail Variables */ list<string> ToEmail = new list<string>(); Contact eContact; list<string> CC = new list<string>(); list<string> BCC = new list<string>(); Boolean eAttach = False; Blob eAttachment; string eName; Boolean Activity = False; ID WhatID; Boolean Attach = False; String aName; String eSubject; String eBody; list<ID> DocAttach = new list<ID>(); EmailTemplate ThisTemplate = [Select e.Id From EmailTemplate e where e.developerName= 'Case_Notification_of_New_Task_or_Comment']; /*This template is present in both Sandbox and Production with the SAME developername */ ID TemplateID = ThisTemplate.Id; ID TargetObjectId; //list<case> UpdateCases = new list<case>(); /*Loop through cases and send Email */ for(case c: thesecases) { ToEmail.Clear(); //ToEmail.add(MapUsers.get(c.OwnerID).Email); WhatID = c.id; TargetObjectID = c.OwnerID; c.Notification_to_Owner__c=0; system.debug('Case Number, Case ID: ' + c.CaseNumber +' ID: '+ c.ID); system.debug('Email Variable OwnerID: ' + c.OwnerID); system.debug('Email Variable Email: ' + ToEmail); system.debug('Email Variable Case WhatID: ' + WhatID); Send_Single_Email_Class.SendEmail(ToEmail,eContact, CC,BCC, eAttach, eAttachment,eName, Activity,WhatId,Attach, aName,eSubject,eBody,DocAttach,TemplateID,TargetObjectID); } }

 

Hello

 

I'm having an issue rerendering a pageblocktable after a record is inserted via a simple modal javascript/visualforce form. The strange thing is that I can see that the method that populates the table is called after the insert (I've checked the debug log) and that the number of rows returned is 1 more than before the insert. If I refresh the page it displays the record. The code follows:

 

VisualForce

 

<apex:page controller="RecipeController"> <!-- Javascript removed to ease readability --> <!-- datatable with list --> <apex:sectionHeader title="Recipes"/> <apex:form > <apex:actionStatus id="status" startText="Updating..."></apex:actionStatus> <apex:pageBlock title="Current Recipes" id="recipeList"> <apex:pageblocktable value="{!recipes}" var="recipe"> <apex:column > <apex:facet name="header">Name</apex:facet> <apex:outputfield value="{!recipe.name}"/> </apex:column> <apex:column > <apex:facet name="header">Short Description</apex:facet> <apex:outputfield value="{!recipe.ShortDescription__c}"/> </apex:column> <apex:column > <apex:facet name="header">Rating</apex:facet> <apex:outputfield value="{!recipe.Rating__c}"/> </apex:column> </apex:pageblocktable> <apex:pageblockbuttons location="top"> <apex:commandButton value="New" onComplete="YAHOO.recYippee.showMe();" rerender="recipeEdit"/ > <apex:commandbutton value="Refresh" status="status"/> </apex:pageblockbuttons> </apex:pageBlock> </apex:form> <!-- Modal window opened by javascript --> <div id="EditNew" style="display: none" > <div class="hd"> <apex:outputText value="Recipe Details" /> </div> <div class="bd"> <apex:actionregion > <apex:form id="RecipeEdit"> <apex:pageBlock title="List of stored recipes"> <apex:pageblocksection > <apex:inputField value="{!r.name}"/> <apex:inputField value="{!r.ShortDescription__c}" /> <apex:inputField value="{!r.Ingredients__c}" /> <apex:inputField value="{!r.CookingInstructions__c}" /> <apex:inputField value="{!r.CostPerPerson__c}" /> </apex:pageblocksection> <apex:pageblockButtons location="bottom"> <apex:commandButton value="Save" action="{!saveRecipe}"/> <apex:commandButton value="Cancel" immediate="true" oncomplete="YAHOO.recYippee.hideMe();" /> </apex:pageblockButtons> </apex:pageBlock> </apex:form> </apex:actionregion> </div> <div class="ft" style="font-size: 10px;"> <apex:outputPanel layout="block"> Please click the 'Save' button to store the recipe or cancel to return to the previous page. </apex:outputPanel> </div> </div> </apex:page>

 

 Apex Code

 

public class RecipeController{ private Recipe__c recipe = new Recipe__c(); private List<Recipe__c> recipes = new List<Recipe__c>(); public Recipe__c r{get{return recipe;}set{recipe=value;}} public RecipeController(){} public List<Recipe__c> getRecipes(){ recipes = [SELECT name, shortDescription__c, rating__c, costPerPerson__c, cookingInstructions__c, ingredients__c FROM recipe__c]; return recipes; } public void setRecipes(){} public PageReference SaveRecipe(){ upsert r; return null; } }

 

The javascript is not the issue, as I've used it in other places and it works fine. Any ideas?

 

 

 

Hi fellow developers,

I'm trying to emulate the sample in the vf dev guide (Adding Custom List Buttons using Standard List Controllers), but with a twist: using a detail from a master-detail (Account = Master, detail = Flavor_Request__c).

I have both the Apex Class and controller similar to the example in the dev guide:

Code:
public class OpptyFlavorListButton
{
    public OpptyFlavorListButton(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
    }
}

<apex:page standardController="Flavor_Request__c" recordSetVar="flavors"
    tabStyle="Flavor_Request__c" extensions="OpptyFlavorListButton">
<apex:form >
    <apex:pageBlock title="Edit Status" mode="edit">
        <apex:pageMessages />
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!selected}" var="f">
            <apex:column value="{!f.name}"/>
            <apex:column value="{!f.Request_Type__c}"/>
            <apex:column value="{!f.Sample_Size__c}"/>
            <apex:column headerValue="Status">
                <apex:inputField value="{!f.Status__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

 



The buttons are added to the appropriate layouts, however, I keep getting the following errors:
1. Invalid variant 'parent': value 'Account'
2. Invalid variant 'parent': value 'Opportunity'

I get error #1 when trying this from the Account page (related list of flavors)
I get error #2 when trying this from the Opportunity page (related list of flavors)

I'm hitting these errors as the System Administrator who wrote the code...

Any feedback/suggestions would greatly be appreciated.

Thanks,
Larry


Message Edited by Legerdemain on 12-04-2008 08:38 PM

Message Edited by Legerdemain on 12-04-2008 08:39 PM
Hi all,

I found this documentation on querying multiselect fields.

When you do a query like:
Code:
MSP1__c includes ('AAA;BBB', 'CCC') 

 the query filters on values in the MSP1__c field that contains either of these values:

    * AAA and BBB selected
    * CCC selected.

So the ';' represents AND.

If we break it up:

Code:
MSP1__c includes ('AAA', 'BBB', 'CCC')

 represents AAA or BBB or CCC.

 Is there a way to query using OR instead?

I'm passing my variable, lets say CategoryOptions to a class. The code becomes

Code:
MSP1__c includes (CategoryOptions)

 The problem with this is that it will only return values that match the selected Categories exactly. I need any records that has any single 1 of the options in the multiselect field.

My idea is to just parse the variable CategoryOptions and build a query, seperating all the values with commas.

Code:
MSP1__c includes (Cat1, Cat2, Cat3, etc).

 Is that the best and/or only way to do this?