If this paragraph is selected, include this other one

A colleague asked me an interesting question the other day as he was building another solution with the CM Aug 20 PDK: "How do I make sure this paragraph is included in my letter only if the user selects this other paragraph?"

The answer is quite simple, actually: Assuming the "other" paragraph is optional, just make the dependent paragraph conditional (by including the cmConditionalContent object in its CM Content subform) and set its condition to evaluate to "true" when the "other" paragraph’s cmOptionalContent object is checked (it’s a check box).

For example, if the "other" paragraph is sitting in a CM Content subform named "TheOtherParagraph", the condition script would look like this:

cmUtils.ConditionalContentInclusion(this, this.parent.parent.TheOtherParagraph.cmOptionalContent, "==", 1);

To make it work in your letter template, you should just need to replace "TheOtherParagraph" with the name of your CM Content subform.

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 0.0/10 (0 votes cast)
This entry was posted in ADEP. Bookmark the permalink.

Comments are closed.