Hi all,
We are building a dynamic questionnaire with almost 400 questions. About 2/3 of these questions are hidden, but will display dynamically based on answers of other questions. The general requirement is basically: If the question is displaying on layout, it should become Required when the record is Submitted.
Goal
To accomplish this, I'm trying to build a custom object that will do the heavy lifting. This custom object would, in each Question Section:
- Identify all underlying questions that are not hidden
- Evaluate whether or not the question is empty
- If the question is empty, highlight the Question Name in Red
Purpose
- Maintainability: Given the volume of questions, there is already a massive number of DDEs to govern the show/hide logic. Instead of triplicating the number of DDE rules to handle making the fields required/Read Only, I want the Custom Object to dynamically manage this.
- User Experience: Field-level red asterisks currently do not work with the AWF transition rules. By leveraging the Custom Object, I can ease the burden of finding the handful of questions out of 400 that are missing values by changing the question font to be more noticeable, or providing a summary table of empty questions by section, etc.
Approach
High-level plan for now is:
- Unbind the action from the AWF transition to do the checks below:
- Use each section ID (i.e. "#master_DefaultContent_rts_..." to find its children elements with an attribute of visibleitems="1" or by ignoring descendants with a span class of "hidden". Strip out the Field ID (e.g. 43506) from either the <tr class> value or the <span ID> value and store in an array (i.e. "displayFields[]").
- Use displayFields[] items to iterate/check using getFieldValue() and any blank/empty Field IDs will get stored in another array (i.e. "blankFields[]").
- For each blankFields[] item, set the style property to call out fields needing attention, similar to the approach taken here: Color Section Header Text
- If none of the displayed questions are blank, proceed with the AWF transition.
Questions
- Has anyone created a similar custom object or can tell me how impossible/foolish this is to undertake?
- Is there anything that I could do to simplify this approach? Perhaps any $CM or $LM functions that I am not considering?
I have done custom object work before, but nothing of this magnitude, so would appreciate any feedback/suggestions. Thanks!