getActionName()

Krischan
Giga Guru

Is there a way to determine this?
I found a small "script" in the wiki that generates an output. I just wanted to know if there's a naming convention in this.
e.g. my table is name
something_tasks
and i want to simulate the same behaviour I have in my incident form, where the "close" button just diplsays the fields for close notes etc.
There there seems to run a client script which returns false and it checks for this action name....

3 REPLIES 3

Mark Stanger
Giga Sage

Can you clarify a bit? I'm not sure exactly what you're asking for.


What I want to do is:
When closing a task (an own application) via a UI-Action I want to set a state, which then triggers a ui action to unhide two mandatory fields. I then want to "abort" closing. So that the user can enter close notes. After this he presses update and the taks is closed.
There's a similar thing implemented with the resolve incident functionalit..

There's a UI action:
Condition:



(current.incident_state < 6) &amp;&amp; (gs.hasRole("itil"))

Script:


current.incident_state = 6; // resolved state
if(current.isValidRecord()) {
// this is when close is called as an update, just update it
current.update();
} else {
// and insert the record
current.insert();
}

The incident state then triggers the UI policy to display the fields close notes and close code. These fields are mandatory.
and then there's a client script.


function onSubmit() {
var action = g_form.getActionName(); // this seems to read some information about WHAT is done
var state = '6';
if(action == 'close_incident') // how does this get determined? I mean. This is to compare with the actual action.
state = '7';

if(action == 'close_incident' || action == 'resolve_incident') {
g_form.setValue('incident_state', state);
g_form.setDisplay('close_notes', true);
g_form.setDisplay('close_code', true);
g_form.setMandatory('close_notes', true);
g_form.setMandatory('close_code', true);

if (g_form.getControl('close_notes') &amp;&amp; g_form.getControl('close_code'))
if(g_form.getValue('close_notes') == '' || g_form.getValue('close_code') == '')
return false;
}
}


nevermind.
i found the place, where I can define the action name. Must've been blind or something.

regards

Christian