This topic contains 2 replies, has 0 voices, and was last updated by JohnCCole 6 years, 6 months ago.

  • Author
    Posts
  • #21282 Score: 0

    JocelynM
    • Contributions: 0
    • Level 1

    Hi everyone,

    I have a scheduled script to send notices to clients when their due dates on invoices are coming up. This script executes successfully via the debugger, but upon validating functionality I did notice that the record of the email sent is not attached to the invoice or client record. Below is a snip that contains the merge function and setting a custom field value on the transaction record. Can someone tell me how to get the sent email to show up in the communication tab of the transaction or client record?

    var emailMerger = nlapiCreateEmailMerger('123');

    emailMerger.setEntity('customer', customerID);

    emailMerger.setTransaction(internalID);

    var mergeResult = emailMerger.merge();

    var emailSubject = mergeResult.getSubject();

    var emailBody = mergeResult.getBody();

    nlapiSendEmail(fromID, email, emailSubject, emailBody);

    nlapiSubmitField('invoice', tranid, 'custbody_processed', 'T');

    Thanks!!!
    This is a cached copy. Click here to see the original post.

  • #21283 Score: 0

    leacelosacolumna
    • Contributions: 0
    • Level 1

    Your syntax looks correct but not sure about the values. Where are you getting the value of internalID variable? What is its difference between the tranid variable? Where is the email record getting saved?

  • #21284 Score: 0

    JohnCCole
    • Contributions: 0
    • Level 1

    I don't know about the merge function but nlapiSendEmail has a parameter for attaching to records. For example you call should be

    Code:
    nlapiSendEmail(fromID, email, emailSubject, emailBody,null,null,{transaction:'internalidofinvoice',entity:'internalidofcustomer'});

You must be logged in to reply to this topic.