-
ChatterFeed
-
4Best Answers
-
0Likes Received
-
0Likes Given
-
19Questions
-
40Replies
Apex:toolbar Style
In other words, the default appearance is a green-to-black gradient that looks terrible on my vf page.
What are the css properties that I can change to style the toolbar?
-
- Jim Boudreaux
- November 12, 2008
- Like
- 0
- Continue reading or reply
How to write a piece of code which will run after specific Time
I need to write a piece of code which will get the List of Opportunity difrentiated by some criteria and want to email those records every weekends.
Its like Time Based coading.
I have read about time dependent Workflow triggers but it doesnt resolves my problem because it does not provide flexibility to write the Apex code.
I want to run the code once in every week.
Can anyone give some suggestions?
Thanks in Advance!
-
- Jitendra
- October 08, 2008
- Like
- 0
- Continue reading or reply
Custom Labels in a Managed Package- Namespace?
-
- jgrenfell
- November 03, 2009
- Like
- 0
- Continue reading or reply
CMSForce: contentblock not displaying in public site
I'm sure this is a permission error somewhere, but I can't seem to find it. I've installed CMSforce, followed the setup instructions and created a Page with a PageItem for the "body" contentblock in my Page Template. I am able to view the page I created in my public Site, but the contentblock on that page isn't displaying with the text from the PageItem. It displays fine in the preview, just not when viewed as a Sites page. The public access profile for that site does have Read permission on the ContentBlockItems object. Is there another permission setting that I could be missing that might cause this?
I tried giving read access to the Page and PageItem objects, but that didn't do it. I also tried enabling all of the CMSForce VF pages for that site, but also no go. What am I missing?
-
- jgrenfell
- August 19, 2009
- Like
- 0
- Continue reading or reply
Finding Association between Business Hours and Holidays
-
- jgrenfell
- July 04, 2009
- Like
- 0
- Continue reading or reply
Richtext InputTextArea: Prevent from submitting on enter
I've built a simple Visualforce page used to compose emails, using an inputTextArea with richText = true for the body of the email. The problem is, anytime you hit enter while in that inputTextArea, instead of adding a line break it submits the form (i.e. sends the email). I've tried setting the form to immediate = false, and adding an actionSupport for the onenter event with no action, but it still happens. Anyone know how to get around this? The page is below.
<apex:page standardController="Contact" extensions="extEmailPO2"> <apex:form id="editorForm"> <apex:pageBlock id="pageEmail"> <apex:pageBlockButtons > <apex:commandButton action="{!send}" value="Send" id="theButton" immediate="false"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem > To: <apex:outputText value="{!POEmail}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Subject: <apex:inputText id="subject" value="{!eSubject}" required="true" style="width: 400px"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputTextarea id="email" richtext="true" value="{!eContent}" required="true" > <apex:actionSupport event="onenter"/> </apex:inputTextarea> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
-
- jgrenfell
- May 13, 2009
- Like
- 0
- Continue reading or reply
Visualforce in Page Layout Issues
The end goal I'm trying to reach is a Visualforce page that a particular user profile is directed to everytime they click on a Contact record. This group of users should only be able to access certain Contact records, so I created an extension that checks to see if the ID passed to it should be viewable, and was hoping to just use a <apex:detail /> that display record or disable the detail page and display a message stating that the data is unavailable. I got that working in a page, the problem is that if I drop that page onto a page layout, I end up in an infinite loop- the page is calling the detail, which happens to be the page layout the Visualforce page is on, so it just keeps creating itself inside of itself.
I resigned myself to just manually generating the page field by field instead of using the detail component, but have hit another issue: I can't use the relatedList component on the page unless the related list I'm referencing is on the page layout. If I add the related lists to the page layout, then they get displayed even for Contact records that I'm trying to hide from this user.
I feel like I'm in a bit of a Catch 22. Anyone have any ideas on how I could accomplish this? I'm considering maybe just a redirect from the Contact page to a Visualforce page that does all of this, but that seems a bit clunky. Any ideas would be greatly appreciated.
-
- jgrenfell
- April 14, 2009
- Like
- 0
- Continue reading or reply
Rerender a form and required fields
I have page with a custom controller and a tab panel. In one of the tabs, I want the user to be able to flip between a view to enter a new record and a list of historical records. I'm using a boolean variable to track which form (new or historical) should be rendered and a commandlink to set that variable. Every time I click on that commandLink though, the new form remains with the "You must enter a value" error on the required fields in the form. I don't want that form saved though and can't seem to get around. I've tried filling in those fields and then hitting the commandlink, but the same thing happens. What am I missing?
Code for that tab:
<apex:tab id="tabFLSEReferral" label="FLSE Referral" rendered="{!IF(student==null, false, true)}"> <apex:form id="formFLSEReferral" rendered="{!modeNewFLSERef}"> <apex:commandLink action="{!linkFLSENewRef}" rerender="formFLSEReferral, formFLSEReferralHistory" value="{!IF(modeNewFLSERef, 'View Referral History', 'Enter New Referral')}" style="font-weight:bold;font-color:#0000ff;font-size:12" /> <apex:pageBlock id="pageFLSEReferral" rendered="{!modeNewFLSERef}"> <apex:pageblockButtons ><apex:commandButton action="{!save_flseReferral}" value="Save"/></apex:pageblockButtons> <!-- NEW / EDIT --> <apex:pageBlockSection columns="2"> <apex:pageBlockSectionItem > Referral?: <apex:inputField value="{!flseRef.Referralcheckbox__c}" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Referred By: <apex:inputField value="{!flseRef.Referred_By__c}" required="true" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Referral Date: <apex:inputField value="{!flseRef.Referral_Date__c}" required="true" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- HISTORICAL RECORDS --> <apex:form id="formFLSEReferralHistory" rendered="{!Not(modeNewFLSERef)}"> <apex:pageBlock id="pageFLSEReferralHistory" rendered="{!Not(modeNewFLSERef)}"> <apex:pageblockSection columns="1"> <apex:pageBlockSectionItem > <apex:pageBlockTable value="{!flseReferrals}" var="flseRef"> <apex:column headervalue="Action" > <apex:commandLink action="{!linkflseEditRef}" rerender="formFLSEReferral, formFLSEReferralHistory" value="edit"> <apex:param name="selectedId" value="{!flseRef.id}"/> </apex:commandLink> </apex:column> <apex:column headervalue="Profile" value="{!flseRef.Profile_Status_FLSE_notes__c}"/> <apex:column headervalue="Component" value="{!flseRef.Profile_FLSE_Component__c}"/> <apex:column headervalue="Created Date" value="{!flseRef.CreatedDate}"/> </apex:pageBlockTable> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:tab>
Code for that commandLink (I added the clear method to try to avoid this, but to no avail):
public PageReference linkFLSENewRef() { this.modeNewFLSERef = (modeNewFLSERef ? false : true); if (!this.modeNewFLSERef){ this.flseRef.clear(); } return null; }
-
- jgrenfell
- April 02, 2009
- Like
- 0
- Continue reading or reply
Switch (case) syntax available?
I was at a Developers User Group meeting in NYC the other night and swore that I saw switch being used in an example by Ron Hess. I don't see documentation for it though and can't get it to compile right when I try it (see example below, I get an error on the very first line). So either my syntax is off OR Ron was in a beta development environment not available to the rest of us OR I'm seeing code that doesn't exist. Any ideas anyone, Ron?
switch (strType){ case 'Counseling/Referral Case': System.debug('I would like this to work'); }
-
- jgrenfell
- March 26, 2009
- Like
- 0
- Continue reading or reply
Populating merge fields from the EmailTemplate object
So I'll preface this by saying that I realize that what I'm trying to do is twist existing functionality for my own purpose and there may not be a way to do this. But hope springs eternal, so...
What I want to do is create a Visualforce page that pulls an email template from the EmailTemplate object and populates any merge fields in the body of that template. The reason I need this is because I need to send an email about a Contact record to someone other than that contact, namely a Parole Officer. So I have a Contact record with a PO field that is a lookup to the Contact table, and the email will be sent to the email address of that PO. I put together a page to do this, but when I output the email template body to an inputTextArea, all of the merge fields are written out explicitly (i.e. {!Contact.FirstName} {!Contact.LastName}, NYSID #{!Contact.NYSID__c}).
Does anyone have any ideas on how I might be able to accomplish this? If I can't find a solution, I'll just create Visualforce email templates, but since there are a lot of templates required and they change frequently, it would be nice to let certain end users create them as Email Templates instead of having to code it in Visualforce myself.
-
- jgrenfell
- March 25, 2009
- Like
- 0
- Continue reading or reply
Test Method SoQL limit using cumulative count instead of per DML operation
I have a number of classes and triggers with test methods that have all been functioning correctly for months. There were certain (rare) cases where the SoQL Query limit was being hit, so to avoid this, I annotated one method as @future. I then run the tests, and even though it's the exact same code as before just plus the @future, it's now returning "Too many SoQL queries" as an error. In going through the debug logs, no single DML operation uses more than 20 queries (not even close), but cumulatively the inserts in the test method are hitting 21. The cumulative limit for SoQL queries is supposed to be 100, not 20?
I can't possibly post all of the code behind this, but this is the test method itself. The only thing that's changed from when it was working is that one of the methods called as a result is now @future and adding the startTest / stopTest - could that have an impact? It hits the SoQL limit error on the last Event insert. Anyone have any ideas?
static testMethod void testAdjournedCourtDateCheck() { Test.startTest(); Event event1; // Find the ID of the CEP Account Account CEP = [SELECT ID FROM Account WHERE Account.Name = 'CEP' and Account.RecordType.Name = 'CASES Programs']; // Create some sample dates for insert commands Date birthDate1 = Date.newInstance(1976,11,20); Date activityDate = Date.newInstance(2006,11,20); Datetime activityDatetime = Datetime.newInstance(2006,11,20); Date activityDate2 = Date.newInstance(2006,11,21); Datetime activityDatetime2 = Datetime.newInstance(2006,11,21); Date referDate1 = Date.newInstance(2006,11,20); Date intakeDate1 = Date.newInstance(2006,11,21); // Set the RecordTypes Id eventType = '012600000004yjw'; Id contactType = '012600000004zC5'; Id intakeType = '012600000004z70'; //Create a Test Client Contact testContact = new Contact(FirstName = 'Unit', LastName = 'Tester', AccountId = CEP.Id, Gender__c = 'Male', Birthdate = birthDate1, RecordTypeID = contactType); insert testContact; //Insert an Intake case for the client Case_Information__c cinfos_intake = new Case_Information__c(Client__c = testContact.Id, Name = 'test777777', Borough__c = 'X - Bronx', Referred_On__c = referDate1, Intake_Date__c = intakeDate1, RecordTypeID = intakeType); insert cinfos_intake; //Insert an adjourned Court Date Appointment Boolean IsError1 = false; try{ event1 = new Event( Outcome__c = 'Adjourned', Subject = 'Court Date', ActivityDate = activityDate, ActivityDateTime = activityDatetime, RecordTypeID = eventType, DurationInMinutes = 60, WhatId = cinfos_intake.Id ); insert event1; } catch(Exception e) { IsError1 = true; System.debug('The error is: ' +e); } //Insert another Court Date Appointment Boolean IsError2 = false; try{ event1 = new Event( Outcome__c = 'Pending', Subject = 'Court Date', ActivityDate = activityDate2, ActivityDateTime = activityDatetime2, RecordTypeID = eventType, DurationInMinutes = 60, WhatId = cinfos_intake.Id ); insert event1; } catch(Exception e) { IsError2 = true; } Test.stopTest(); //First event insert should go in System.assertEquals(false, IsError1); //Make sure Disposition Date being updated cinfos_intake = [Select Id, Court_Dates_After_Adjourned_Outcome__c from Case_Information__c where Id = :cinfos_intake.Id]; System.assertEquals(true, cinfos_intake.Court_Dates_After_Adjourned_Outcome__c); }//end testAdjournedCourtDateCheck
-
- jgrenfell
- March 01, 2009
- Like
- 0
- Continue reading or reply
Using FolderId in the Where clause of an EmailTemplate Query
I'm creating a page that includes a list of Folders for email templates, and when the user selects a folder, I want to display the EmailTemplates in that folder. I'm getting an error on the SoQL to do that though- "unexpected token : FolderId". The same query works fine in the Schema Explorer in Eclipse.
List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId := this.eFolder];
Anyone have any ideas?
-
- jgrenfell
- February 26, 2009
- Like
- 0
- Continue reading or reply
S-Control and Permission to run a SoQL Query
With some alert calls in the s-control, I was able to pinpoint that the javascript just stops when it tries to perform the SoQL query. The user profile for this user has rights to the object being queried, has the API enabled and I tried adding a couple rights to the profile- View All Data and View Configuration, but to no end. Is there a setting, in the profile or elsewhere, that would prevent a user from being able to run a SoQL query in an S-Control?
I have similar s-controls in different salesforce instances and have never hit this before, very frustrating!
-
- jgrenfell
- October 08, 2008
- Like
- 0
- Continue reading or reply
Can't get retURL on Save to work
Example of new record url (does not work as expected):
https://cs2.salesforce.com/006/e?retURL=%2F006%2Fo
Example of edit record url (works as expected):
https://cs2.salesforce.com/006R00000029eY4/e?retURL=%2F006%2Fo
Am I missing something? Is there really no way to redirect a user when saving a new record?
-
- jgrenfell
- August 03, 2008
- Like
- 0
- Continue reading or reply
Unable to import into a junction object?
-
- jgrenfell
- July 06, 2008
- Like
- 0
- Continue reading or reply
Flex DataGrid Issue Displaying fields from a related object
<mx:DataGrid id="dg_sites" width="475" height="300" editable="false"> <mx:columns> <mx:DataGridColumn headerText="Id" dataField="Id" visible="false"/> <mx:DataGridColumn headerText="Borough" dataField="Site__r.Borough__c"/> <mx:DataGridColumn headerText="Name" width="200" dataField="Name"/> <mx:DataGridColumn headerText="Available Slots" width="90" dataField="Available_Slots__c"/> <mx:DataGridColumn headerText="Business Group" dataField="Business_Group_Site__c" visible="false"/> </mx:columns> </mx:DataGrid>
And a SoQL query that I use to populate it:
Select Start__c, Shift__c, Name, Id, End__c, Business_Group_Site__c, Available_Slots__c, Site__r.Borough__c From Site_Log__c WHERE Start__c > TODAY AND Shift__c = 'Day'
All of the columns populate correctly except the Site__r.Borough. I've tried changing the dataField to just "Borough__c", but it still ends up blank. The SoQL definitely returns values for that field. Has anyone tried this, any ideas?
-
- jgrenfell
- June 02, 2008
- Like
- 0
- Continue reading or reply
Salesforce Developer Position - NYC - Non-Profit
Position Title: Web Developer
FLSA Status: Non Exempt
Salary Range: 50Ks, Depending on experience
Reporting Relationship: Database/CRM Manager
Position Summary:
- The Center for Employment Opportunities, a multi-funded non-profit employment and training program for formerly incarcerated men and women, is seeking a developer with experience developing web-based / object-oriented software applications. This is a temp-to-perm position.
Skills and Responsibilities:
The essential functions include, but are not limited to, the following:
- Customizing and administering Salesforce, a hosted web CRM (prior experience with Salesforce is a plus, but not required).
- Expert skills in PHP, Javascript and SQL to create advanced customizations for Salesforce.
- Experience creating views, stored procedures and scheduled jobs to transfer data between Salesforce and a local MS SQL Server database.
- Background in report design to create reports using Crystal Reports.
- Strong object-oriented programming, database design and development skills will ensure your success in this position.
- Attending appropriate job skills training seminars and classes
Other Duties:
· Performs other job-related duties and responsibilities as may be assigned from time to time.
Minimum Qualifications:
- Bachelor’s Degree in Computer Science or a related field is preferred
- 3 years object-oriented web development
- Strong experience working with enterprise databases, preferably SQL Server.
- Excellent oral and written communication skills for effective communication with project team members.
- Knowledge of and competence with core technologies related to the Web.
- Ability to learn new technologies related to the Web.
- Ability to complete multiple tasks and projects within deadlines.
To apply, please send a cover letter and resume with the subject heading ‘Web Developer’ to: tebowen2525@yahoo.com
-
- jgrenfell
- February 11, 2008
- Like
- 0
- Continue reading or reply
Unable to do Switch (case) statement
Code:
switch (ce_days) { case 180: milestone = 180; }//end switch
-
- jgrenfell
- November 08, 2007
- Like
- 0
- Continue reading or reply
Excluding trigger updates/inserts from validation rules
-
- jgrenfell
- October 26, 2007
- Like
- 0
- Continue reading or reply
Iterating through a Map, Value Order
My code, for reference:
Code:
//Get map of statuses for participants Map<Id, Status_Milestone__c> statMap = new Map<Id, Status_Milestone__c>( [select Id, Participant__c, Category__c, Sub_Category__c, Status_Milestone__c, Effective_Date__c from Status_Milestone__c where Participant__c IN :partIds and (Sub_Category__c = 'Reinstated - Redevelopment' or Sub_Category__c = 'Reinstated') ORDER BY Effective_Date__c ASC]); //Since this is sorted by date, the last reinstatement status hit should be the most recent for (Id statId:statMap.keySet()){ cat = statMap.get(statId).Category__c; part = statMap.get(statId).Participant__c; if (part == Trigger.new[i].Participant__c && cat == 'Active, Post-Placement Services') { booPost = true; } else { //reset to false just in case there are multiple reinstatements booPost = false; } }
-
- jgrenfell
- October 23, 2007
- Like
- 0
- Continue reading or reply
15 Digit Id issue
This is the offending code, the "part" variable is what I'm having issues with. Is there another way to do this that will help me? I'm at my wits end fighting with this.
Code:
var part = getURLParam("CF00N50000001YtHY_lkid"); var sm = new sforce.SObject("Status_Milestone__c"); sm.RecordTypeId = RT; sm.Category__c = selCat.options[selCat.selectedIndex].value; sm.Sub_Category__c = selSubCat.options[selSubCat.selectedIndex].value; sm.Status_Milestone__c = selStatus.options[selStatus.selectedIndex].value; sm.Comment__c = selComment.value; sm.Effective_Date__c = eff_date; sm.Participant__c = part; var SaveResult = sforce.connection.create([sm ]);
Message Edited by jgrenfell on 10-04-2007 04:48 PM
-
- jgrenfell
- October 04, 2007
- Like
- 0
- Continue reading or reply
Do I need to use bulk ready triggers?
If I anticipate uploading 1000+ records at once, do I need to have my triggers ready to process bulk records?
Ben
- bpol
- February 19, 2010
- Like
- 0
- Continue reading or reply
Unable to catch exception
HI,
I have written a controller, and a page that uses it. This method catches an exception, I am trying to pass the error to the apex : messages visualforce page .
Clicking Running this method, I get an "An unexpected error has occurred. " page. what's wrong with my exception catching?
public void deleteOldInvoices() {
//this method is in the controller. it is run from the page try { //some code here. } } catch (Exception e) { Apexpages.addMessages(e); } }
Thanks
Ben
- beener
- February 16, 2010
- Like
- 0
- Continue reading or reply
trigger Update_Opp_Amounts, therefore it cannot recursively update itself ----------help--------
Hi, I'm a newbe to Apex and am running into some issues with a trigger. The problem is that I am trying to update a list but I am receiving this error below
Error:Apex trigger Update_Opp_Amounts caused an unexpected exception, contact your administrator: Update_Opp_Amounts: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 006S0000003BqedIAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Update_Opp_Amounts: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 006S0000003BqedIAC; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 006S0000003Bqed) is currently in trigger Update_Opp_Amounts, therefore it cannot recursively update itself: [] Trigger.Update_Opp_Amounts: line 26, column 9: []: Trigger.Update_Opp_Amounts: line 26, column 9
My code
trigger Update_Opp_Amounts on Opportunity (before insert, before update)
{
List<Opportunity> Opp= Trigger.new;
List<String> OppOwner = new List<String>();
for (Opportunity Oppy:Opp)
{
OppOwner.add(Oppy.OwnerID);
}
List<Opportunity> OppAmounts = [SELECT Amount, Total_Pipe_Line__c FROM Opportunity WHERE
StageName not in('Closed Lost', 'Order Received') and ownerID IN :OppOwner];
decimal total_amount = 0.0;
decimal amounts = 0.0;
for (Opportunity OppUpdate:Opp)
{
for (Opportunity OppAmnts:OppAmounts)
{
amounts = OppAmnts.Amount;
total_amount += amounts;
OppUpdate.Total_Pipe_Line__c = total_amount;
}
OppUpdate.Total_Pipe_Line__c = total_amount;
Update OppAmounts //problem here with the update
}
}
As my code suggests I would like to try and update ALL records in OppAmounts list and not just update on the current record. Does any one have any suggestions on how to do this please?
- Beer_Is_God
- February 06, 2010
- Like
- 0
- Continue reading or reply
Finding Association between Business Hours and Holidays
- jgrenfell
- July 04, 2009
- Like
- 0
- Continue reading or reply
Too many SOQL queries: 101 how can we avoid this exception
Hello,
I am using a soql query to retrieve records from contact.
Here is my query:
List<contact> contactList=[Select name,Email from contact where id=:contactId];
I am able to execute this if i have less records but if i have more records that is fr about 200 Records i am getting an exception:
Too many SOQL queries: 101 .
When i looked for this Exception i came to know that a database statement cannot process more than 100 records.
Is there any method to overcome this issue please help me out with code if any.
Please help me out of this issue.
Thanks in advance,
prashanth.
- VF
- July 04, 2009
- Like
- 0
- Continue reading or reply
Richtext InputTextArea: Prevent from submitting on enter
I've built a simple Visualforce page used to compose emails, using an inputTextArea with richText = true for the body of the email. The problem is, anytime you hit enter while in that inputTextArea, instead of adding a line break it submits the form (i.e. sends the email). I've tried setting the form to immediate = false, and adding an actionSupport for the onenter event with no action, but it still happens. Anyone know how to get around this? The page is below.
<apex:page standardController="Contact" extensions="extEmailPO2"> <apex:form id="editorForm"> <apex:pageBlock id="pageEmail"> <apex:pageBlockButtons > <apex:commandButton action="{!send}" value="Send" id="theButton" immediate="false"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem > To: <apex:outputText value="{!POEmail}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Subject: <apex:inputText id="subject" value="{!eSubject}" required="true" style="width: 400px"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputTextarea id="email" richtext="true" value="{!eContent}" required="true" > <apex:actionSupport event="onenter"/> </apex:inputTextarea> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- jgrenfell
- May 13, 2009
- Like
- 0
- Continue reading or reply
Rerender a form and required fields
I have page with a custom controller and a tab panel. In one of the tabs, I want the user to be able to flip between a view to enter a new record and a list of historical records. I'm using a boolean variable to track which form (new or historical) should be rendered and a commandlink to set that variable. Every time I click on that commandLink though, the new form remains with the "You must enter a value" error on the required fields in the form. I don't want that form saved though and can't seem to get around. I've tried filling in those fields and then hitting the commandlink, but the same thing happens. What am I missing?
Code for that tab:
<apex:tab id="tabFLSEReferral" label="FLSE Referral" rendered="{!IF(student==null, false, true)}"> <apex:form id="formFLSEReferral" rendered="{!modeNewFLSERef}"> <apex:commandLink action="{!linkFLSENewRef}" rerender="formFLSEReferral, formFLSEReferralHistory" value="{!IF(modeNewFLSERef, 'View Referral History', 'Enter New Referral')}" style="font-weight:bold;font-color:#0000ff;font-size:12" /> <apex:pageBlock id="pageFLSEReferral" rendered="{!modeNewFLSERef}"> <apex:pageblockButtons ><apex:commandButton action="{!save_flseReferral}" value="Save"/></apex:pageblockButtons> <!-- NEW / EDIT --> <apex:pageBlockSection columns="2"> <apex:pageBlockSectionItem > Referral?: <apex:inputField value="{!flseRef.Referralcheckbox__c}" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Referred By: <apex:inputField value="{!flseRef.Referred_By__c}" required="true" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Referral Date: <apex:inputField value="{!flseRef.Referral_Date__c}" required="true" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- HISTORICAL RECORDS --> <apex:form id="formFLSEReferralHistory" rendered="{!Not(modeNewFLSERef)}"> <apex:pageBlock id="pageFLSEReferralHistory" rendered="{!Not(modeNewFLSERef)}"> <apex:pageblockSection columns="1"> <apex:pageBlockSectionItem > <apex:pageBlockTable value="{!flseReferrals}" var="flseRef"> <apex:column headervalue="Action" > <apex:commandLink action="{!linkflseEditRef}" rerender="formFLSEReferral, formFLSEReferralHistory" value="edit"> <apex:param name="selectedId" value="{!flseRef.id}"/> </apex:commandLink> </apex:column> <apex:column headervalue="Profile" value="{!flseRef.Profile_Status_FLSE_notes__c}"/> <apex:column headervalue="Component" value="{!flseRef.Profile_FLSE_Component__c}"/> <apex:column headervalue="Created Date" value="{!flseRef.CreatedDate}"/> </apex:pageBlockTable> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:tab>
Code for that commandLink (I added the clear method to try to avoid this, but to no avail):
public PageReference linkFLSENewRef() { this.modeNewFLSERef = (modeNewFLSERef ? false : true); if (!this.modeNewFLSERef){ this.flseRef.clear(); } return null; }
- jgrenfell
- April 02, 2009
- Like
- 0
- Continue reading or reply
How to display a list item in the html body of an email
Is there a way to display items in a htmlBody of an email. I know it accepts only strings, but if there is a workaround to getting list items to display in the email, it would great.
Any suggestions?
thanks
cheers
sand
- teknicsand
- March 25, 2009
- Like
- 0
- Continue reading or reply
Test Method SoQL limit using cumulative count instead of per DML operation
I have a number of classes and triggers with test methods that have all been functioning correctly for months. There were certain (rare) cases where the SoQL Query limit was being hit, so to avoid this, I annotated one method as @future. I then run the tests, and even though it's the exact same code as before just plus the @future, it's now returning "Too many SoQL queries" as an error. In going through the debug logs, no single DML operation uses more than 20 queries (not even close), but cumulatively the inserts in the test method are hitting 21. The cumulative limit for SoQL queries is supposed to be 100, not 20?
I can't possibly post all of the code behind this, but this is the test method itself. The only thing that's changed from when it was working is that one of the methods called as a result is now @future and adding the startTest / stopTest - could that have an impact? It hits the SoQL limit error on the last Event insert. Anyone have any ideas?
static testMethod void testAdjournedCourtDateCheck() { Test.startTest(); Event event1; // Find the ID of the CEP Account Account CEP = [SELECT ID FROM Account WHERE Account.Name = 'CEP' and Account.RecordType.Name = 'CASES Programs']; // Create some sample dates for insert commands Date birthDate1 = Date.newInstance(1976,11,20); Date activityDate = Date.newInstance(2006,11,20); Datetime activityDatetime = Datetime.newInstance(2006,11,20); Date activityDate2 = Date.newInstance(2006,11,21); Datetime activityDatetime2 = Datetime.newInstance(2006,11,21); Date referDate1 = Date.newInstance(2006,11,20); Date intakeDate1 = Date.newInstance(2006,11,21); // Set the RecordTypes Id eventType = '012600000004yjw'; Id contactType = '012600000004zC5'; Id intakeType = '012600000004z70'; //Create a Test Client Contact testContact = new Contact(FirstName = 'Unit', LastName = 'Tester', AccountId = CEP.Id, Gender__c = 'Male', Birthdate = birthDate1, RecordTypeID = contactType); insert testContact; //Insert an Intake case for the client Case_Information__c cinfos_intake = new Case_Information__c(Client__c = testContact.Id, Name = 'test777777', Borough__c = 'X - Bronx', Referred_On__c = referDate1, Intake_Date__c = intakeDate1, RecordTypeID = intakeType); insert cinfos_intake; //Insert an adjourned Court Date Appointment Boolean IsError1 = false; try{ event1 = new Event( Outcome__c = 'Adjourned', Subject = 'Court Date', ActivityDate = activityDate, ActivityDateTime = activityDatetime, RecordTypeID = eventType, DurationInMinutes = 60, WhatId = cinfos_intake.Id ); insert event1; } catch(Exception e) { IsError1 = true; System.debug('The error is: ' +e); } //Insert another Court Date Appointment Boolean IsError2 = false; try{ event1 = new Event( Outcome__c = 'Pending', Subject = 'Court Date', ActivityDate = activityDate2, ActivityDateTime = activityDatetime2, RecordTypeID = eventType, DurationInMinutes = 60, WhatId = cinfos_intake.Id ); insert event1; } catch(Exception e) { IsError2 = true; } Test.stopTest(); //First event insert should go in System.assertEquals(false, IsError1); //Make sure Disposition Date being updated cinfos_intake = [Select Id, Court_Dates_After_Adjourned_Outcome__c from Case_Information__c where Id = :cinfos_intake.Id]; System.assertEquals(true, cinfos_intake.Court_Dates_After_Adjourned_Outcome__c); }//end testAdjournedCourtDateCheck
- jgrenfell
- March 01, 2009
- Like
- 0
- Continue reading or reply
Asynchronous Apex, what is your time between submission and completion
For those who use asynchronous apex what is your average time between when the job is submitted and it completes. The documentation says that these jobs will execute when system resources are available but from what I can tell they execute almost instantly after submission. I'm sure this is not a safe assumption, especially with batch processing coming, as this could definitely cause an increase in queue times.
So has anyone noticed a significant delay between aschrounous submission time and completion time?
Thanks,
Jason
- TehNrd
- February 27, 2009
- Like
- 0
- Continue reading or reply
Using FolderId in the Where clause of an EmailTemplate Query
I'm creating a page that includes a list of Folders for email templates, and when the user selects a folder, I want to display the EmailTemplates in that folder. I'm getting an error on the SoQL to do that though- "unexpected token : FolderId". The same query works fine in the Schema Explorer in Eclipse.
List<EmailTemplate> ets = [Select Id, Name From EmailTemplate where FolderId := this.eFolder];
Anyone have any ideas?
- jgrenfell
- February 26, 2009
- Like
- 0
- Continue reading or reply
error while running test cases
Hi
I am getting error while running test cases.
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>
Please help me its urgent
- PRepaka
- February 26, 2009
- Like
- 0
- Continue reading or reply
Anyone getting unknown exception errors running tests via Eclipse after sandbox upgrade?
After getting all my tests running fine on Friday, I came in this morning to re-run after some changes to Apex classes. The sandbox was upgraded to Spring 09 on the weekend, and now every time I try to run any tests via Eclipse I get the nice "unknown exception" - unexpected error has occurred message.
I can run tests ok via the browser but this is not ideal for debugging.
Anyone else getting this after the Spring 09 upgrade? I am still coding using v14 of the API.
Thanks,
Stephen
- StephenB
- January 26, 2009
- Like
- 0
- Continue reading or reply
request for help redirected here by Customer Support (salesforce.com Case Number 02343719)
public class mySecondApexPageController { public String getMumbledpeg() { return ('Mumbledpeg'); } public List<EmailTemplate> getTemplates() { System.debug('Entering getTemplates() in mySecondApexPageController'); List<EMailTemplate> Results = [ SELECT Id, EMailTemplate.Name, Subject, TemplateType, FolderId, Folder.Name FROM EmailTemplate WHERE IsActive = true ORDER BY Folder.Name, EMailTemplate.Name ]; for ( EMailTemplate i : Results ) { if (i.Folder.Name==null) { i.Folder.Name = 'Unfiled Email Template'; } } return Results; } }
My thinking was that the controller code did nothing to cause the field to be non-writeable, and there are not any programming facilities (that I know of) to make the field writable. BTW, I have also tried copying Results via the deepclone() method, but the cloned array is non-writable in this field also.
- John L.
- January 16, 2009
- Like
- 0
- Continue reading or reply
Crystal Reports
- CRM SFDC
- November 19, 2008
- Like
- 0
- Continue reading or reply
Apex:toolbar Style
In other words, the default appearance is a green-to-black gradient that looks terrible on my vf page.
What are the css properties that I can change to style the toolbar?
- Jim Boudreaux
- November 12, 2008
- Like
- 0
- Continue reading or reply
How to write a piece of code which will run after specific Time
I need to write a piece of code which will get the List of Opportunity difrentiated by some criteria and want to email those records every weekends.
Its like Time Based coading.
I have read about time dependent Workflow triggers but it doesnt resolves my problem because it does not provide flexibility to write the Apex code.
I want to run the code once in every week.
Can anyone give some suggestions?
Thanks in Advance!
- Jitendra
- October 08, 2008
- Like
- 0
- Continue reading or reply
S-Control and Permission to run a SoQL Query
With some alert calls in the s-control, I was able to pinpoint that the javascript just stops when it tries to perform the SoQL query. The user profile for this user has rights to the object being queried, has the API enabled and I tried adding a couple rights to the profile- View All Data and View Configuration, but to no end. Is there a setting, in the profile or elsewhere, that would prevent a user from being able to run a SoQL query in an S-Control?
I have similar s-controls in different salesforce instances and have never hit this before, very frustrating!
- jgrenfell
- October 08, 2008
- Like
- 0
- Continue reading or reply