sp-editable-field usage

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 10:44 AM
I'm new to Service Portal and Angular. The documentation around advanced features provided via the Service Portal are difficult to find documentation on. I'm mimicking the use of sp-editable-field from the User Profile widget. I have my widget loading data and showing the editable popup for a field on the incident table. When I click save though, nothing is being updated. Is there client script that goes along with sp-editable-field to enable the update or is this an issue with the HTML?
<strong class="pad-right">${Short Description}</strong><sp-editable-field editable-by-user="true" table="incident" table-id="selectedIncident.sys_id" field-model="selectedIncident.sysIncidentModel.short_description"></sp-editable-field>
You can see I have set my table to incident. I have an in scope variable called selectedIncident. I know selectedIncident is correct because its values are being loaded into the panel. The popup includes the original value. I change it, click save, and it stays the previous value.
Beyond this specific question about sp-editable-field, is there a set of documentation around all the available "sp-" Angular functionality so that we know what is available and how to use it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 12:23 PM
Hi Aaron,
Below links can be helpful for documentation :
documentation/widget_server_script_apis.md at master · service-portal/documentation · GitHub

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 12:32 PM
This looks pretty awesome, I'll dig in and check it out. Thanks. I'll mark the answer after looking through the content.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 12:45 PM
This is very useful stuff. I haven't yet been able to find sp-editable-field yet. Even if this doesn't answer the main question, it is super handy to have. Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 01:39 PM
Hi Aaron,
Here is the working sample for incident table & short description field, please compare with your script :
HTML :
<sp-editable-field editable-by-user="true" table="incident" table-id="data.incidentSysID" field-model="data.incidentModel.short_description" on-change="titleOnChange" on-submit="titleOnSubmit"></sp-editable-field>
Server Side:
data.incidentSysID = '361baa10db2f3200474ff1351d96196a'; // $sp.getParameter("sys_id");
var incidentGR = new GlideRecord("incident");
data.incidentExists = incidentGR.get(data.incidentSysID);
if (data.incidentExists) {
var incidentForm = $sp.getForm("incident", data.incidentSysID);
data.incidentModel = incidentForm._fields;
}
Client Controller :
function ($scope, spUtil) {
spUtil.recordWatch($scope, "incident", "sys_id=" + $scope.data.incidentSysID);
}
CSS:
.list-group-item {
border: none;
}
.select2-container.select2-allowclear .select2-choice .select2-chosen {
margin-right: 60px;
}
.mia i {
font-size: 6rem;
}
.mia {
color: #808080;
}