The Now Platform® Washington DC release is live. Watch now!
‎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?
‎04-09-2020 06:24 AM
Hello
I had the same problem. I don't know if you were able to solve but the solution is this,
{
type: 'reference',
name: 'parent_incident',
label: getMessage('Duplicate IT Ticket'),
reference: 'incident',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue()
}
‎04-17-2020 09:00 AM
Cyrille,
Thanks for the response. We have set AW aside as we don't feel it is ready for our use. I'm wondering where did you find this solution?
‎04-20-2020 01:39 AM
The OOTB UI Action "Copy Incident" is using something similar:
{
type: 'reference',
name: 'caller_id',
label: tMsgs["Caller"],
mandatory: true,
reference: 'sys_user',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue()
}
and I try to know what types are available:
type: "textarea", "choice", "reference", "boolean"
‎05-02-2020 03:49 PM
just to add to this a bit.
I was just combing through the front end source files and in workspace.
uxfc => /page/now/workspace/agent => chrome.jsdbx linenr: 171 091
I found this.
I believe this is where the modal field types are declared as all of them work as the type.
string, textarea,choice,reference,boolean.