Tuesday, November 25, 2008

Storing config info in BizTalk


There are several ways of storing config info, for example:
  1. Use the .config file of the service (BTSNTSvc.exe.config) - can only be used in single server environment.

  2. SSO database - This is a good option considering data is encrypted before saving. Also, SSO comes with admin and client utilities, which are good graphical applications for managing data.

  3. BRE - This is my favourite option since BizTalk's business rules composer provides an easy-to-use interface to define and modify business policies. You don't need to be a BizTalk expert to make changes in business policies. But, I would agree that it definitely cannot be used for storing sensitive information like connection strings, password etc. BRE can be used for making information, that is not sensitive, configurable. It can be used in numerous scenarios, from configuring email addresses (for SMTP port) to error messages to fixed values (which you would rather keep configurable than hard-coding in your orchestrations, maps, schemas).

    For example, below is a simple business rule that sets the subject and recipients of the email. Note, that this rule will always be executed since the condition is 1=1. This is how we can store configuration information, although, this is not the way it was intended to be used :) One may argue that subject and list of recipients for an email can be configured at the send port too, if it does not change with any conditions, but the example here can be easily modified to make it conditional. 1=1 is just used to demonstrate how we can use BRE for storing any configuration information that is not conditional.













How to change the file name of the SMTP Attachment in BizTalk

To change the file name of the SMTP Attachment in BizTalk:

myMessage(MIME.FileName) = “test.txt”


Adding different icons to an expression box in InfoPath

Firstly, add the icons as resource files:
Tools -> Resource files -> Add
testImage.png

Add the following code to view1.xsl:
<div style="FONT-WEIGHT: normal"> <span class="xdExpressionBox xdDataBindingUI" title="" tabIndex="-1" xd:CtrlId="CTRL799" xd:xctname="ExpressionBox" xd:disableEditing="yes">
<xsl:attribute name="style">FONT-SIZE: x-small; WIDTH: 56px; HEIGHT: 20px;<xsl:choose>
<xsl:when test="@CreatedInState = "1" and @ModifiedFlag = "0" and @DeletedFlag = "0"">DISPLAY: none</xsl:when>
<xsl:when test="@DeletedFlag = "1"">WIDTH: 62px; HEIGHT: 17px; BACKGROUND-IMAGE: url(testImage.png)</xsl:when>
</xsl:choose>
</xsl:attribute>
</span>
</div>

Security Warning in InfoPath

Disable the Internet Explorer security risk dialog box:
· From Internet Explorer, choose Internet Options from the Tools menu.
· On the Security tab of the Internet Options dialog box, select the Local Intranet Web Content Zone and then click Custom Level.
· Locate the Miscellaneous/Access Data Sources Across Domains setting, and then select Enable, as shown in Figure 2.
· Click OK, and then click Yes to the warning dialog box that appears.
· Click OK to close the Internet Options dialog box.

These Internet Explorer security options are per machine settings. If you choose to use this solution as part of deployment, you will need to follow the above steps on each machine that will be using your form.

How to add custom menus in InfoPath form

Add the following code in manifest.xsf

<xsf:menuarea name="msoStructuralEditingContextMenu">
<xsf:button name="TestMenu" caption="Test Menu" xmltoedit="field1" showif="immediate">lt;/xsf:button>
</xsf:menuArea>

A new custom menu "Test Menu" will be added. xmltoedit specifies the field for which this menu must appear.

In FormCode.vb, add the event handler for the menu as follows:
< infopatheventhandler(matchpath:="testmenu",> _
Public Sub TestMenu_OnClick(ByVal e As DocActionEvent)