How do you get the sysid of the current form in a client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2013 08:58 AM
Client scripts don't like (current) and I'm in need of getting the sysid of the current change form I'm building a script for. What's the client script equiv. to current?
I'm trying to get this to work in an onsubmit
//get workflow helper
var workflow = new Workflow();
//cancel all the workflows, where current is a task record with a workflow context
workflow.cancel(current);
//gs.addInfoMessage(gs.getMessage("Workflows for {0} have been cancelled", current.getDisplayValue()));
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2013 09:24 AM
g_form.getUniqueValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2013 09:26 AM
I don't think you'll be able to manipulate workflows in your client script without a more complex AJAX call to the server that accesses a Script Include you write that does the work.
Could you just do this in a Business Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2013 09:57 AM
Finding the sys_id of a record in client-side JavaScript can be done using the following call:
var id = gel('sys_uniqueValue').value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2013 10:18 AM
Don't rely on the value of that DOM element, use g_form.getUniqueValue() instead. The former is not guaranteed to be the same after any given upgrade. The latter is.