diff --git a/README.md b/README.md index 03580841..455baff5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/sn_source_control.properties b/sn_source_control.properties new file mode 100644 index 00000000..8d801076 --- /dev/null +++ b/sn_source_control.properties @@ -0,0 +1,10 @@ +############################################################# +# This ServiceNow-created file contains the path to the app in this repo +# path= +# 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. +############################################################ +# +#Sat Mar 16 11:55:56 PDT 2024 +path= diff --git a/update/sp_instance_9c1b51a4c3c94e104de6bdbc05013141.xml b/update/sp_instance_9c1b51a4c3c94e104de6bdbc05013141.xml new file mode 100644 index 00000000..167f46cf --- /dev/null +++ b/update/sp_instance_9c1b51a4c3c94e104de6bdbc05013141.xml @@ -0,0 +1,32 @@ + + + true + + default + + + + 1 + + + md + 43295ae1094232007f44e1046c8ff615 + 59f919e0c3c94e104de6bdbc05013114 + sp_instance + admin + 2024-03-16 17:25:19 + 9c1b51a4c3c94e104de6bdbc05013141 + 0 + + df5fd9a5090232007f44e1046c8ff69f + + df5fd9a5090232007f44e1046c8ff69f + sp_instance_9c1b51a4c3c94e104de6bdbc05013141 + admin + 2024-03-16 17:25:19 + + <url/> + <widget_parameters/> + </sp_instance> + <sys_translated_text action="delete_multiple" query="documentkey=9c1b51a4c3c94e104de6bdbc05013141"/> +</record_update> diff --git a/update/sp_instance_fc1b5da0c3c94e104de6bdbc0501317e.xml b/update/sp_instance_fc1b5da0c3c94e104de6bdbc0501317e.xml new file mode 100644 index 00000000..6cb8ebca --- /dev/null +++ b/update/sp_instance_fc1b5da0c3c94e104de6bdbc0501317e.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?><record_update table="sp_instance"> + <sp_instance action="INSERT_OR_UPDATE"> + <active>true</active> + <class_name/> + <color>default</color> + <css/> + <glyph/> + <id/> + <order>1</order> + <roles/> + <short_description/> + <size>md</size> + <sp_column display_value="2">cf295ae1094232007f44e1046c8ff616</sp_column> + <sp_widget display_value="Notes Body">6d6a1964c3c94e104de6bdbc05013192</sp_widget> + <sys_class_name>sp_instance</sys_class_name> + <sys_created_by>admin</sys_created_by> + <sys_created_on>2024-03-16 17:25:21</sys_created_on> + <sys_id>fc1b5da0c3c94e104de6bdbc0501317e</sys_id> + <sys_mod_count>0</sys_mod_count> + <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_instance_fc1b5da0c3c94e104de6bdbc0501317e</sys_update_name> + <sys_updated_by>admin</sys_updated_by> + <sys_updated_on>2024-03-16 17:25:21</sys_updated_on> + <title/> + <url/> + <widget_parameters/> + </sp_instance> + <sys_translated_text action="delete_multiple" query="documentkey=fc1b5da0c3c94e104de6bdbc0501317e"/> +</record_update> diff --git a/update/sp_widget_59f919e0c3c94e104de6bdbc05013114.xml b/update/sp_widget_59f919e0c3c94e104de6bdbc05013114.xml new file mode 100644 index 00000000..a3383dc2 --- /dev/null +++ b/update/sp_widget_59f919e0c3c94e104de6bdbc05013114.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?><record_update table="sp_widget"> + <sp_widget action="INSERT_OR_UPDATE"> + <category>custom</category> + <client_script><![CDATA[api.controller=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/> + <data_table>sp_instance</data_table> + <demo_data/> + <description/> + <docs/> + <field_list/> + <has_preview>true</has_preview> + <id>notes_list</id> + <internal>false</internal> + <link><![CDATA[function link(scope, element, attrs, controller) { }]]></link> + <name>Notes 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>2024-03-16 17:20:28</sys_created_on> + <sys_id>59f919e0c3c94e104de6bdbc05013114</sys_id> + <sys_mod_count>5</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_59f919e0c3c94e104de6bdbc05013114</sys_update_name> + <sys_updated_by>admin</sys_updated_by> + <sys_updated_on>2024-03-16 18:30:32</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="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> +</div>]]></template> + </sp_widget> +</record_update> diff --git a/update/sp_widget_6d6a1964c3c94e104de6bdbc05013192.xml b/update/sp_widget_6d6a1964c3c94e104de6bdbc05013192.xml new file mode 100644 index 00000000..0e56fa0c --- /dev/null +++ b/update/sp_widget_6d6a1964c3c94e104de6bdbc05013192.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?><record_update table="sp_widget"> + <sp_widget action="INSERT_OR_UPDATE"> + <category>custom</category> + <client_script><![CDATA[api.controller=function($scope,$rootScope) { + /* widget controller */ + var c = this; + + $rootScope.$on('selectNote', function(event,data) { + c.server.get({ + action: 'getNote', + noteID: $rootScope.noteID + }).then(function(r) { + c.data.title = r.data.note.title; + c.data.note = r.data.note.note; + c.data.noteID = r.data.note.sys_id; + }); + }); + + c.updateNote = function(updateType) { + c.server.get({ + action: 'updateNote', + noteID: c.data.noteID, + noteBody: c.data.note, + noteTitle: c.data.title + }).then(function(r) { + }); + } +}]]></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>notes_body</id> + <internal>false</internal> + <link><![CDATA[function link(scope, element, attrs, controller) { }]]></link> + <name>Notes Body</name> + <option_schema/> + <public>false</public> + <roles/> + <script><![CDATA[(function() { + /* populate the 'data' object */ + + if (input && input.noteID) { + var note = new GlideRecord('x_snc_createnotes_note'); + if (note.get(input.noteID)) { + if (input.action == 'getNote') { + data.note = {}; + $sp.getRecordValues(data.note, note, "title, note, sys_id"); + } else if (input.action == 'updateNote') { + note.title = input.noteTitle; + note.note = input.noteBody; + note.update(); + } + } + } +})();]]></script> + <servicenow>false</servicenow> + <sys_class_name>sp_widget</sys_class_name> + <sys_created_by>admin</sys_created_by> + <sys_created_on>2024-03-16 17:22:23</sys_created_on> + <sys_id>6d6a1964c3c94e104de6bdbc05013192</sys_id> + <sys_mod_count>7</sys_mod_count> + <sys_name>Notes Body</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_6d6a1964c3c94e104de6bdbc05013192</sys_update_name> + <sys_updated_by>admin</sys_updated_by> + <sys_updated_on>2024-03-16 18:49:54</sys_updated_on> + <template><![CDATA[<div class="panel panel-default" ng-show="c.data.noteID"> + <div class="panel-heading clearfix"> + <div class="row"> + <div class="col-md-12"> + <input class="form-control" id="note-title" ng-model="c.data.title" ng-change="c.updateNote('title')" ng-model-options="{debounce: 1000}"/> + </div> + </div> + </div> + <div class="panel-body"> + <textarea class="form-control" id="note-body" ng-model="c.data.note" ng-change="c.updateNote('body')" ng-model-options="{debounce: 1000}" ></textarea> + </div> +</div>]]></template> + </sp_widget> +</record_update> diff --git a/update/sys_scope_privilege_8b7e6d68c30d4e104de6bdbc0501311a.xml b/update/sys_scope_privilege_8b7e6d68c30d4e104de6bdbc0501311a.xml new file mode 100644 index 00000000..ea0ffb7f --- /dev/null +++ b/update/sys_scope_privilege_8b7e6d68c30d4e104de6bdbc0501311a.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_scope_privilege"> + <sys_scope_privilege action="INSERT_OR_UPDATE"> + <operation>execute</operation> + <source_scope display_value="CreateNotes">df5fd9a5090232007f44e1046c8ff69f</source_scope> + <status>allowed</status> + <sys_class_name>sys_scope_privilege</sys_class_name> + <sys_created_by>admin</sys_created_by> + <sys_created_on>2024-03-16 18:50:09</sys_created_on> + <sys_id>8b7e6d68c30d4e104de6bdbc0501311a</sys_id> + <sys_mod_count>0</sys_mod_count> + <sys_name>GlideRecord.update</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>sys_scope_privilege_8b7e6d68c30d4e104de6bdbc0501311a</sys_update_name> + <sys_updated_by>admin</sys_updated_by> + <sys_updated_on>2024-03-16 18:50:09</sys_updated_on> + <target_name>GlideRecord.update</target_name> + <target_scope display_value="Global">global</target_scope> + <target_type>scriptable</target_type> + </sys_scope_privilege> +</record_update>