OL Learn

How to trigger an email in workflow based on a record value in the data mapper?

  1. I have a datamapper file.
  2. I have a field called DropCode
    e.g. DropCodes: 111, 222, 333, 444, 555
  3. I need to send an email, that:
    a) lists all the records that do not match those DropCodes listed above.

Is this possible?

Hi Cecile,

I would use a run script as a condition that checks your data field using a Switch Case in whatever language you prefer. After that configure THIS script to send you a email should the condition fail. You can modify your incoming data in the same conditional script and uncomment the MyMsg.AddAttachment in the script I linked to attach the data to the email. You would have to edit the email script to your outgoing email settings.

I would do this for you but I’m a bit busy at work atm. If I find time I can implement it but cannot promise. :slight_smile: Perhaps a OL dev here might have a better more user friendly way.

Regards,

S

select ‘output records in metadata’ or ‘output results in XML data file’. From there use a splitter to split the metadata or xml to separate records and it is just a matter of adding conditions to build the list

How do we read the data (in datamapper) from workflow? for example do we use the same code such as record.fields.DropCode ?

Thank you,

CC

Hi Sharne,

You helped work on this for me previously. You set up a vbscript to get this to work.

It works like a charm, however, we receive an email every day even when there are no letters with generic paragraphs.

Now, we’d like to receive an email ONLY when there is a letter with a generic paragraph.

Thanks,

Cecile

Hi Cecile,

I just ran my original process and I only get an email for data containing generic paragraphs. So I’m wondering if you changed the logic some how. Can you send me your Workflow process and perhaps a better data sample?

Regards,

S

Ahh I see now, I ran a file that had no codes in it and I get an email with a blank file. Is that what you were referring to?

Regards,

S

Yes, that is what I mean! :slight_smile:

thanks!

C

Hi,

The easiest way to do this without changing the scripts or disrupting your current setup is to add a Text Condition just after the Rename plugin that checks if the log file is a zero byte file. Add %z to the String text box, the Operator to “is equal to” and 0 in the “Compare to string” text box. Then add a Delete plugin. Check out the screen grab below.

https://learn.objectiflune.com/qa-blobs/1709397844046027940.jpeg

Regards,

S

Hi S,

A quick question: Why are we putting this text condition before the Run Script, when the point is to find run through the script to find out whether there are generic codes being used or not.

If I put the text condition before the run script, how will it know?

Maybe I’m not understanding how this works?

Thank you for clarifying.

Cecile

This is how it is set up:

Folder Capture

Rename

(Text Condition) —> Delete

Run Script (Dim script to check generic codes in data.)

Send to Folder

Send Email

Hi S,

I moved the text condition to after the run Script and it worked.

Thanks for your help!

Cecile

Hi Cecile,

The script you had seen in the screen grab I attached was not the script that I coded for you. It was the old email script which was set to ignore. (that is why it is grayed out) I should have taken a screen showing the script that creates the log before the Rename plugin. Sorry for the confusion, glad you got it working.

Regards,

S