
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2018 01:06 AM
We tried to use sn record picker to allow users to close a change request. So we presented them 2 fields to populate when they try to close the change request:
- Close Code
- Close Notes
Problem is when they submit, nothing is being written for close_code on the change_request record, only the close_notes. Here's the relevant code from our widget:
HTML
<div class="row">
<span class="fa fa-asterisk mandatory" ng-class="{'mandatory-filled': field.mandatory_filled()}" style="padding-right: .25em" aria-label="Mandatory " aria-hidden="false"></span>
<label class="field-label" for="close_code">${Close Code}</label>
<sn-record-picker field="close_code" table="'sys_choice'" placeholder="${Select a close code}" display-field="'label'" value-field="'value'" default-query="'name=change_request^element=close_code^inactive=false'"></sn-record-picker>
<input class="form-control" ng-model="c.data.closecode" type="hidden" />
</div>
<br/>
<div class="row">
<span class="fa fa-asterisk mandatory" ng-class="{'mandatory-filled': field.mandatory_filled()}" style="padding-right: .25em" aria-label="Mandatory " aria-hidden="false"></span>
<label class="field-label" for="close_code">${Close Notes}</label>
<textarea class="form-control" ng-model="c.data.closenotes"></textarea>
</div>
<button class="btn btn-primary" ng-click="c.uiAction('close')">${Submit}</button>
Client Script
if(action == 'close'){
// Close the Change Request
if(c.data.closenotes == undefined || c.data.closecode == '') {
(alert("Please fill-out mandatory fields"));
return;
}
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
})
}
Server Script
if (action == 'close' && gr.active == true && gr.state != 4) {
gr.setValue('state', '3');
gr.setValue('close_code', input.closecode);
gr.setValue('close_notes', input.closenotes);
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 02:11 AM
Hi JC,
I observed that you are accessing the closecode.
but in the html there is nothing getting passed on it form the SN-RECORD-PICKER.
I added following in the sn record picker and accessed it.
<sn-record-picker field="c.data.close_code" table="'sys_choice'" placeholder="${Select a close code}" display-field="'label'" value-field="'value'" default-query="'name=change_request^element=close_code^inactive=false'"></sn-record-picker>
input.close_code.value.
Check if this helps.
Best Regards,
Harshad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2018 05:04 AM
can you check if there is any data coming up in input.closecode?
may be add a gs.addInfoMessage to debug it?
thanks
Harshad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 01:42 AM
Confirmed that nothing was being passed by input.closecode. Any ideas on where we went wrong on our code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 02:11 AM
Hi JC,
I observed that you are accessing the closecode.
but in the html there is nothing getting passed on it form the SN-RECORD-PICKER.
I added following in the sn record picker and accessed it.
<sn-record-picker field="c.data.close_code" table="'sys_choice'" placeholder="${Select a close code}" display-field="'label'" value-field="'value'" default-query="'name=change_request^element=close_code^inactive=false'"></sn-record-picker>
input.close_code.value.
Check if this helps.
Best Regards,
Harshad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 03:00 AM
Awesome! Thanks for this.