ARIS Community - We Love BPM

Help: Creating a new Attribute Placement using a Macro

Haden McAfee's picture
by Haden McAfee in Reports & Macros posted on 2017-04-08

I am working on an automated process for creating standardized models.  I have succeeded in writing a report which creates  customized template models.  However, within the report I was unable to place the name of the model on the model graphic.

I am attempting to write a macro which places the name of a model (as an attribute) automatically, when there is no existing placement on the model.  This would allow me to either select models from the ARIS explorer or standardize name placement upon the model initially being created.

The current code that I have written is here:

function formatModel(model)
 {

     //opens a model that is modifiable, invisible, and is allowed to display error dialogs.
     Designer.openModel(model, false, false, false);
     
     var nameAttr = Designer.createAttrOcc(model, null, Constants.AT_NAME, Constants.ATTROCC_ALIGN_LEFT);
     
     Designer.save(model);
     Designer.closeModel(model);
     
 }

The difficulty lies in the 'createAttrOcc' function, which in this case is returning a null pointer exception.  The documentation that I have for this method is here:

The problem I am having is that I can't determine what to put in the 'occ' parameter.  When a model is first created, there are no occurrences placed on the model.

Does anyone know a way around this issue?

THANKS!

5441 Views
0 Likes
3 Comments
Tags
There are no attachments
Robert Goldenbaum posted on 2017-04-09

Hi,

well with this methode, you are trying to create an attribute placement for an object occurrence. There is another method for creating a text occ which can either be a free form text or an attribute placement of the model.

And this also works for reports !

BR Robert

Robert Goldenbaum posted on 2017-04-09

It must be something with an x and y value - otherwise, the script would not know where to create the attr placement in the model...

Haden McAfee posted on 2017-04-17

That definitely does the trick.  Thank you!