Friday, September 30, 2016

Send multiple attachments in one mail streamserve

Background

I have a MOM report (PPS601) in which I generate PO data as a CSV apart from the standard PDF layout. So in order to do that I use StreamOut process type in Stream Server.

clip_image001_thumb[1][1]

Since my client wants output as a MAIL I used default mail connector to send the PDF layout and created a new connector copying the default mail connector to send CSV with TXT driver since PDF driver not support the CSV files.

clip_image003_thumb[2]

Problem

But the problem is that CSV and PDF are sent in a two separate mails as single attachments. But my requirement is to have two files in one mail thread as two attachments.

clip_image004_thumb[1]

Solution

Solution is to use attachment connector to send CSV file and attach attachment connector to the mail connector .

Step 1:

Create Attachment connector:

clip_image006_thumb[1]

clip_image008_thumb[1]

For attachment connector no need to specify the driver settings. In order to see the setting panel in attachment connector need to the switch to the generic platform view. In physical platform level attachment connector settings can’t be seen.

Step 2:

Go to the Mail Connector settings relevant runtime and click edit mail

clip_image009_thumb[1]

Step 3

In Edit Mail window click the attachment Icon.

clip_image011_thumb[1]

Then below window will appeared.

clip_image012_thumb[1]

Step 4:

In that popup change the attachment type to “Output from attachment connector” and give the attachment name for attachment connector. (Attachment connector which was created in platform previously).

Give attachment name(name for the CSV attachment )  to the “Attachment name” text box (even possible to use a variable)

clip_image013_thumb[1]

Step 5:

Now make CSV process delivery media as the attachment connector that was created previously. To change the delivery media dynamically I used below code snipped in before process event. There is a nice article with detail explanation about changing delivery media in the StreamShare forum by Andreas Hjelle. Please read it.

http://streamshare.streamserve.com/Articles/Article/?articleId=325

$que = "ATTA";
callproc("CSVO");

Now all good , export the project.

Output

clip_image015_thumb[1]

You can see two attachment were attached in to one email.

Useful links

· http://streamshare.streamserve.com/Forum/Topic/?topicID=9731

· http://streamshare.streamserve.com/Forum/Topic/?topicID=7482

· http://streamshare.streamserve.com/Articles/Article/?articleId=325

Wednesday, July 27, 2016

MEC repository functions

Repository Functions are reusable Java and Boolean functions stored in Function Repository that is part of a Mapper database. Usage of repository function in MEC reduce the development time and increases the reusability.

For an example we can write a java function to send emails and add it to the mapper database as repository function. Then that function can be used in every maps those are in same mapper database.

Create repository function.

Step 1: First create your java or Boolean function.

image

Step 2: right click on function and press add to repository.

clip_image003

Step 3:

Select the location(MEC mapper database) where, repository function need be saved and click finish.

clip_image004

Now you repository function has been successfully added to mapper database and it ready to use.

Use repository functions:

Step 1:

From the Palette tab, select the Repository function element. Drag and drop it to the space between the input and output document trees. After that new reusable function window is displayed.

Select the Mapper Database location to use.

clip_image005

Step 2: Select a reusable function.

clip_image006

Once you clicked the finish the selected function is inserted to the mapping

Thursday, July 14, 2016

MEC :add values to the manifest file .

For some MEC developments we need to add some usefull information to the MEC manifest file. Then you can use below function.

setManifestInfo("map:myvalue", “test”);

After execution of this function test will be added to the MEC manifest table under map:myvalue key .

Tuesday, July 12, 2016

MEC : Use External jar files in old MEC mapper

Even though this is very straight forward I thought its worth to share with all because it can save time when it need to used external Jar files inside the  old MEC mapper. In new MEC mapper we can do this easily but old MEC mapper we can’t do it directly (Old mapper is Windows based version and if you interested about old MEC mapper my colleague has written overview about it http://warnajith.blogspot.com/2016/06/development-with-mec-older-version.html.). In this case we need to copy external jar files to MEC server manually.

There two places to copy Jar files in MEC server. If there are multiple MEC environments, jar files needs to be copied each environment as well.

· ~\MecMapGen\lib folder

· ~\MECServer\lib folder

MecMapGen and MECServer folders are located inside MEC installation folder.

Please remember to restart the MEC environment after copying the file. Otherwise changes will not be reflected.

Tuesday, June 28, 2016

ServiceManger:The “start request” timed out in StreamServe Control Center.

I have enabled document archiving in stream server and so for that have to change the control center running account to some other account. After that all of sudden my all instance were stopped and could not start it back.
clip_image001
After I investigate this deeper and found that newly changed user acoount should be listed under MOM server Administrative users . Once it did it worked fine .Smile

Thursday, May 12, 2016

MEC : How read MEC manifest file in MEC mapper.

There are some senarios where we need to read the MEC manifest file contents . .

Lets say we want to read agreement value from the manifest . then you below method with cmn:agreement .

value =getManifestInfo(“Item”)

getManifestInfo("cmn:agreement") for this result would be EDI_940_OUT.

image

Wednesday, May 11, 2016

MEC Custom properties file .

There are some scenarios where we need to get constant configurable values to the MEC mapper. For example sometime we have to get email addresses, database schema, user name PW like that.

For such a scenario we have few possible options

· Hard Code.

· Read From table

· Read from external text file (referred as java properties file /in .net config file ).

Hard coding is not good option because when change is needed have to modify the map and restart the MEC environment and need to seek help from technical consultant. Reading from table also good option and need to maintain separate table and all.

But reading from external file is very easy and implementation time also short.

Step 1.

Create a text file with the information that you require. In my case I want to add some email address .So my text will be like below.I will name this file as M3Properties.properties. properties will be the ext.

Then copy this file to the MEC central file location . you can keep this file anyware but when it added to the central file location its easy to access file . Other wise we have to hard code the file location .

 

image

Using below java code you can access properties file. Use this code place where you want information from properties .

String centralFileFolder = com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path");

String PropertiesFile = centralFileFolder+"/Properties/M3Interface";
System.out.println(getClass().getName() + "[:] PropertiesFile: '" + PropertiesFile + "'");
cat.info(strUUID + "[:] PropertiesFile: '" + PropertiesFile + "'");


// Read properties file if it exists
boolean propertiesOK = false;
java.util.Properties properties = new java.util.Properties();
try {
properties.load(new java.io.FileInputStream(PropertiesFile + ".properties"));
    propertiesOK = true;
}
catch(java.io.IOException ioe){
      System.out.println("IO Error occurred reading properties file for " + getClass() + ".\n");
      System.out.println("Default values will be used.");
}

// If properties ok then get each one
if(propertiesOK){
    oemailAddress = properties.getProperty("EMAIL.FROM");   
}

com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path") can be used to get MEC central file location path .