Help with Agent Workspace modal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2019 11:48 AM
We recently upgraded to Madrid and I am attempting to configure Agent Workspace with functionality similar to our advanced view for closing incidents. We have a UI Action popup for proposing a solution to an incident before the task is closed. The popup includes a field for comments(text area), close_notes(text area), close_code(choice list), ticket_type(choice list) and duplicate(reference). The duplicate field is a reference to the incident table. The field appears on the modal and it has a magnifying glass so it must recognize that it is a reference field and when I click on it, there is a popunder that shows "Searching..." However, it won't display a list to choose from and clicking the magnifying glass does not do anything either. Additionally, the size value does not appear to have any affect of the size of the modal window.
Here is the code I'm working on to create the modal:
//Get all the Close Codes
var gA = new GlideAjax("GlobalAgentWorkspace");
gA.addParam('sysparm_name', 'getITTicketCloseCodes');
gA.getXMLAnswer(openModal);
//openModal(taskId,table);
function openModal(answer){
var closeCodes = JSON.parse(answer);
if(!closeCodes){
closeCodes = [];
}
var fields = [
{
type: 'textarea',
name: 'comments',
label: getMessage('Proposed Solution'),
mandatory: true
},
{
type: 'textarea',
name: 'close_notes',
label: getMessage('Close notes (Private)')
},
{
type: 'choice',
name: 'close_code',
label: getMessage('Close code'),
value: getMessage(' -- Select -- '),
choices: closeCodes,
mandatory: true
},
{
type: 'choice',
name: 'u_ticket_type',
label: getMessage('Ticket type'),
value: getMessage(' -- Select -- '),
choices: [
{
displayValue: 'Issue',
value: 'Issue'
},
{
displayValue: 'Request',
value: 'Request'
}
],
mandatory: true
},
{
type: 'reference',
name: 'parent',
label: getMessage('Duplicate IT Ticket'),
table: 'incident',
query: 'active=true'
}
];
//open the popup
g_modal.showFields({
title: getMessage('Confirmation: Solution Proposed'),
fields: fields,
size: 'sm'
}).then(function(fieldValues){
var newProposedSolution = fieldValues.updatedFields[0].value;
var newCloseNotes = fieldValues.updatedFields[1].value;
var newCloseCode = fieldValues.updatedFields[2].value;
var newTicketType = fieldValues.updatedFields[3].value;
var newDuplicateITTicket = fieldValues.updatedFields[4].value;
//alert("newProposedSolution: " + newProposedSolution + "\nnewCloseNotes: " + newCloseNotes + "\nnewCloseCode: " + newCloseCode + "\nnewTicketType: " + newTicketType + "\nnewDuplicateITTicket: " + newDuplicateITTicket);
var gaSP = new GlideAjax('GlobalAgentWorkspace');
gaSP.addParam('sysparm_name','setSolutionProposed');
gaSP.addParam('sysparm_taskId', taskId);
gaSP.addParam('sysparm_table', table);
gaSP.addParam('sysparm_comments', newProposedSolution);
gaSP.addParam('sysparm_close_notes', newCloseNotes);
gaSP.addParam('sysparm_close_code', newCloseCode);
gaSP.addParam('sysparm_ticketType', newTicketType);
gaSP.addParam('sysparm_duplicate', newDuplicateITTicket);
gaSP.getXMLAnswer(function(response) {
g_form.save();
});
});
}
All of this appears to update the ticket as expected.
What am I missing from the reference type field to get it working?
Is there any g_modal documentation other than looking through OOB scripts?
- 5,820 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 03:21 PM
Anyone figure this out? Super helpful code for creating the modal, but now I need the list of catalog items to populate.
function onClick(g_form) {
var fields = [
{
type: 'reference',
name: 'catitem',
label: 'Please select a Catalog Item:',
mandatory: true,
reference: 'sc_cat_item',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue(),
//query: 'active=true'
//query: 'type!=bundle^sys_class_name!=sc_cat_item_producer^sys_class_name!=sc_cat_item_guide^type!=package^sys_class_name!=sc_cat_item_content^active=true',
}
];
g_modal.showFields({
title: getMessage('Convert Incident to Request: '+g_form.getValue('number')),
fields: fields,
size: 'md'
}).then(function(fieldValues){
var catitem = fieldValues.updatedFields[0].value;
var url = "$sp.do?id=sc_cat_item&sys_id="+catitem+'&sysparm_inctoreq=true&sysparm_incsid='+g_form.getUniqueValue();
}).then(response.sendRedirect(url));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 09:40 AM
A good OOB UI action to reference is 'Copy Incident'.
{
type: 'reference', // type of modal (ie text, reference, etc)
name: 'caller_id', // reference field on the current record used to search
label: tMsgs["Caller"], // message to display above the search field
mandatory: true, // sets the field to mandatory
reference: 'sys_user', // table that the reference field in "name" refers to
referringTable: 'incident', // table of the current record
referringRecordId: g_form.getUniqueValue() // sys_id of the current record
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2021 03:07 AM
Was the auto population issue resolved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2022 08:12 AM
Does Modal type support the date field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 03:04 PM
I'd like to know this, too. Can I put a date picker on a workspace modal?