• mikeegar
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies

Hi Folks,

It should be possible to default the related object and recipient fields using email URL parameters e.g. open up the standard email page with an email template using merge fields from a custom object and a lead as a recipient. This does not appear to work. It does work for contacts however.

With a custom object and a lead recipient, this does not work:
https://na15.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=<Custom ObjectId>&p2_lkid=<Lead Id>&rtype=00Q

Using the same syntax and a contact recipient, this does work:
https://na15.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=<Custom ObjectId>&p2_lkid=<Contact Id>&rtype=003

Is this a known bug?

 

I know there are a million posts about email URL hacking out there. I've read most of them at this point.

Thanks,
Mike

 

Hi,
    I thought I saw a post recently that it would be possible to store custom settings in Salesforce and access them through APEX. I don't see anything in Summer '08. Is this on the way?
 
Thanks,
Mike
Hi Guys,

I have a problem that has me a little stumped. I have a few triggers in my sandbox some written by me some written by another developer. On their own they work fine but they are dependant on each other in that one creates records that the other triggers off of so when they are made active I start to get some funny results and anusual errors popping every now and then.

Here's just one of the errors I'm receiving.

(1)
paymentAA: execution of AfterUpdate

caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE
_ENTITY, invoiceAction: execution of AfterInsert

caused by: System.ListException: Duplicate id in list: a0aT00000009RIzIAM

Class.InvoiceAction.updateInvo
iceAmount: line 54, column 9
Trigger.invoiceAction: line 4, column 9

Class.PaymentAA.CreateInvoice: line 65, column 12
Class.PaymentAA.CreatePayment: line 29, column 13
Trigger.paymentAA: line 2, column 4

And below are the lines of code referenced by this error well the main 'perpetraitors' as I see it

One important note to mention is that this code gives seems to only give me errors when I have more than 1 Invoice_Item__c in the list to insert. When there is just one it works fine but when there is 2 or more it seems as though it crashes I'm guessing because it calles the trigger on invoice_item__c twice too quickly? Before both records are committed? I'm not sure but any help would be great. Thanks in advance.

Code:
FROM PaymentAA

...
// define a new invoice 
           Emp_Invoice__c newinvoice = new Emp_Invoice__c();
           
           // update the value of the account it relates to to the same as the sales prospect
           newinvoice.Account__c = spAcc;
           
           // relate to sales prospect
           newinvoice.Sales_Prospect__c = spID;
           
           // sets the date on the invoice
           newinvoice.Invoice_Date__c = date.today();
                      
           // commits the new invoice to database
           insert newinvoice;

           // returns a list of all the order items associated with sales prospect
           List<Order_Item__c> orderitems = [select Name, Order_Line_Total__c from Order_Item__c where Sales_Prospect__c = :spID];
           List<Invoice_Item__c> ii = new List<Invoice_Item__c>();
           // iterate over all the line items in the order
           for (Order_Item__c oi : orderitems) {
               // create a new invoice item corresponding to each order item with the same values
               ii.add(new Invoice_Item__c(Invoice__c = newinvoice.Id, Order_Item__c = oi.Id, Line_Total_ex_GST__c = oi.Order_Line_Total__c));
           }
           insert ii;
...



AND THE WHOLE Class.InvoiceAction This Triggers from "Invoice_Item__c" after insert / after update 

public class InvoiceAction { public static void updateInvoiceAmount(Invoice_Item__c[] newInvItems) { //array of invoices that have a new amount paid List<Emp_Invoice__c> myInvoices = new List<Emp_Invoice__c>(); //iterate over all the new invoice items in this batch for (Invoice_Item__c thisInvItem:newInvItems ) { //ingnore invoice items with out an invoice if (thisInvItem.Invoice__c != null){ //get all invoice items for this invoice List<Invoice_Item__c> allInvItems = [SELECT Id, Line_Total_ex_GST__c, GST_Amount__c, Amount_Paid__c FROM Invoice_Item__c WHERE Invoice__c = :thisInvItem.Invoice__c limit 1000]; // get the invoice for this invoice item and lock it Emp_Invoice__c thisInvoice = [SELECT Id, Amount_ex_GST__c, GST_Amount__c, Amount_Paid__c FROM Emp_Invoice__c WHERE Id = :thisInvItem.Invoice__c limit 1 for update]; decimal sumApPaid = 0.0; decimal sumLtPaid = 0.0; decimal sumGstPaid = 0.0; // sum up all the invoice items for this invoice for (Invoice_Item__c cInvItem:allInvItems ) { if(cInvItem.Amount_Paid__c != null){ sumApPaid += cInvItem.Amount_Paid__c; } if(cInvItem.Line_Total_ex_GST__c != null){ sumLtPaid += cInvItem.Line_Total_ex_GST__c; } if(cInvItem.GST_Amount__c != null){ sumGstPaid += cInvItem.GST_Amount__c; } } // update the amuount paid for this invoice thisInvoice.Amount_Paid__c = sumApPaid; thisInvoice.Amount_ex_GST__c = sumLtPaid; thisInvoice.GST_Amount__c = sumGstPaid; // add this invoice to the array of invoices that have a new amount paid System.debug('[InvoiceAction -> executeTriggerAfter] adding amount paid=' + thisInvoice.Amount_Paid__c + ' to invoice id=' +thisInvoice.id); myInvoices.add(thisInvoice); } } //update all invoices that have a new amount paid update myInvoices; } }

 




Message Edited by patske on 06-19-2008 03:40 PM

Message Edited by patske on 06-19-2008 03:44 PM
Hey,
 
There may be similar threads on this topic, but here goes anyway:
 
>>>>
YES:  SEE RECENT POST
WHICH IS THE EXACT SAME THING, OR NEARLY SO
<<<<
 
We have an org from which we're sourcing a managed package, and I'm trying to connect to it using the new Force.com Eclipse plug-in (v. 11.1.1).  The SOAP Endpoint is v. 11.1 as well.  What I get when connecting, and also when trying to 'refresh from server', or 'synchronize with server', is a msg box with the following error:
 
Unable to perform synchronization.
 
Reason:
TeamException: null: Duplicate retrieve names specified for package '<pkg name>'
 
I see a stack trace in my workspace log; if anybody wants to see it, I'd be happy to add it to this thread.
 
Does anybody have some insight into this, and what I can do about it, or how I can work around it?  Let's say for the sake of discussion that I do NOT want to re-create my org from scratch.  :^}
 
Thanks!
 
-phil m.


Message Edited by philbo on 01-14-2008 10:19 AM
I am trying to copy an attachment from one account to the other in Apex Code and receive the following compilation error: "Data type not supported".

I highlighted the line of code that generated the error. It lookslike Apex Code does not support the .Body datatype. Is there anyway to insert an Attachment in Apex?

Here is the snippet of my code:

Code:
for (Attachment attachmentSource : [Select Body, ContentType, IsPrivate, Name from Attachment where ParentId = :a.Clone_From_ID__c])
{
Attachment attachmentTarget = new Attachment();


attachmentTarget.ParentId = a.Id;
attachmentTarget.OwnerId = a.OwnerId; //assign same owner as parent account

attachmentTarget.Body = attachmentSource.Body;
attachmentTarget.ContentType = attachmentSource.ContentType;
attachmentTarget.IsPrivate = attachmentSource.IsPrivate;
attachmentTarget.Name = attachmentSource.Name;

insert(attachmentTarget);
}