When reading emails via IFS Connect Mail Reader each attachment in the mail is suppose to be read as separate application messages. But this only seems work when the attchements are only Text files such as .txt, .csv and .xml.
When sending binary files such as .pdf, .jpg, those files do not appear as a separate application message and therefore we cannot get hold of those files in order to attach them to a case.
Is this a limitation in Application 10 or am I missing some setting?
Below is the mail I sent with a txt and a jpg attachments.
Then in Application Messages queue there are 3 records created. One for the detail of the email which is in html format. One for the email body. and one for the content of the .txt file. But no application message is created for the .jpg file.
Thanks and Cheers!
Page 1 / 1
So I managed xto solve this by creating a custom mail reader in IFS connect. A mail reader is written with java and connected that as a new Connect reader. The java code is written in such a way that it reads the email and convert it into one json file that has all the attachments with its binary data converted to base64 string and saved them in separate json tags. This json file is the one that is attached to the applcaiton message then. Then I just created a routing rule that will read this Json file and using a PLSQLblock read a method that will convert the base64 string back into binary data and attach that file into DOCMAN.
So now when some customer send a mail to a given email it will automatically create a case in Call Center and attach all the .pdf files that are sent in that email. Will update more details about the correction soon.
First you must create the ‘ConnectConfigCustomDef.ins file which contains the necessary configurations for the new custom reader that you are developing. You can simply export the configurations of an existing mail reader and add those same configuration properties to the file that you are creating, BUT in addition add the ‘FACTORY_CLASS’ property.
The ‘FACTORY_CLASS‘ parameter has to be read-only, i.e. with write_protected_ => '1'. It should be the first parameter of your Reader definition, i.e. with ordinal_ => '101'. Define fully qualified class name of your factory class as parameters default value, e.g. default_value_ => 'ifs.fndint.connectsender.MyConnectSenderFactory'.
This factory class is one of the java files that you will create later in the step 3 below. Keep it as blank for now and fill it in once you know the java class name after step 3.
Refer the example source code given at the end of the above link.
Remember to create the 2 build.xml files (if you are following the same folder structure) as explained in the technical documentation. One in the Java project folder and the other in the Component\Source\Component folder which is referring the ant compiler to the build.xml in the java project folder.
I created a new connect reader in a new component called ‘CMOD’.
Refer the source code of the existing mail reader which can be found in \fndbas\source\fndbas\framework\fndcn\connect_framework\src\ifs\fnd\connect\readers
Basically there are 3 java files that needs to be created
CustomMailReaderConfig.java and 2. CustomMailReaderFactory.java – Create these just as its explained in the connect reader help in the link above.
3. CustomMailReader.java – Create this as it is done in MailConnectReader.java in Fndbas. At first I just copied the same code as in \fndbas\source\fndbas\framework\fndcn\connect_framework\src\ifs\fnd\connect\readers\ MailConnectReader.java and created an exact copy to make sure that it works correctly.
Once everything is compiling without issues you MUST run the ant compiler in the IFS build process In order to get this into IFS application and test it in the application. This is because the .class files that are generated must go into the ifsapp-int.ear file.
“The framework has to have access to custom readers and senders located outside the IFS Connect JAR file, Therefore the custom readers and senders have to be (implemented as POJO classes) packed to JAR files available for the entire Enterprise Application, i.e. located in the lib folder of the actual EAR file (ifsapp-int.ear).
The EAR file is packed by the IFS Applications build process therefore the JAR files with custom readers and servers have to be copied to the server/dist/int/lib folder prior to packaging the EAR file.”
This packaging is done by the build, by referring the attributes written in the build.xml file.
Once this is built you can modify the ConnectConfigCustomDef.ins with the correct value for the ‘FACTORY_CLASS’ and deploy that in the database.
Once that is done you can create a new Connector Reader by right clicking on Connector Readers > New
Then enabled this new mail reader and disable the existing one.
Send an email to the host email address and see if its working. Check in the integration server log files to see if there are any errors.
If everything is working fine then you can freely modify the mail reader logic that you have in your java file.
You have to modify the nativeLoop() method to match your requirement.
Here each attachment is stored in an array where there is FileContent and FileName attributes.
So now the Application message that gets created is going to have a .json file as an Message Input Data. Now all you have to do is write a new RoutingAddress to process this data and extract the data from the .json file.
A plsql procedure is written to process this data and create a new Call Center Case depending on the sender email address, Subject and certain content in the email body.
The attachments are then inserted as Docman objects and attached to the Call center case.
PROCEDURE Attach_Files_To_Case___( case_id_ IN VARCHAR2, file_name_ IN VARCHAR2, file_content_ IN CLOB) IS file_data_ BLOB; : BEGIN file_data_ := decode_base64___(file_content_); --Create Doc Title Rev doc_rev_ := Doc_Class_Default_API.Get_Default_Value_( doc_class_ ,'DocTitle','DOC_REV'); doc_sheet_ := Doc_Class_Default_API.Get_Default_Value_( doc_class_ ,'DocTitle','DOC_SHEET'); Client_SYS.Clear_Attr(attr_); Client_SYS.Clear_Attr(title_attr_); Client_SYS.Add_To_Attr('DOC_CLASS', doc_class_, attr_); Client_SYS.Add_To_Attr('DOC_SHEET', doc_sheet_, attr_); Client_SYS.Add_To_Attr('DOC_REV', doc_rev_, attr_); Client_SYS.Add_To_Attr('TITLE', file_name_, title_attr_); Client_SYS.Add_To_Attr('STRUCTURE', 0, title_attr_);