A DBXL solution that is designed to be generic needs to be able to access several DBXL properties. For example, a solution that wants to display a hyperlink in an e-mail needs to be able to determine its DocId and the DBXL URL.
While it's easy to write code to retrieve this data, it is often not desirable to do so. For instance, browser-based solutions are much harder to deploy when they contain code.
This blog post describes a way of getting this information using only rules. Here is what you need to do.
- To get the DBXL Document ID, add a DocID field to your data source and set it on load via this rule:
substring-before(substring-after(/processing-instruction()[local-name(.) = "QdabraDBXL"], 'docid="'), '"')
Note that this value will not be set for a new document.
- To get the DBXL URL, add a url field to your data source and set it on load via this rule:
substring-before(substring-after(/processing-instruction()[local-name(.) = "mso-infoPathSolution"], 'href="'), "/Forms")
- Finally, to get the DBXL document type, add a DocType field to your data source and set it on load via this rule:
substring-before(substring-after(/processing-instruction()[local-name(.) = "mso-infoPathSolution"], concat(<url>, "/Forms/")), "/template.xsn")
Note how the last rule builds on the URL value we've gotten previously. You’ll need to replace <url> with the xpath for the URL saved previously.
It is important to understand that these rules will only work after the InfoPath solution has been published to DBXL.
You can download a full sample here: http://www.infopathdev.com/files/folders/examples/entry41179.aspx
As an alternative, you could use qRules. You can find documentation for qRules by clicking here.