Hi Everyone,
Is there a way that I can stop a user from closing a model, if one or more attributes are not captured?
I used a trigger event on a macro to start a report when a model is closed. The sequence then starts a QA report. The report is opened in Excel, and THEN the model is closed. I need the report / macro to either re-open the model or stop the user from closing the model...
Any ideas or workarounds that I can try?
Using ARIS 10.04....
Thanks,
Willem
Kay Fischbach on
Ok, this is actually a really cool task that you want to accomplish. I think it's a bit complicated to explain, but it's easy to implement once you understood the concept of it.
As described here reports are executed on the server, while macros are executed on the client.
Right now all your client does is say "hey server, could you execute the report with the GUID "GUID_GOES HERE", please? If there is any file created with that report, send it to me, I want to display it."
The parts your macro-report-combination is missing, is
Information can be passed from your report to your your macro with things called "properties". Each property consists of a string-key (it's an identifier) and a string-value (the actual information).
Here is what you want to do.
Somewhere at the start of your report, you want to add the following line
Context.setProperty("dontClose", "false");This creates a new property with the key "dontClose" and the string value "false"
Context.setProperty("dontClose", "true");This overwrites the previously defined property with the key "dontClose", and sets the string value "true" for it.
var selection; var reportInfo; var result; selection = Context.getSelectedModels(); if(selection.length > 0) { reportInfo = Report.createExecInfo("SOME_GUID_HERE", selection, Context.getSelectedLanguage(), Context.getSelectedOutputFormat(), Context.getSelectedOutputPath(), Context.getSelectedOutputFile(), Context.getEvaluationFilter()); result = Report.execute(reportInfo, Context.getShowResult()); }What you want to do is add a little bit of code close to the end of the code, after the "result = ... line, before the closing bracket.
if(result.getProperty("dontClose") == "true"){ Context.setProperty("event.veto", true); }What does this do? It reads the property-value from the property identified with "dontClose" of the Report result, and compares the string of the property with the string "true". If the strings match, the macro will set one of its own properties, identified with the key "event.veto" to the value "1" (boolean true automatically translates to a "1" string).
What is "event.veto" you may ask? Because we picked an event for the macro execution, that had "(vetoable)" at the end, we are allowed to veto action of the user. For this to happen, ARIS automatically created a property when we started the macro, with the key "event.veto" and value "0". With this default value "0", the macro will not stop the model from closing. We switched it to "1", which tells ARIS "don't let the user do that thing". The model stays open, if the report-property-value and the "true" match.
That's it. Save everything and give it a try.