• jgrenfell
  • NEWBIE
  • 105 Points
  • Member since 2007

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 40
    Replies
I am trying to change the look of the using the style attribute. The problem is I can't find any documentation on the style attributes that the toolbar component uses.

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?
Hi,

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!


I've been using Custom Labels in an application I'm building that will be a managed package and I'm wondering if the namespace for the package applies to the labels as well.  I would assume so, but confirmation would appreciated.  I want to make sure I don't have to worry about duplicate Custom Labels once the application is deployed to other organizations.  Thanks in advance to anyone who knows.

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?

I can access both Holidays and Business Hours, but I'm wondering where to find the junction table between the two.  I'm writing code where I'd like to access only the Holidays that are associated with the Business Hours marked as default and I'm not seeing it.  Any help would be appreciated.

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>

 

 

 

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.

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; }

 

 

 

 

 

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'); }

 

 

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.

 

 

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

 

 

 

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?

 

I have an S-control that just takes the id that's passed to it (it's the Id of a new record just saved), performs a SoQL query and then redirects the user to a related record.  It works perfectly for system admins, but not for one of the users- it just sits there blank without redirecting.  I logged on as that user and was able to recreate the issue, which indicates this is something to do with permissioning. 

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!
I'm trying to redirect the user to a particular page when saving a new record.  Since the new record is being created from a custom button, it seem like I should be able to just include the retURL parameter.  I can't get it to work though, no matter what is in the retURL parameter, saving brings the user to the record just saved.  I know it's not a syntax error because using the same exact retURL parameter when editing a record works fine. 

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?
I've created a junction object (there are two master-detail relationship fields) and now discovered that I can't seem to import into this object?  It doesn't appear as an option in either Lexi Loader (Mac version of Data Loader) or in the "Import Custom Objects" wizard in Setup.  Am I right in assuming that it's because it's a junction object, or is that a red herring and there's some other aspect of this object I should be checking.  It's disappointing to think that the new junction object capability comes at the cost of not being able to import.
I have a simple Datagrid in Flex:
Code:
<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?

My organization is looking to fill the position described below.  Please pass this on if you know anyone who might be interested.  Thanks!

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


I'm trying to do a switch statement in Apex, I'm assuming the syntax will be like java, but I can't seem to get it to compile; I get an "unexpected token: {" error message. Am I missing something obvious?  I have many more cases to add and I'm hoping I don't have to do if statements for each one.

Code:
switch (ce_days) {
 case 180:
  milestone = 180;
}//end switch

 

Does anyone know of a way to determine that an insert/update is being done by a trigger in a validation rule, for instance if there's a different User for changes made by a trigger? I've hit a couple instances where Triggers fail because they don't pass a validation rule, so I'm hoping there's a way I can exclude a trigger in the validation rule itself, like AND(user != triggeruser, validation rule...).
I have a trigger where I create a Map of SObjects using a query that includes an ORDER BY statement.  My hope was that the values in the map would then be in the same order as the results of the query, but when I iterate through them, that's not the case. Any way to set the order of the values in a map, or do I need to accomplish this differently?

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;
    }
   }

 

I have an s-control that I'm using to override the New button for a custom object.  When I hit that New button from the parent object (Contact), I pull the Contact Id from the URL and then use that Id to create a new record (via javascript).  I'm receiving an INVALID_CROSS_REFERENCE_KEY error message when trying to create the new record.  After fighting with it for awhile, I realized that if I hard-code the18-digit Id, the record is created with no error.  So, how do I either do the create with just the 15-digit Id OR convert the 15-digit Id to an 18-digit Id.  I found a couple scripts out there to do the conversion, and none have returned the correct 3-digit suffix.  When I try to do a SoQL query to get the id ("Select Id from Contact where Id='" +part+"'"), it's coming back as 15 digits, even though other queries return the 18-digit Id. 

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

If I anticipate uploading 1000+ records at once, do I need to have my triggers ready to process bulk records?

 

Ben

  • February 19, 2010
  • Like
  • 0

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 

 

  • February 16, 2010
  • Like
  • 0

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?

I can access both Holidays and Business Hours, but I'm wondering where to find the junction table between the two.  I'm writing code where I'd like to access only the Holidays that are associated with the Business Hours marked as default and I'm not seeing it.  Any help would be appreciated.

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. 

 

 

  • July 04, 2009
  • Like
  • 0

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>

 

 

 

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; }

 

 

 

 

 

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

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

 

 

 

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

Message Edited by TehNrd on 02-28-2009 04:58 PM
  • February 27, 2009
  • Like
  • 0

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?

 

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

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

I am receiving the following Apex Controller compile error message:
 
      Field is not writeable: Name.Name at line 17 column 38
 
Below is the code in question:

Code:
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.  
 
That said, is there another methodology I can use to accomplish the desired goal of modifying the Results array contents prior to being returned by the getTemplates() method???
 
THanks in advance for your time and consideration. 
Hi all,
 
what's the advantage/disadvantage of using crystal report for SFDC DB?
 
 
Thanks.
I am trying to change the look of the using the style attribute. The problem is I can't find any documentation on the style attributes that the toolbar component uses.

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?
Hi,

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!


I have an S-control that just takes the id that's passed to it (it's the Id of a new record just saved), performs a SoQL query and then redirects the user to a related record.  It works perfectly for system admins, but not for one of the users- it just sits there blank without redirecting.  I logged on as that user and was able to recreate the issue, which indicates this is something to do with permissioning. 

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!