Workload Automation1

Expand all | Collapse all

Varying Email Addresses based on Submission Count

Jump to Best Answer
  • 1.  Varying Email Addresses based on Submission Count

    Posted 04-06-2018 03:04 PM

    I'm having trouble getting this to work. I am looking to email 1 email address on the first submission count but then each submission count after that, it should go to a different email address. I've been playing around with the logic below but can't get things to work. The first email address continues to get the email regardless of how many times the jobs has been submitted. I've put WOB.email in the email notification so when i run the job for the first time, it resolves to the first address. Even after resetting the email notification to WOB.email then resubmitting, it still goes to the first address

     

    if (WOB._subcount = 1)
    WOB.email = 'adress1';
    else WOB.email = 'address2';



  • 2.  Re: Varying Email Addresses based on Submission Count

    Posted 04-09-2018 01:06 AM

    Hi,

     

    Looking at it , I think the problem is with comparison , i think it should have double equal to sign (==). Please check if that helps! Here you are assigning value rather than comparing.

     

    Ravi Kiran



  • 3.  Re: Varying Email Addresses based on Submission Count
    Best Answer

    Posted 04-09-2018 09:53 AM

    I guess you coded this javascript in the job under the 'Javascripts' section 'At run time', however, it does not seem DE  executes defined scripts on the job submissions, and so you are getting only first value assigned, and then it continues with it. Not sure if it is feasible to accomplish what you want.



  • 4.  Re: Varying Email Addresses based on Submission Count

    Posted 04-13-2018 04:38 PM

    I believe this is the case:

    When you code javascript to execute "At run time" DE will trigger the javascript when the job is in Ready status, just prior to Exec status.  When you resubmit a job it does not again go into ready status but goes straight to Exec.

     

    You could put the javascript in an Alert and have that determine the submission count and who should be notified.  I'm not sure that the Alert would execute prior to the email being sent, allowing you to set a variable to be used by the email.  You could always use the Alert to choose the email and pass that to a separate application as a parameter, using that application to send the email.