“We learn from failure, not from success!”
— Bram Stoker
A while back I was working on my Collaboration Store project when I discovered a problem with the SNH Form Fields when running on my Tokyo instance. At the time, I was not able to diagnose the source of the problem, but I did manage to come up with a work-around, which I implemented on the page that I was developing at the time. What I did not do was to go back and refactor all of the other widgets that utilize the snh-form-field tag to implement the work-around on those as well, nor did I invest any time in actually hunting down the source of the actual problem with the tag, correcting it, and producing a new version.
Recently, I was working on my little Service Account Management app, and was rudely reminded of this unfortunate oversight. Initially, I thought that there was something wrong with my modal pop-up box, but after further review I realized this was the same snh-form-field issue that I had run into earlier on the other project. Clearly, it was long since time to address it.
To implement the work-around, I brought up a list of all of the Service Portal widgets that contained the text ‘snh-form-field’ in the Body HTML template property. Then one by one, I pulled them up in the editor, searched for the tag, and then wrapped a SPAN around each one, mitigating the problem. For example, here is the original HTML for the Aggregate Column Editor widget:
<div>
<form name="form1">
<snh-form-field
snh-model="c.widget.options.shared.label"
snh-name="label"
snh-required="true"/>
<snh-form-field
snh-model="c.widget.options.shared.name"
snh-name="the_name"
snh-label="Name"
snh-required="true"/>
<snh-form-field
snh-model="c.widget.options.shared.heading"
snh-name="heading"/>
<snh-form-field
snh-model="c.widget.options.shared.table"
snh-name="table"
snh-type="reference"
snh-change="buildFieldFilter();"
snh-required="true"
placeholder="Choose a Table"
table="'sys_db_object'"
display-field="'label'"
display-fields="'name'"
value-field="'name'"
search-fields="'name,label'"/>
<snh-form-field
snh-model="c.widget.options.shared.field"
snh-name="field"
snh-type="reference"
snh-required="true"
placeholder="Choose a Field"
table="'sys_dictionary'"
display-field="'column_label'"
display-fields="'element,reference'"
value-field="'element'"
search-fields="'column_label,element'"
default-query="c.data.fieldFilter"/>
<snh-form-field
snh-model="c.widget.options.shared.filter"
snh-name="filter"/>
<snh-form-field
snh-model="c.widget.options.shared.source"
snh-name="source"/>
<snh-form-field
snh-model="c.widget.options.shared.hint"
snh-name="hint"/>
<snh-form-field
snh-type="reference"
snh-model="c.widget.options.shared.page_id"
snh-name="page_id"
placeholder="Choose a Portal Page"
table="'sp_page'"
display-field="'title'"
display-fields="'id'"
value-field="'id'"
search-fields="'id,title'"/>
</form>
<div style="width: 100%; padding: 5px 50px; text-align: right;">
<button ng-click="cancel()" class="btn btn-default ng-binding ng-scope" role="button" title="Click here to cancel this edit">Cancel</button>
<button ng-click="save()" class="btn btn-primary ng-binding ng-scope" role="button" title="Click here to save your changes">Save</button>
</div>
</div>
… and here is the updated HTML with the work-around implemented:
<div>
<form name="form1">
<span>
<snh-form-field
snh-model="c.widget.options.shared.label"
snh-name="label"
snh-required="true"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.name"
snh-name="the_name"
snh-label="Name"
snh-required="true"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.heading"
snh-name="heading"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.table"
snh-name="table"
snh-type="reference"
snh-change="buildFieldFilter();"
snh-required="true"
placeholder="Choose a Table"
table="'sys_db_object'"
display-field="'label'"
display-fields="'name'"
value-field="'name'"
search-fields="'name,label'"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.field"
snh-name="field"
snh-type="reference"
snh-required="true"
placeholder="Choose a Field"
table="'sys_dictionary'"
display-field="'column_label'"
display-fields="'element,reference'"
value-field="'element'"
search-fields="'column_label,element'"
default-query="c.data.fieldFilter"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.filter"
snh-name="filter"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.source"
snh-name="source"/>
</span>
<span>
<snh-form-field
snh-model="c.widget.options.shared.hint"
snh-name="hint"/>
</span>
<span>
<snh-form-field
snh-type="reference"
snh-model="c.widget.options.shared.page_id"
snh-name="page_id"
placeholder="Choose a Portal Page"
table="'sp_page'"
display-field="'title'"
display-fields="'id'"
value-field="'id'"
search-fields="'id,title'"/>
</span>
</form>
<div style="width: 100%; padding: 5px 50px; text-align: right;">
<button ng-click="cancel()" class="btn btn-default ng-binding ng-scope" role="button" title="Click here to cancel this edit">Cancel</button>
<button ng-click="save()" class="btn btn-primary ng-binding ng-scope" role="button" title="Click here to save your changes">Save</button>
</div>
</div>
It was not difficult work, but it was rather tedious. Eventually, I got through the entire list. Then I put together a new Update Set for the SNH Data Table Widgets and posted the new version (2.4) out on Share. Unfortunately, it wasn’t until I had already posted it out there that I realized that I had left out a critical widget in the build, so I had to build the Update Set a second time. It did not look like there was any way to replace the Update Set on Share for the 2.4 version, so I called the corrected Update Set 2.4.1. But that is not a legal version name on that site, so on Share, that version is known as 2.41. Anyway, it’s out there now, so if you are running, or planning to run, on Tokyo or Utah, you should definitely go out to Share and pull down the latest Update Set. But stay away from version 2.4, because that was just an error, and shouldn’t even be out there.
Oh, and if you run into any issues with the 2.4.1 version, please provide some details in the discussion section on Share, or in the comments below. Thanks!