Run formulas on Notes from .Net assembly

When you intergrate Domino Lotus Notes with any external system, it's a bit of COM interop coding effort you have to go thru. Same is the case, even if you are using BizTalk Server. There is no adaptor commercially available which does the job what you are looking to do.

Here is my five cents on how to execulte formulas on a Lotus Notes Document from a .net assembly using interop dlls.

I am using BizTalk to integrate SAP with Notes. As we know SAP integration at Send and Recieve ends of BizTalk is quite straight forward until you want to let SAP have control on this. When you want SAP to have control on this, the only option is to let SAP drop the required files or access required files from an FTP or File location. You can possibly use XML or Flat file files to represent data that SAP can use. Well, I'm losing the topic here.

Coming back to Notes integration at the othe end of the BizTalk needs custome .net component or if you have a world of time to deal with Custom Adaptors, you can opt it.

In the .net component you build, right after you do the Document field append(nDoc.AppendItemValue("AccountingDate", "20022009");) or Replace (nDoc.ReplaceItemValue("Form", "Invoice");), In other words Create or Update, you gotta save the document.

if (!nDoc.Save(true, false, false)) throw new Exception(@"Failed to Update Portal Invoice with Invoice Number: " + invoiceNumber);

A call to ComputeWithForm has to be fired right before the Save for the formula execution on this document.

if (!nDoc.ComputeWithForm(false, false)) throw new Exception(@"Failed to execute formulas for Portal Invoice with Invoice Number: " + invoiceNumber);

More on this method at

Happy Coding!

Coming up in the BizTalk series : Port failure Notifications from BizTalk without using MOM!