Call a UI Action from a Client Script to open a Change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2012 08:15 AM
**I'm sure this has been done, before just can't find anything on the forum so I'm asking.**
I am trying to call a UI Action from a Client Script. I have a onChange Client Script running from the Incident table that if the 'confirm' value is True I'd like to automatically open a related Change record. But it's not working...thoughts?
Here's the code that I wrote that's not working.
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '7' && !isLoading && g_form.getValue('rfc')=='') {
var rfc = g_form.getReference('rfc');
var answer = confirm('Was this Incident resolved by a Change? If yes press OK to create a Change Record. If No press Cancel.')
//force the Resolved by Change to Mandatory if OK
if (answer == true)
gsftSubmit(null, g_form.getFormElement('name'), 'Create Change');
else
g_form.setMandatory('rfc', false);
return;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2012 12:58 PM
Was the change record created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2012 06:09 PM
It does not create the change record or relate the Incident to the change. It just goes back to the Incident queue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2015 06:44 AM
Hello Roderick
Did you get this sorted ? I am trying the same requirement and getting the same result as you mentioned. It goes back to the incident list.
Cheers
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2012 11:14 AM
You might want to try:
- adding the code into one of the demo instances so we can see exactly how you have things setup
- adding some gs.log() calls in the UI Action to see if it is even being called/run
- should not affect anything, but your "var rfc = g_form.getReference('rfc');" call serves no purpose and is making a server call for nothing
