Skip to Main Content
ARIS - SHARE YOUR IDEAS
How can we make ARIS better?
Status Open for voting
Created by Rob Filor
Created on Feb 7, 2024

Properly support veto when macro runs a report

Macros can only be used in Connect Designer if they run a report (or semantic check, but veto isn't available there). In this situation vetoable macro events (e.g. 'New object is to be placed from the toolbar (vetoable)' which runs in context of Model) have the veto handled by being either off, or always vetoed (if checkbox 'Use veto against default action (for vetoable events)' is set to true on the 'Content' section of the macro properties. This behaviour is not helpful, with the event in the example ('New object is to be placed from the toolbar (vetoable)') it leads to it not being possible to place an occurrence in a model under any circumstances. The approach needs to be changed to handle the veto value being passed back from the report to the auto-generated macro stub.

The auto-generated macro stub for an event triggered macro running a report with the 'Use veto against default action' set to true looks like this:


var selection;

var reportInfo;

var result;

selection = Context.getSelectedModels();

if(selection.length > 0)

{

for(var i=0; i<selection.length; i++) {

if( !selection[i].isPermanent() )

Designer.save( selection[i] )

}

reportInfo = Report.createExecInfo("5fb20430-35b8-11ed-3265-005056ba7258", selection, Context.getSelectedLanguage());

if(Context.getProperty(Constants.EVENT_ID)!=null) {

reportInfo.setProperty(Constants.EVENT_ID, Context.getProperty(Constants.EVENT_ID))

var arg = Context.getProperty(Constants.EVENT_ARGUMENTS)

var keys = arg.getKeys()

var sArguments = ""

for(var i=0; i<keys.length; i++) {

reportInfo.setProperty(keys[i], arg.getStringValue(keys[i]))

sArguments += ',' +keys[i]

}

reportInfo.setProperty(Constants.EVENT_ARGUMENTS, sArguments.substring(1))

}

result = Report.execute(reportInfo, Context.getShowResult());

}

Context.setProperty("event.veto", 1);


If it were changed to this then the veto should be handled from the report call:


var selection;

var reportInfo;

var result;

selection = Context.getSelectedModels();

if(selection.length > 0)

{

for(var i=0; i<selection.length; i++) {

if( !selection[i].isPermanent() )

Designer.save( selection[i] )

}

reportInfo = Report.createExecInfo("5fb20430-35b8-11ed-3265-005056ba7258", selection, Context.getSelectedLanguage());

if(Context.getProperty(Constants.EVENT_ID)!=null) {

reportInfo.setProperty(Constants.EVENT_ID, Context.getProperty(Constants.EVENT_ID))

var arg = Context.getProperty(Constants.EVENT_ARGUMENTS)

var keys = arg.getKeys()

var sArguments = ""

for(var i=0; i<keys.length; i++) {

reportInfo.setProperty(keys[i], arg.getStringValue(keys[i]))

sArguments += ',' +keys[i]

}

reportInfo.setProperty(Constants.EVENT_ARGUMENTS, sArguments.substring(1))

}

result = Report.execute(reportInfo, Context.getShowResult());

if (result.getProperty("event.veto") != null) Context.setProperty("event.veto", result.getProperty("event.veto"));

}


This would allow far more powerful handling of content with macro triggers in Connect Designer.