• GlennAtAppirio
  • NEWBIE
  • 30 Points
  • Member since 2007

  • Chatter
    Feed
  • 1
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 40
    Replies

I'm a beginner at apex, and I've written this for a custom object called "Account". It works just fine for standard leads and accounts - just not the custom account object. I'm getting the error at the beginning of the third Account__c:

 

Invalid identifier: Account__c

 

trigger SetAccountField on Account__c (before insert, before update) {
    for (Account__c Account__c : Trigger.new) {
        Account__c.Scoring__c = '0017000000TEs0O';
    }
 }

 

 

Any help would be much appreciated. 

I'm posting this in the hopes of helping "the next guy" that hits this.  

 

Our ant-based deployments, which had been going flawlessly for months, suddenly started failing, with lots of UNABLE_TO_LOCK_ROW errors in the logs from our various Apex test methods.  The same exact test methods passed when executed from "Run All Tests" in the UI.  We tried deploying with Eclipse and Change Sets, but got the same UNABLE_TO_LOCK_ROW errors.

 

The lines of code that were failing were all record inserts for certain objects.  We realized that if we removed those objects from our package.xml, we could complete the deployment without the errors.  However, we are making lots of object-level changes (new fields, etc), so this was a bad long-term solution.

 

After much troubleshooting, SFDC Tech Support finally found the root cause.  It turns out that if you modify the format of an auto-number field - say, change the name from "C-{0000}" to "CDM-{0000}" - subsequent deployment of that object will fail if any test methods insert records of that object.

 

Ouch.  Ugly, bad bug.  But once we knew the cause, we matched up all auto-number field formats in our source & destination orgs, and then re-ran the full ant script (with all objects) again, and the deployment was successful.

 

Hopefully SFDC will fix this odd bug quickly.  But in the meantime, if you get UNABLE_TO_LOCK_ROW" errors during deployment, check your auto-number field formats!

Every user record in our SFDC org has a User.Manager listed, except our CEO. SFDC won't allow a circular relationship, and every other user already reports to someone else, so SFDC won't let us list any other user as the CEO's manager (even, say, the CEO's assistant, or the VP of HR).

When using User.Manager to route approvals, this becomes a serious issue. We've implemented Expense Reports in SFDC, and use the Manager hierarchy for automatic routing. Finance is only triggered to pay approved expense reports. Therefore, we'd like the CEO's expense reports to route to our VP of Finance for approval.

We tried putting an inactive user in the CEO's User.Manager field, but it didn't work. When the CEO tries submitting an expense report for approval, SFDC complains that "This approval request requires the next approver to be determined by the Manager field. This value is empty. Please contact your administrator for more information." (Of course, the value isn't "empty," it's pointing to an inactive user.)

Any ideas for how to route approvals for the top of the manager hierarchy, i.e. our CEO?
We're using the <apex: pageMessages> tag to set and display error messages to users.

However, the tag doesn't seem to display if messages are set (via ApexPages.addMessage()) during the initial page load, i.e. within the controller's constructor. The page messages display fine upon any reload (e.g. after calling an action from a button).

This is unfortunate. We do lots of lookups in the constructor based on URL parameters, and want to display error messages in certain situations.

We've hacked around this for now by re-creating the <apex: pageMessages> look & feel within an apex: outputPanel, and then writing some controller code to parse the existing message list and set a member variable accordingly. But this is definitely a hack.

Are we missing something? We'd love to be able to set and display <apex: pageMessages> during the initial page load.

Message Edited by GlennAtAppirio on 09-22-2008 09:16 AM
The <apex:listViews> tag is nice for adding the standard SFDC view functionality to a custom tab.  But it curiously allows for a "body" Facet, which "replaces the list of records that would normally display." 

I'm curious what the use case is for using a body facet with this tag?  You end up with a pretty confusing and apparently useless View picklist.  Perhaps an example might better illustrate - does anyone have a useful example?  (I'm guessing that perhaps the body facet could somehow dynamically present different content based on what view was selected.)

The reason I ask in the first place, is that we're seeking a way to filter which Views appear in the views picklist.  I don't see any way to do this, but ran across the body facet and it got me wondering.



I'm thrilled to try out the new Force.com Toolkit!  I've survived the install, but unfortunately, I'm unable to successfully create a project.

I did a fresh Eclipse 3.3.1.1 install, followed by a fresh Force.com Toolkit and WST install. 

I then tried to create my first new Force.com project, resulting in this error:

RuntimeException: Failed deployment: UNKNOWN_EXCEPTION msg:UNKNOWN_EXCEPTION: An unexpected error occured. Please include this ErrorId if you contact support: 1019309728-308

I then tried to create a new Force.com project for another SFDC org (this time a sandbox org), and project creation culminated in this error:

RuntimeException: Failed deployment: INVALID_CROSS_REFERENCE_KEY msg:INVALID_CROSS_REFERENCE_KEY: invalid cross reference id

I'm happy to share more details (which SFDC org, etc.) if someone wants to troubleshoot with me further.


We struggled a bit to figure out how to programmatically authenticate Self-Service Portal (SSP) users, so I thought I'd share our findings, if it'll help someone else.

In our instance, the SFDC SSP sits behind a Jive KB.  Users provide their username/password to Jive, but Jive delegates authentication to the SFDC SSP, so we need Jive to call the SSP.  The API documentation talks generally about the login() method for authenticating Users, and provides a nice sample.  However, when it comes to authenticating SelfServiceUsers, the documentation has only this cryptic note (and no example):

To authenticate active Self-Service users, use the LoginScopeHeader to specify the Organization ID against which Self-Service users are authenticated. A Self-Service user must exist and be active before being authenticated (see SelfServiceUser).


(p. 141 of the Apex 9.0 API Guide)

If you're not already familiar with the notion of setting SOAP headers, this will be hard to figure out.  So, here is working sample code to authenticate a SelfServiceUser:

Code:
public static void authenticateSelfServiceUser(String userName, String pwd) {
  try {
    SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
    String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
    String orgId = "12345abc";  // put your SFDC OrgId here
    LoginScopeHeader loginScopeHeader = new LoginScopeHeader();
    loginScopeHeader.setOrganizationId(orgId);
    binding.setHeader(sforceURI, "LoginScopeHeader", loginScopeHeader);
    LoginResult lr = binding.login(userName, pwd);
    System.out.println("User " + userName + " authenticated - session id is " + lr.getSessionId() + ", userid = " + lr.getUserId());
  } catch (Throwable e) {
    System.out.println("Error while authenticating SSU " + userName + ": " + e);
  }
}

Hope this helps someone.

Glenn

Message Edited by GlennAtAppirio on 03-12-2007 02:29 AM

I am trying to do a relationship query for EmailMessages associated with a Case.  However, something seems to be "special" about this relationship.

Normally, I can retrieve related lists like this:

SELECT id, (SELECT CommentBody FROM Case.CaseComments) FROM Case WHERE id = '50050000003DZRB'

However, this approach doesn't seem to work with EmailMessages.  I don't see any related list for EmailMessages in the Enterprise WSDL, but surprisingly, a relatinship does show up in the schema browser Apex Toolkit for Eclipse.  However the relationship looks "funny" there - you can't drill into it like you can with the other Case relationships (it has a blue ball next to it instead of a plus sign), so you can't view the relationship name.  For the sake of trying everything, I experimented with some guesses at the relationship name -

(SELECT id FROM Case.EmailMessages)
(SELECT id FROM Case.CaseEmailMessages)
(SELECT id FROM Case.Emails)
(SELECT id FROM Case.CaseEmails)

None of these worked.  But it feels like this should be doable - the EmailMessage object has a "ParentID" field that points back to the Case, so I can always do a separate SOQL query on EmailMessage.  But I'd hoped to use a relationship query here, for various reasons.

Can anyone explain the apparently "special" relationship from Case to EmailMessage?
These boards have numerous threads about sending emails from s-controls.  Having just wrestled with a variant of the problem for a customer, I thought I'd post the solution I used, which (now!) seems fairly straightforward (although it took some bobbing & weaving to get here).

Problem Statement
:  With one click, allow a user to create an object, then send a template-based email to a Contact associated with that object.  The email template must populate with correct values from the just-created object.

Solution:  Save the following code as an s-control snippet.  Then include the snippet, and call the function from anywhere in your main s-control.  (I won't cover the part about creating a new object here - let's assume you can do that, and then retrieve the object ID of your newly created object.)

function sendEmail(templateId, contactIdForToAddress, relatedObjectId) {

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

  window.open(url);
}


The net effect here is that a new window (actually, a tab in Firefox) will open up, pointing at the newly created object.  If it has an Activity History related list, the just-sent email will appear there. 

This all worked rather elegantly for me.  The actual use case is a Google Map showing the location of various Communities (a custom object).  The user can select several Communities (from a sidebar with a list of accounts & checkboxes), then click a single button to create "Referrals" (a custom object) to each selected Community, and email each Community's primary contact with their Referral data.  After the click, the user waits a moment, and then multiple tabs open up, one for each newly-created Referral.

I'm happy to discuss further if anyone is interested or needs help doing something similar - glenn@appirio.com.


Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM

Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM

I'm posting this in the hopes of helping "the next guy" that hits this.  

 

Our ant-based deployments, which had been going flawlessly for months, suddenly started failing, with lots of UNABLE_TO_LOCK_ROW errors in the logs from our various Apex test methods.  The same exact test methods passed when executed from "Run All Tests" in the UI.  We tried deploying with Eclipse and Change Sets, but got the same UNABLE_TO_LOCK_ROW errors.

 

The lines of code that were failing were all record inserts for certain objects.  We realized that if we removed those objects from our package.xml, we could complete the deployment without the errors.  However, we are making lots of object-level changes (new fields, etc), so this was a bad long-term solution.

 

After much troubleshooting, SFDC Tech Support finally found the root cause.  It turns out that if you modify the format of an auto-number field - say, change the name from "C-{0000}" to "CDM-{0000}" - subsequent deployment of that object will fail if any test methods insert records of that object.

 

Ouch.  Ugly, bad bug.  But once we knew the cause, we matched up all auto-number field formats in our source & destination orgs, and then re-ran the full ant script (with all objects) again, and the deployment was successful.

 

Hopefully SFDC will fix this odd bug quickly.  But in the meantime, if you get UNABLE_TO_LOCK_ROW" errors during deployment, check your auto-number field formats!

Every user record in our SFDC org has a User.Manager listed, except our CEO. SFDC won't allow a circular relationship, and every other user already reports to someone else, so SFDC won't let us list any other user as the CEO's manager (even, say, the CEO's assistant, or the VP of HR).

When using User.Manager to route approvals, this becomes a serious issue. We've implemented Expense Reports in SFDC, and use the Manager hierarchy for automatic routing. Finance is only triggered to pay approved expense reports. Therefore, we'd like the CEO's expense reports to route to our VP of Finance for approval.

We tried putting an inactive user in the CEO's User.Manager field, but it didn't work. When the CEO tries submitting an expense report for approval, SFDC complains that "This approval request requires the next approver to be determined by the Manager field. This value is empty. Please contact your administrator for more information." (Of course, the value isn't "empty," it's pointing to an inactive user.)

Any ideas for how to route approvals for the top of the manager hierarchy, i.e. our CEO?
We struggled a bit to figure out how to programmatically authenticate Self-Service Portal (SSP) users, so I thought I'd share our findings, if it'll help someone else.

In our instance, the SFDC SSP sits behind a Jive KB.  Users provide their username/password to Jive, but Jive delegates authentication to the SFDC SSP, so we need Jive to call the SSP.  The API documentation talks generally about the login() method for authenticating Users, and provides a nice sample.  However, when it comes to authenticating SelfServiceUsers, the documentation has only this cryptic note (and no example):

To authenticate active Self-Service users, use the LoginScopeHeader to specify the Organization ID against which Self-Service users are authenticated. A Self-Service user must exist and be active before being authenticated (see SelfServiceUser).


(p. 141 of the Apex 9.0 API Guide)

If you're not already familiar with the notion of setting SOAP headers, this will be hard to figure out.  So, here is working sample code to authenticate a SelfServiceUser:

Code:
public static void authenticateSelfServiceUser(String userName, String pwd) {
  try {
    SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
    String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
    String orgId = "12345abc";  // put your SFDC OrgId here
    LoginScopeHeader loginScopeHeader = new LoginScopeHeader();
    loginScopeHeader.setOrganizationId(orgId);
    binding.setHeader(sforceURI, "LoginScopeHeader", loginScopeHeader);
    LoginResult lr = binding.login(userName, pwd);
    System.out.println("User " + userName + " authenticated - session id is " + lr.getSessionId() + ", userid = " + lr.getUserId());
  } catch (Throwable e) {
    System.out.println("Error while authenticating SSU " + userName + ": " + e);
  }
}

Hope this helps someone.

Glenn

Message Edited by GlennAtAppirio on 03-12-2007 02:29 AM

These boards have numerous threads about sending emails from s-controls.  Having just wrestled with a variant of the problem for a customer, I thought I'd post the solution I used, which (now!) seems fairly straightforward (although it took some bobbing & weaving to get here).

Problem Statement
:  With one click, allow a user to create an object, then send a template-based email to a Contact associated with that object.  The email template must populate with correct values from the just-created object.

Solution:  Save the following code as an s-control snippet.  Then include the snippet, and call the function from anywhere in your main s-control.  (I won't cover the part about creating a new object here - let's assume you can do that, and then retrieve the object ID of your newly created object.)

function sendEmail(templateId, contactIdForToAddress, relatedObjectId) {

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

  window.open(url);
}


The net effect here is that a new window (actually, a tab in Firefox) will open up, pointing at the newly created object.  If it has an Activity History related list, the just-sent email will appear there. 

This all worked rather elegantly for me.  The actual use case is a Google Map showing the location of various Communities (a custom object).  The user can select several Communities (from a sidebar with a list of accounts & checkboxes), then click a single button to create "Referrals" (a custom object) to each selected Community, and email each Community's primary contact with their Referral data.  After the click, the user waits a moment, and then multiple tabs open up, one for each newly-created Referral.

I'm happy to discuss further if anyone is interested or needs help doing something similar - glenn@appirio.com.


Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM

Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM

I'm a beginner at apex, and I've written this for a custom object called "Account". It works just fine for standard leads and accounts - just not the custom account object. I'm getting the error at the beginning of the third Account__c:

 

Invalid identifier: Account__c

 

trigger SetAccountField on Account__c (before insert, before update) {
    for (Account__c Account__c : Trigger.new) {
        Account__c.Scoring__c = '0017000000TEs0O';
    }
 }

 

 

Any help would be much appreciated. 

Hey guys... I'm confused. I'm attempting to deploy from my sandbox to production and am running in to inconsistent errors with the process...

 

When I "run all tests" in Salesforce web - everything works fine. I get coverage for everything over 75%, and no failures.

 

When I go into eclipse and sync all my classes, obj, etc... and then r-click>force.com>run tests - everything works as well...

 

However, when I attempt to validate my deployment, I get a these terrible errors:

 

Run Failures: ImacControllerTest.testNewIMAC System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] InstallTicketControllerTest.testInsTkt System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] LocationPrepOrderControllerTest.testLocPrp System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] RequirementControllerTest.testRqm System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] ShipmentControllerTest.testShp System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] TerminalPrepOrderControllerTest.testTrmPrp System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestAxnUpdateAfter.testAxnUpdateInsert System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestAxnUpdateBefore.testAxnUpdate System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestInsTktUpdate.testInsTktInsert System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestLocPrpUpdate.testLocPrpUpdateInsert System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestShpUpdateAfter.testShpUpdate System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] triggerTestTrmPrpUpdate.testTrmPrpUpdate System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] axnUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required shpUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required TrmInAxnUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required shpUpdateBefore Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required LocPrpUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required axnUpdateAfter Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required axnUpdateBefore Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required trmPrpUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required installTicketUpdate Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required shpUpdateAfter Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required Average test coverage across all Apex Classes and Triggers is 25%, at least 75% test coverage is required

 

 All of this is already successfull! What gives?

Why does it not work in deployment when it works in the sandbox?

 

  • January 06, 2010
  • Like
  • 0

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record:

 

I am getting the above error message when I am trying to load data through the data loader but in case of UI  I am not having the issue.

 

I have a trigger on after insert of lead which is trying to update records leads and on that line this error is occuring.

Message Edited by ess on 08-25-2009 06:43 AM
  • August 25, 2009
  • Like
  • 0

Hey,

 

We are seeing some strange behaviour with a VF controller we're trying to deploy from a Sandbox org to production.  In our org we have a parent-child relationship (lookup) between two objects.  A method in the controller class creates a record of the parent object, and then creates a child object record, linking it to the new parent record (newChildRec.Parent__c = parentRec.Id ).  This is all in one method, so presumably it's all taking place in a single transaction.

 

So this works fine in the sandbox, and the covering testMethod works fine too - both parent and child records are created no problem.

 

But when we try to deploy to the production org, the testMethod fails, saying (roughly) "Unable to obtain exclusive access to the record" (UNABLE_TO_LOCK_ROW) when trying to create the CHILD record.  Why would this be?  I do understand that when you create a child object record, the system locks the parent record.  But how come this would work on the sandbox but not when we try to deploy to production?  Wouldn't the fact that this is within the same transaction cause this failure to NOT happen?  Could it have to do with API versions, perhaps?  The controller in question is 15.0, and it is being deployed using Eclipse with force.com plugin version 15.0.    The sandbox is on Summer '09 whereas the prod org is of course still on Spring '09, in case that makes a difference.

 

Can someone advise, by any chance?  

 

Thanks!

Hi,

 

I've run into a very annoying problem. I have a simple visualforce page that displayes an organizations address pulling from the organization fields, like so:

 

 

<apex:outputText value="{!SUBSTITUTE($Organization.Street, '\n', '<br />')}" escape="false" /><br /> <apex:outputText value="{!$Organization.City}" />, <apex:outputText value="{!$Organization.State}" />&nbsp;<apex:outputText value="{!$Organization.Country}" />&nbsp;&nbsp;&nbsp;<apex:outputText value="{!$Organization.PostalCode}" /> <br />

As you can see I'm tyring to replace the new line character with html break tags. Unfortunately it doesn't seem to be picking up the newline character. I really don't want to write custom controller just to generate a string with proper line breaks (this is all the controller would do for this page, I have no need for anything else). Is there a different character for line breaks that I'm missing? 

 

 

 

  • April 22, 2009
  • Like
  • 0

In testmethod I inserted a account with Name field.Its showing the following message

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

 

But I am able to create Account record through tab.

  • February 26, 2009
  • Like
  • 0
Every user record in our SFDC org has a User.Manager listed, except our CEO. SFDC won't allow a circular relationship, and every other user already reports to someone else, so SFDC won't let us list any other user as the CEO's manager (even, say, the CEO's assistant, or the VP of HR).

When using User.Manager to route approvals, this becomes a serious issue. We've implemented Expense Reports in SFDC, and use the Manager hierarchy for automatic routing. Finance is only triggered to pay approved expense reports. Therefore, we'd like the CEO's expense reports to route to our VP of Finance for approval.

We tried putting an inactive user in the CEO's User.Manager field, but it didn't work. When the CEO tries submitting an expense report for approval, SFDC complains that "This approval request requires the next approver to be determined by the Manager field. This value is empty. Please contact your administrator for more information." (Of course, the value isn't "empty," it's pointing to an inactive user.)

Any ideas for how to route approvals for the top of the manager hierarchy, i.e. our CEO?

My email template (below) works fine when using the "preview" function to populate the Recipient (WhoID) and RelatedTo (WhatID)  - but when a workflow rule triggers the emai lto be sent, it comes back blank as if it's not resolving the who or what correctly. .

Code:
<messaging:emailTemplate recipientType="Contact"
    relatedToType="Account"
    subject="Your website Access"
    replyTo="anaddress@us.com" >

    <messaging:htmlEmailBody >        
    <html>
        <body>
        <p>Hello {!recipient.name}--</p>
        <p>Here is a list of the website access you users currently have for account {!relatedTo.name}:</p>
    <apex:datatable cellpadding="5" var="cts" value="{!relatedTo.Contacts}">
        <apex:column value="{!cts.Name}" headerValue="Name"/>
        <apex:column value="{!cts.Seat_Holder__c}" headerValue="Website Program Access"/>
        <apex:column value="{!cts.Email}" headerValue="Email" />
        <apex:column value="{!cts.Phone}" headerValue="Phone" />
    </apex:datatable>
        </body>
    </html>
    </messaging:htmlEmailBody> 
</messaging:emailTemplate>



I created a simple workflow rule that's called whenever a contact is edited. The workflow rule uses an email alert. The email Alert uses this template. I've checked to make sure the email template is for Contact objects, and that the Recipient is specified as Email Field: Email.

I must be missing something obvious..... any ideas?




Message Edited by icemft1976 on 10-24-2008 09:28 AM

We're using the <apex: pageMessages> tag to set and display error messages to users.

However, the tag doesn't seem to display if messages are set (via ApexPages.addMessage()) during the initial page load, i.e. within the controller's constructor. The page messages display fine upon any reload (e.g. after calling an action from a button).

This is unfortunate. We do lots of lookups in the constructor based on URL parameters, and want to display error messages in certain situations.

We've hacked around this for now by re-creating the <apex: pageMessages> look & feel within an apex: outputPanel, and then writing some controller code to parse the existing message list and set a member variable accordingly. But this is definitely a hack.

Are we missing something? We'd love to be able to set and display <apex: pageMessages> during the initial page load.

Message Edited by GlennAtAppirio on 09-22-2008 09:16 AM
I'm recreating a detail page and I'm trying to add some related lists that are currently displayed on the existing page.  I'm unable to figure out what the list names are supposed to be though.  The names that are used in the pagelayout editor are not working.  Some example list are "Notes & Attachments", "Approval History", and "Activity History".  How do you find out the names to use in visual force for related lists?
The <apex:listViews> tag is nice for adding the standard SFDC view functionality to a custom tab.  But it curiously allows for a "body" Facet, which "replaces the list of records that would normally display." 

I'm curious what the use case is for using a body facet with this tag?  You end up with a pretty confusing and apparently useless View picklist.  Perhaps an example might better illustrate - does anyone have a useful example?  (I'm guessing that perhaps the body facet could somehow dynamically present different content based on what view was selected.)

The reason I ask in the first place, is that we're seeking a way to filter which Views appear in the views picklist.  I don't see any way to do this, but ran across the body facet and it got me wondering.



Hi,
 
Yesterday I had deployed aan apex trigger from sandbox to production env. The trigger is an "before insert, before update" to check for duplicate account names. The trigger works fine in prodiuction for preventing duplicate Account names.
 
But today when I tried to mass update Accounts for some other field using Apex Data Loader, I get the following error:
 

Apex script unhandled trigger exception by user/organization: 00530000000nHi3/00D300000006QZD

Trg_Account_Name_Dedup: execution of BeforeUpdate

caused by: System.Exception: Too many SOQL queries: 21

Trigger.Trg_Account_Name_Dedup: line 1, column 143

Can anyone please advise on how to disable triggers in production env so that I can carry out other mass updates in Account using Apex Data loader tool.

Thanks and regards,
Ambili

  • February 12, 2008
  • Like
  • 0
I'm thrilled to try out the new Force.com Toolkit!  I've survived the install, but unfortunately, I'm unable to successfully create a project.

I did a fresh Eclipse 3.3.1.1 install, followed by a fresh Force.com Toolkit and WST install. 

I then tried to create my first new Force.com project, resulting in this error:

RuntimeException: Failed deployment: UNKNOWN_EXCEPTION msg:UNKNOWN_EXCEPTION: An unexpected error occured. Please include this ErrorId if you contact support: 1019309728-308

I then tried to create a new Force.com project for another SFDC org (this time a sandbox org), and project creation culminated in this error:

RuntimeException: Failed deployment: INVALID_CROSS_REFERENCE_KEY msg:INVALID_CROSS_REFERENCE_KEY: invalid cross reference id

I'm happy to share more details (which SFDC org, etc.) if someone wants to troubleshoot with me further.


I have a simple trigger that creates a tracking record every time the owning group changes (we call this escalation group).  The purpose is to have time tracking similar to how salesforces give you time in status for  service and support cases.  However, the trigger fails with an exception if there are more than 20 records in the new_entries set.   I can work around this, but my solutions  are  seriously kludgy.  Is there a better approach I'm missing?

-Tyler

Here is the code:

trigger recordStatusDates on Case (after update) {

  List<Case_Status_Log__c> new_entries = new List<Case_Status_Log__c>();

  for( integer i = 0; i < Trigger.new.size(); ++i) {

    if (Trigger.old[i].status != Trigger.new[i].status) {
      new_entries.add(Util.buildCaseStatusLog('Status', Trigger.new[i].id, Trigger.old[i].status, Trigger.old[i].status_changed__c, Trigger.new[i].status_changed__c));
    }
    if (Trigger.old[i].escalation_group__c != Trigger.new[i].escalation_group__c) {
      new_entries.add(Util.buildCaseStatusLog('Escalation_group',
          Trigger.new[i].id, Trigger.old[i].escalation_group__c,
          Trigger.old[i].escalation_group_changed__c, Trigger.new[i].escalation_group_changed__c));
    }
  }
  insert new_entries;
}

//Copied from Util
public static Case_Status_Log__c buildCaseStatusLog(String typeOf, Id id, String value, Datetime oldDate, Datetime newDate) {
      Case_Status_Log__c csl = new Case_Status_Log__c();
      csl.case__c = id;
      csl.value__c = value;
      csl.value_type__c = typeOf;
      csl.start_datetime__c = oldDate;
      csl.stop_datetime__c = newDate;
     
      if(oldDate != null && newDate != null) {
        csl.hours_in_state__c = util.hoursBetween(
                                   csl.start_datetime__c,
                                   csl.stop_datetime__c);
      }
      return csl;
  }
I'm new to Salesforce development and have been tasked with a project that everyone thinks is doable, but I can't seem to find the right solution.
 
I'm developing for a third party where leads would be sent to different SF accounts. I will not have the username and password for the different accounts. I will have the SF login email address only. Based on that it seems that the API solution is no longer viable unless I missed something somewhere. I started looking into the Web to Lead. It appears that the OID is the unique value on the form. General SF users will not know how to retrieve this number from the html. I would like to use the SF email address as the key, is there any way to do so?
 
The second hurdle that I've run into are the fields on the Lead form. I would like to create my own format with a custom object and then submit the lead in the custom object format.
 
I'm looking for any assistance on this. With all of the development tools, there's got to be a way to accomplish these things.
 
Thanks in Advance.
Our developers use an opensource source-code control system called Subversion.  In this system when they make changes to code they can refrence a link that would take them in the issue in our old Sharepoint based Helpdesk system.  Now our Dev Manager wants to be able to put a link in Subversion with the Bug number and have it take the developer to that bug in Salesforce. 
 
How can I accomplish this?
 
Any suggestions would be greatly appreciated.
I am trying to do a relationship query for EmailMessages associated with a Case.  However, something seems to be "special" about this relationship.

Normally, I can retrieve related lists like this:

SELECT id, (SELECT CommentBody FROM Case.CaseComments) FROM Case WHERE id = '50050000003DZRB'

However, this approach doesn't seem to work with EmailMessages.  I don't see any related list for EmailMessages in the Enterprise WSDL, but surprisingly, a relatinship does show up in the schema browser Apex Toolkit for Eclipse.  However the relationship looks "funny" there - you can't drill into it like you can with the other Case relationships (it has a blue ball next to it instead of a plus sign), so you can't view the relationship name.  For the sake of trying everything, I experimented with some guesses at the relationship name -

(SELECT id FROM Case.EmailMessages)
(SELECT id FROM Case.CaseEmailMessages)
(SELECT id FROM Case.Emails)
(SELECT id FROM Case.CaseEmails)

None of these worked.  But it feels like this should be doable - the EmailMessage object has a "ParentID" field that points back to the Case, so I can always do a separate SOQL query on EmailMessage.  But I'd hoped to use a relationship query here, for various reasons.

Can anyone explain the apparently "special" relationship from Case to EmailMessage?