How to Trigger code in DNG.
Hi,
When we edit module in DNG it is automatically saves after focus lost. If I want to execute other functionality on save then is it possible to do that? If yes, how can I do that. Any help would greatly appreciated.
|
Accepted answer
You can use the Javascript API to execute some javascript code as soon as one of the available events is triggered (ARTIFACT_SELECTED, ARTIFACT_OPENED, ARTIFACT_SAVED, ARTIFACT_CLOSED).
To use this API, you have to gain access to the Javascript RM Object - which first of all is available only in widgets.
Maybe there are also possibilities to access this object from outside widgets (e.g. in javascript code which you included using a Theme).
If you only use a widget, the user must first add it to the sidebar in order to activate your functionality.
You can find the Javascript API Documentation here:
In this topic:
I posted a short code example which executes some javascript as soon as a module is opened:
RM.Event.subscribe(RM.Event.ARTIFACT_OPENED, function(openedArtifact){
Following this schema, this could be adapted in a way to be executed as soon as an artifact is saved.
You can then either implement your desired business logic directly in Javascript, or trigger some other code e.g. in a Server Application.
Jayshri Burde selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.6k●3●36●46)
| answered Feb 24 '17, 6:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER As far as I know you can not extend DNG to be able to do that, unfortunately. Comments Correct, you cannot extend or configure the web UI or server side code to do that.
Maybe I do not understand the question correctly, but what if you use a widget with some javascript which is executed when the ARTIFACT_SAVED lifecycle event is triggered (see section »Lifecycle events« in https://jazz.net/wiki/bin/view/Main/RMExtensionsAPI602 )?
You cannot prevent saving this way (because the event is triggered after the save operation), but I read the question like if some other functionality in addition to the save is demanded.
Jayshri Burde
commented Feb 27 '17, 5:01 a.m.
Yes Philipp,
I want to add additional functionality on save.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Do you want to execute some functionality in addition to or instead of the save?