Table level script issue with Opportunity and Workflow

Need assistance please!

I am having trouble getting a table level script to fire if the opportunity is updated through workflow.  If the opportunity is updated with the change button, the script fires without any issues.  I am hoping that someone might be able to tell me what I am doing wrong.  I have tried it two different ways.  The script sends an email to a list of individuals maintained in a custom table.

Here is what I tried first...I am placing the function in the UpdateRecord() area of the TLS.  In general, I know the function works as it fires when the opportunity is updated with the "Change" button (outside of workflow) if the stage is Won and the emails has not been sent.

I cannot determine why it won't fire when the stage is updated with Workflow.

function SendSoldEmail()

{

//Get Oppo
var oppoRecord = CRM.FindRecord('Opportunity',WhereClause);
if ((oppoRecord.oppo_stage == 'Sold') && (!oppoRecord.oppo_soldemailsent))
{

//send email scripts

}

This is my second attempt thinking that the values obtained with the above might be the original db values and not the values being submitted.

var oppoStage = Values("oppo_stage");
var oppoSoldEmail = Values("oppo_soldemailsent");

if ((oppoStage == 'Sold') && (!oppoSoldEmail))
{

//send email scripts

}

What might I be doing wrong??  I need a second set of eyes please!!  :-)

Parents
  • I believe I have resolved my issue.  When clicking the "Sold" workflow value, a screen appears to set the "Closed" date.  It occured to me that this is probably the "screen" that Values() wants to read from.  Therefore, I added the Stage and Email sent fields to the screen (previously the Stage field was there just "hidden".)

    I then tried the "Sold" button from workflow and the email sent!!  Yeah!!!

    Hope this helps someone else trying to figure out why their TLS won't fire through workflow.

Reply
  • I believe I have resolved my issue.  When clicking the "Sold" workflow value, a screen appears to set the "Closed" date.  It occured to me that this is probably the "screen" that Values() wants to read from.  Therefore, I added the Stage and Email sent fields to the screen (previously the Stage field was there just "hidden".)

    I then tried the "Sold" button from workflow and the email sent!!  Yeah!!!

    Hope this helps someone else trying to figure out why their TLS won't fire through workflow.

Children
No Data