need help passing data into a modal client and server scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 12:31 PM
I have a model that would run on the incident table and when the use clicks this modal it woul dchange the incident state and add a comment as to why its being changed
CLIENT
c.onOpen = function() {
//ask the user for a string
spModal.open({
title: 'Change Incident status',
message: 'Why would you like to Change the status?',
buttons: [
{label:'✘ ${No}', cancel: true},
{label:'✔ ${Yes}', primary: true}
]
input: true,
value: c.name
}).then(function() {
c.name = name;
})
SERVER
if (input && input.action) {
var action = input.action;
if (action == 'true') {
// Resolve Tier 1 Scorecard
var changeStatus = new GlideRecord('incident');
cancelStatus.addQuery('sys_id',data.task);
cancelStatus.query();
while(cancelStatus.next()){
cancelStatus.setValue('state', ' Where the client code comes in ');
cancelScore.update();
}
First i and not sure how to trigger the server side code , and how to pass the data entered into the modal back to the server so , and also how to add the incident fields to the modal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 12:57 PM
Hi Thomas,
take a look at this article I posted and review the script...this may help you.
https://community.servicenow.com/community?id=community_article&sys_id=ae61924cdbf51090190dfb24399619ef