Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Generated files
This repository contains generated files and a checksum.

**Do not edit the files in this repository outside of an instance of ServiceNow.**

If you find yourself unable to import your repository due to the presence of files edited outside an instance of ServiceNow, merge commits that mix files from different revisions, or other data that does not match the checksum, you may recover using either of the following techniques:
* Remove the problem commits:
1. Clone your repository to a personal computer with the git command line tools installed and open a git command prompt in the repository root
Expand Down
135 changes: 135 additions & 0 deletions author_elective_update/sp_widget_0180dd0c5387d2109cc57ab0a0490ebc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="sp_widget">
<sp_widget action="DELETE">
<category>custom</category>
<client_script><![CDATA[api.controller=function() { /* widget controller */ var c = this;};]]></client_script>
<controller_as>c</controller_as>
<css/>
<data_table>sp_instance</data_table>
<demo_data/>
<description/>
<docs/>
<field_list/>
<has_preview>false</has_preview>
<id>note_list</id>
<internal>false</internal>
<link><![CDATA[function link(scope, element, attrs, controller) { }]]></link>
<name>Note List</name>
<option_schema/>
<public>false</public>
<roles/>
<script><![CDATA[(function() {
//create an array to populate with notes
data.notes = [];
var noteGR = new GlideRecord('x_snc_createnotes_note');
noteGR.addQuery('user', gs.getUser().getID());
noteGR.orderByDesc('sys_created_on');
noteGR.query();
while (noteGR.next()) {
var noteObj = {};
//use service portal helper method to get some display values
$sp.getRecordDisplayValues(noteObj, noteGR, 'number,title,sys_id');
//get the first 20 characters of the description
noteObj.note = noteGR.getValue('note').slice(0,20);
//push the populated obj into the array
data.notes.push(noteObj);
}
})();]]></script>
<servicenow>false</servicenow>
<sys_class_name>sp_widget</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2025-01-07 09:38:59</sys_created_on>
<sys_id>0180dd0c5387d2109cc57ab0a0490ebc</sys_id>
<sys_mod_count>2</sys_mod_count>
<sys_name>Note List</sys_name>
<sys_package display_value="CreateNotes" source="x_snc_createnotes">df5fd9a5090232007f44e1046c8ff69f</sys_package>
<sys_policy/>
<sys_scope display_value="CreateNotes">df5fd9a5090232007f44e1046c8ff69f</sys_scope>
<sys_update_name>sp_widget_0180dd0c5387d2109cc57ab0a0490ebc</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2025-01-07 09:39:44</sys_updated_on>
<template><![CDATA[<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">
${Notes}
</h3>
</div>
<div class="panel-body">
<p>
Notes list widget
</p>
</div>
</div>]]></template>
</sp_widget>
<sys_update_version action="INSERT_OR_UPDATE">
<action>DELETE</action>
<application display_value="CreateNotes">df5fd9a5090232007f44e1046c8ff69f</application>
<file_path/>
<instance_id>316f7d97db71315002d917291396191f</instance_id>
<instance_name>dev186943</instance_name>
<name>sp_widget_0180dd0c5387d2109cc57ab0a0490ebc</name>
<payload>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;record_update table="sp_widget"&gt;&lt;sp_widget action="INSERT_OR_UPDATE"&gt;&lt;category&gt;custom&lt;/category&gt;&lt;client_script&gt;&lt;![CDATA[api.controller=function() { /* widget controller */ var c = this;};]]&gt;&lt;/client_script&gt;&lt;controller_as&gt;c&lt;/controller_as&gt;&lt;css/&gt;&lt;data_table&gt;sp_instance&lt;/data_table&gt;&lt;demo_data/&gt;&lt;description/&gt;&lt;docs/&gt;&lt;field_list/&gt;&lt;has_preview&gt;false&lt;/has_preview&gt;&lt;id&gt;note_list&lt;/id&gt;&lt;internal&gt;false&lt;/internal&gt;&lt;link&gt;&lt;![CDATA[function link(scope, element, attrs, controller) { }]]&gt;&lt;/link&gt;&lt;name&gt;Note List&lt;/name&gt;&lt;option_schema/&gt;&lt;public&gt;false&lt;/public&gt;&lt;roles/&gt;&lt;script&gt;&lt;![CDATA[(function() {
//create an array to populate with notes
data.notes = [];
var noteGR = new GlideRecord('x_snc_createnotes_note');
noteGR.addQuery('user', gs.getUser().getID());
noteGR.orderByDesc('sys_created_on');
noteGR.query();
while (noteGR.next()) {
var noteObj = {};
//use service portal helper method to get some display values
$sp.getRecordDisplayValues(noteObj, noteGR, 'number,title,sys_id');
//get the first 20 characters of the description
noteObj.note = noteGR.getValue('note').slice(0,20);
//push the populated obj into the array
data.notes.push(noteObj);
}
})();]]&gt;&lt;/script&gt;&lt;servicenow&gt;false&lt;/servicenow&gt;&lt;sys_class_name&gt;sp_widget&lt;/sys_class_name&gt;&lt;sys_created_by&gt;admin&lt;/sys_created_by&gt;&lt;sys_created_on&gt;2025-01-07 09:38:59&lt;/sys_created_on&gt;&lt;sys_id&gt;0180dd0c5387d2109cc57ab0a0490ebc&lt;/sys_id&gt;&lt;sys_mod_count&gt;2&lt;/sys_mod_count&gt;&lt;sys_name&gt;Note List&lt;/sys_name&gt;&lt;sys_package display_value="CreateNotes" source="x_snc_createnotes"&gt;df5fd9a5090232007f44e1046c8ff69f&lt;/sys_package&gt;&lt;sys_policy/&gt;&lt;sys_scope display_value="CreateNotes"&gt;df5fd9a5090232007f44e1046c8ff69f&lt;/sys_scope&gt;&lt;sys_update_name&gt;sp_widget_0180dd0c5387d2109cc57ab0a0490ebc&lt;/sys_update_name&gt;&lt;sys_updated_by&gt;admin&lt;/sys_updated_by&gt;&lt;sys_updated_on&gt;2025-01-07 09:39:44&lt;/sys_updated_on&gt;&lt;template&gt;&lt;![CDATA[&lt;div class="panel panel-default"&gt;
&lt;div class="panel-heading clearfix"&gt;
&lt;h3 class="panel-title pull-left"&gt;
${Notes}
&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="panel-body"&gt;
&lt;p&gt;
Notes list widget
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;]]&gt;&lt;/template&gt;&lt;/sp_widget&gt;&lt;/record_update&gt;</payload>
<payload_hash>-1007917679</payload_hash>
<record_name>Note List</record_name>
<reverted_from/>
<source>6257cdcc5347d2109cc57ab0a0490e08</source>
<source_table>sys_update_set</source_table>
<state>previous</state>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2025-01-07 09:39:44</sys_created_on>
<sys_id>80b0554c5387d2109cc57ab0a0490ed1</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_recorded_at>1944022676f0000001</sys_recorded_at>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2025-01-07 09:39:44</sys_updated_on>
<type>Widget</type>
<update_guid>08b0554c5287d210239e2a16ce58ccd0</update_guid>
<update_guid_history>08b0554c5287d210239e2a16ce58ccd0:-1007917679,4c90d14c8687d21021254eb352ff1256:-414694983,0580914c3d87d210c769148f2c83dc44:497020104</update_guid_history>
</sys_update_version>
<sys_metadata_delete action="INSERT_OR_UPDATE">
<sys_audit_delete display_value="Note List">06811d4c5387d2109cc57ab0a0490e3e</sys_audit_delete>
<sys_class_name>sys_metadata_delete</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2025-01-07 09:43:25</sys_created_on>
<sys_db_object display_value="" name="sp_widget">sp_widget</sys_db_object>
<sys_id>14d73c9581964ac085f7589c86e57a04</sys_id>
<sys_metadata>0180dd0c5387d2109cc57ab0a0490ebc</sys_metadata>
<sys_mod_count>0</sys_mod_count>
<sys_name>Note List</sys_name>
<sys_package display_value="CreateNotes" source="x_snc_createnotes">df5fd9a5090232007f44e1046c8ff69f</sys_package>
<sys_parent/>
<sys_policy/>
<sys_scope display_value="CreateNotes">df5fd9a5090232007f44e1046c8ff69f</sys_scope>
<sys_scope_delete display_value="">64daa03572704d49a928bf08a985d6f9</sys_scope_delete>
<sys_update_name>sp_widget_0180dd0c5387d2109cc57ab0a0490ebc</sys_update_name>
<sys_update_version display_value="sp_widget_0180dd0c5387d2109cc57ab0a0490ebc">80b0554c5387d2109cc57ab0a0490ed1</sys_update_version>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2025-01-07 09:43:25</sys_updated_on>
</sys_metadata_delete>
</record_update>
2 changes: 1 addition & 1 deletion checksum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2U7D3lEXSO0bAu13MihfYP_P8Ml90xy8nG72I3u7fnpBTkbyr0i812Y1AkdZb2zC8ZtwN4Yw1qj5Xix0qb9fHv2LWMRgFpbfI1RRdTc69FWEKVZm1_y1_mugkk5DpVfQlnyLViS4hwmN7G2JIvb8yrIgCAX05-8WR24Q_Z4tGLiYYY4sg_zaCCJWk5YGoYnsdGSytoE47H7aUvM7tRNEUyKSFx6LzIG7P6G8m4yNVTgyaQuPcB0XUl1k6LUGUeAmSt_XOub-l_Zq_WyFwtl_akHJIn7v1ooX1zVp6tgBm_GjqOONfdhcHEarnw65bemU7X_K78tZrmpZ3UKvjSf92Xv86q8_0UifW_oKxynZi_yNLWQ0zy7cr6ehXVrvVnmVAFrry9MX9d_I6sFt9q3nIrD2zDSNWeVLCu9iAmi_hTkqMibrz8xkxXnBi7FTTZcY5iHcdf4TDjareP-MxWp_UtCPeRRKu2m0UXRyyqBmPjei38oLFY2MqI0EBum9YuyDZEAYNauHU0JfKLild-hdbhNh5u0N1AmfEWmL_WB8CgQgGS8KrGZDRN05ylulnvPkufCvHdEpOGWk3fhVK1A5EYIzlPNEUkhLhOo_TWiHh7YZQJ9SQXM1pPO_9ziXJ7cUtkln90tN5zpuTWfk6ZgrADXiN2Rh2bOVYHfLfWwy8Q
NzkQKo8ZBKwNkyXVG8oA54YhiMKQ_TTyy4I0ORnpAgzOe5gkPSrhEHGt6gW67bNX0ACthdaNC2pxJOaFTLLbNF4FheAjn4UCWWmB3a6fEN82CfrkAGen6-BKnAWZxUhanMgd5LPRK6LNWQcILn_qKXHcg8NCOqqnJXp44HS_YwYRTPfrPQx1vrI53EF-xjZdi4QU_9nlZj7J-x87qs10IAqLbIqjjpqUVjrC0K-L7CLtwkkJnifxJbYVFz-IDI8eLXdoD4FwH2VDthzlBv-Y9hueqF7suHg-QvspBpEcV7CrHGdIiHHbFc_empoOdd5RyOkfyk2MJ6wyZWSlAtMQMAhjjV5Z6YzA3yBugUU0jajvfrkueJ9yA-22lVYuP2kN414aAL9qP3CXTD3WsaGPITFpQ7vyiesO8W8xH6tEgny5x0tP64kG03tUQmn1IUoteb32ncTyIGJM4yqFP4PgI-8pLqXwcvkz38jLXWoYACo777Qn4_awVY_HsMS134r9URwvs5B4tm2QzlPfIdrFMt5bR1xrwp8Cds7raw0bLDuXaz6_NW7oEDogng-3c9mLdpJu-T5055UKRG9qpP3VTvsTG534kVvt3Uu2fOo4HmuTyVA13Ej3334j_MxgeH9D1BDwAaa8rVq5-XiKOtZX4bMevRXyS59Z1qcIJ1u_5b8
10 changes: 10 additions & 0 deletions sn_source_control.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#############################################################
# This ServiceNow-created file contains the path to the app in this repo
# path=<path to app content in your repo>
# For example, if the app content resides in a folder named x_my_custom_app, the path value would be:
# path=/x_my_custom_app
# Update the path value when you move the app to a new repo location.
############################################################
#
#Tue Jan 07 02:06:31 PST 2025
path=
192 changes: 41 additions & 151 deletions update/sp_widget_06948fa8db3133000613a08a4896194c.xml
Original file line number Diff line number Diff line change
@@ -1,92 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="sp_widget">
<sp_widget action="INSERT_OR_UPDATE">
<category>custom</category>
<client_script><![CDATA[function($rootScope,$scope,spUtil) {
/* widget controller */
var c = this;
// Use a position indicator to know which record to update
c.notePos = 0;

c.selectItem = function(idx) {
// Set the position indicator to the index value passed in on select
c.notePos = idx;
var id = c.data.notes[idx].sys_id;
console.log('Note ID: ' + id);
$rootScope.noteID = id;
$rootScope.$emit('selectNote', id);
}
// Subscribe to event. Set the new title and note values on the
// c.data object
$rootScope.$on('updateTitle', function(event,data) {
c.data.notes[c.notePos].title = data.title;
c.data.notes[c.notePos].note = data.note;
});

c.newNote = function() {
c.server.get({
action: 'newNote'
}).then(function(r) {
c.data.notes.unshift(r.data.newNote);
c.data.noteID = r.data.noteID;
$rootScope.noteID = c.data.noteID;
$rootScope.$emit('selectNote', c.data.noteID);
});
}

$rootScope.$on('deleteNote', function(event,data) {
c.data.notes.splice($scope.notePos, 1);
});

// Record removed from data object on the client and passed to server
c.snNoteUpdate = function(name,sysID){

for (var i=0;i<c.data.notes.length;i++){
if(c.data.notes[i].sys_id == name.data.sys_id){
if(name.data.record.note){
c.data.notes[i].note = name.data.record.note.display_value;
}
if(name.data.record.title){
c.data.notes[i].title = name.data.record.title.display_value;
}
c.server.update();

}
}
}

// Record removed from data object on the server and passed back to client
c.snNoteDelete = function(sysID){

c.server.get({
action: 'snDeleteNote',
noteID: sysID

}).then(function(r){
c.data.notes = r.data.notes;
});

}

spUtil.recordWatch($scope, "x_snc_createnotes_note", "numberANYTHING", function(name) {
console.log(name.data.operation);
console.log(name);
// Calls a Client Script function to do the update and pass the updated data object
// to the server.
if(name.data.operation == "update"){
c.snNoteUpdate(name, name.data.sys_id);
}
// Calls a Client Script function which does the update on the server and passes
// the updated data object back to the client.
if(name.data.operation == "delete"){
c.snNoteDelete(name.data.sys_id);
}
// Fast and easy... replace the client data object with the server data object
if(name.data.operation == "insert"){
c.server.refresh();
}
});
}
]]></client_script>
<client_script><![CDATA[function($rootScope,$scope) {
/* widget controller */
var c = this;
c.selectItem = function(idx) {
var id = c.data.notes[idx].sys_id;
console.log('Note ID: ' + id);
$rootScope.noteID = id;
$rootScope.$emit('selectNote', id);
}
}]]></client_script>
<controller_as>c</controller_as>
<css>h3.panel-title {
font-size:20px;
Expand All @@ -106,84 +30,50 @@
<public>false</public>
<roles/>
<script><![CDATA[(function() {

data.notes = [];
var noteGR = new GlideRecord('x_snc_createnotes_note');
noteGR.addQuery('user', gs.getUser().getID());
noteGR.orderByDesc('sys_created_on');
noteGR.setLimit(options.maximum_records_to_display);
noteGR.query();
while (noteGR.next()) {
var noteObj = {};

$sp.getRecordDisplayValues(noteObj, noteGR, 'number,title,sys_id');

noteObj.note = noteGR.getValue('note').slice(0,20);

data.notes.push(noteObj);
}

if (input) {
if (input.action == 'newNote') {
var newNote = new GlideRecord('x_snc_createnotes_note');
newNote.newRecord();
var id = newNote.insert();
data.noteID = id;
data.newNote = {};
$sp.getRecordValues(data.newNote,newNote,"title,note,sys_id");

}

if (input.action == 'snDeleteNote') {
var delNote = new GlideRecord('x_snc_createnotes_note');
// The notes record should already be gone. Just
// making sure it no longer exists.
if(delNote.get(input.noteID)){
delNote.deleteRecord();
}

}

}
//create an array to populate with notes
data.notes = [];
var noteGR = new GlideRecord('x_snc_createnotes_note');
noteGR.addQuery('user', gs.getUser().getID());
noteGR.orderByDesc('sys_created_on');
noteGR.query();
while (noteGR.next()) {
var noteObj = {};
//use service portal helper method to get some display values
$sp.getRecordDisplayValues(noteObj, noteGR, 'number,title,sys_id');
//get the first 20 characters of the description
noteObj.note = noteGR.getValue('note').slice(0,20);
//push the populated obj into the array
data.notes.push(noteObj);
}
)();
]]></script>
})();]]></script>
<servicenow>false</servicenow>
<sys_class_name>sp_widget</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2019-05-30 18:13:04</sys_created_on>
<sys_id>06948fa8db3133000613a08a4896194c</sys_id>
<sys_mod_count>15</sys_mod_count>
<sys_mod_count>19</sys_mod_count>
<sys_name>Notes List</sys_name>
<sys_package display_value="CreateNotes" source="x_snc_createnotes">df5fd9a5090232007f44e1046c8ff69f</sys_package>
<sys_policy/>
<sys_scope display_value="CreateNotes">df5fd9a5090232007f44e1046c8ff69f</sys_scope>
<sys_update_name>sp_widget_06948fa8db3133000613a08a4896194c</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2019-05-30 23:08:20</sys_updated_on>
<sys_updated_on>2025-01-07 09:49:42</sys_updated_on>
<template><![CDATA[<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">
{{::c.options.title}}
</h3>
<button class="btn btn-default pull-right" ng-click="c.newNote()">
<span class="glyphicon glyphicon-plus"></span>
</button>
</div>
<div class="panel-body">
<input placeholder="Filter" class="form-control" ng-model="noteFilter" />
</div>

<div class="list-group">
<a class="list-group-item" ng-click="c.selectItem($index)" ng-repeat="note in data.notes | filter: noteFilter">
<h4 class="list-group-item-heading">
{{note.title}}
</h4>
<p class="list-group-item-text">
{{note.note}}
</p>
</a>
</div>
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">
${Notes}
</h3>
</div>
<div class="list-group">
<a class="list-group-item" ng-click="c.selectItem($index)" ng-repeat="note in data.notes">
<h4 class="list-group-item-heading">
{{note.title}}
</h4>
<p class="list-group-item-text">
{{note.note}}
</p>
</a>
</div>]]></template>
</sp_widget>
</record_update>
Loading