- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2021 12:13 AM
Hi,
Below is the workspace client script which I am using on a UI action,
function onClick(g_form) {
var fields = [{
type: 'reference',
name: 'u_duplicate_incident',
label: getMessage('Duplicate Incident'),
mandatory: true,
reference: 'incident',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue()
}];
g_modal.showFields({
title: "Provide Duplicate Incident",
fields: fields,
size: 'sm'
}).then(function(fieldValues) {
g_form.setValue('close_code', 'Duplicate Incident');
g_form.setValue('close_notes', 'This is a duplicate Incident');
g_form.setValue('short_description', "Duplicate Incident -" + g_form.getValue('short_description'));
g_form.setValue('u_duplicate_incident', fieldValues.updatedFields[0].value);
g_form.save();
});
}
Right now I use g_form save() to save the form which I don't recommend to do that. I need to resolve the incident from ui action once client script job is done.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2021 02:43 AM
It worked.
Rather than calling g_form.getActionName() we can directly pass the action name.
g_form.submit('action_name');
In my case below is the final code,
function onClick(g_form) {
var fields = [{
type: 'reference',
name: 'u_duplicate_incident',
label: getMessage('Duplicate Incident'),
mandatory: true,
reference: 'incident',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue()
}];
g_modal.showFields({
title: "Provide Duplicate Incident",
fields: fields,
size: 'sm'
}).then(function(fieldValues) {
g_form.setValue('close_code', 'Duplicate Incident');
g_form.setValue('close_notes', 'This is a duplicate Incident');
g_form.setValue('short_description', "Duplicate Incident -" + g_form.getValue('short_description'));
g_form.setValue('u_duplicate_incident', fieldValues.updatedFields[0].value);
g_form.submit('validate_check_duplicate');
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2021 02:41 AM
Hi,
It just saves the form. I need to resolve the incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2021 02:43 AM
It worked.
Rather than calling g_form.getActionName() we can directly pass the action name.
g_form.submit('action_name');
In my case below is the final code,
function onClick(g_form) {
var fields = [{
type: 'reference',
name: 'u_duplicate_incident',
label: getMessage('Duplicate Incident'),
mandatory: true,
reference: 'incident',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue()
}];
g_modal.showFields({
title: "Provide Duplicate Incident",
fields: fields,
size: 'sm'
}).then(function(fieldValues) {
g_form.setValue('close_code', 'Duplicate Incident');
g_form.setValue('close_notes', 'This is a duplicate Incident');
g_form.setValue('short_description', "Duplicate Incident -" + g_form.getValue('short_description'));
g_form.setValue('u_duplicate_incident', fieldValues.updatedFields[0].value);
g_form.submit('validate_check_duplicate');
});
}