• vitone
  • NEWBIE
  • 10 Points
  • Member since 2012

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

I have a custom clone function that is cloning cases.  It also clones case articles.  There is another custom case articles object that is used for reporting.  The relationship between the standard case articles object and the custom case articles object is the Id field on the standard case articles object to the Article_ID field on the custom case articles field.

 

In the clone method, I am inserting the standard case articles and then inserting the custom case articles. When the cloned case articles are inserted, I have a new ID.  How can I map that to the custom case articles Article_ID field?  I have no way of determining how to map the new cloned case article record ID to the custom case article record?

 

Any help is appreciated.

I have some code that sends out an email. If I run that code from inside salesforce it works fine. However, if I run that code as the public sites user I get the following SendEmailResult error.

 

SendEmail failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

 

However, all the mailing objects ID's (who, what, template and orgwide) are exactly the same when I send it from inside salesforce and from the website so I don't understand how it could be giving an error in one case but not the other.

 

 Here's the code that sends the email:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 

mail.setTemplateId(template);

mail.setwhatId(what);

mail.setTargetObjectId(who);

mail.setSaveAsActivity(true);

mail.setOrgWideEmailAddressId(orgwide);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});

 

for(Messaging.SendEmailResult res : r){

if(res.isSuccess() == false)

System.debug(res.geterrors().get(0).getMessage());

}

 

 Am I misunderstanding the error or is there some other ID field that could be screwing up the email?

 

 

Message Edited by grigri9 on 11-17-2009 09:08 PM