ARIS Community - We Love BPM

Mass Break of Duplicate Objects

ttrammell79's picture
by Thomas Trammell in Reports & Macros posted on 2018-01-04

I have duplicate activity steps which are currently named the same thing and linked across multiple maps.  The activity is correct, but depending on the map it will have different metadata (such as time to complete).  Is there a way to break the connection between these objects en mass without having to go through selecting individual activities to check them?

327 Views
0 Likes
1 Comments
Sorry there are no tags
There are no attachments
Nikita Martyanov posted on 2018-01-05

Hello,

it's possible if you're familiar with ARIS Scripts. I can try to help you and post here piece of code. You can use it and modify for your specific needs. If I understand you correctly you need to replace object definitions (create new) for all occurrences of the particular object. This code creates new definition for every occurrence and also copies all the attributes from the source definition. Run it on the occurrence in the model.

var loc = Context.getSelectedLanguage()
var oObj = ArisData.getSelectedObjOccs()[0]
var oOutput = Context.createOutputObject()

function replaceObjDefs(occs){
    for (var i=0;i<occs.length;i++){
        try{
            replaceObjDefWithNew(occs[i])
            oOutput.OutputTxt("success: on model "+occs[i].Model().Name(loc)+"\r\n")
        }catch(e){
            oOutput.OutputTxt("error: on model "+occs[i].Model().Name(loc)+"\r\n")
        }
    }
}

function replaceObjDefWithNew(oOcc){
    var oGrp = oOcc.Model().Group()
    var oNewDef = oGrp.CreateObjDef(oOcc.ObjDef().TypeNum(),oOcc.ObjDef().Name(loc),loc)
    var al = oOcc.ObjDef().AttrList(loc)
    for (var key in al)
        oNewDef.Attribute(al[key].TypeNum(),loc).setValue(al[key].getValue())
    oOcc.ReplaceObjDef(oNewDef)
}

function main(){
    var occs = oObj.ObjDef().OccList()
    oOutput.OutputTxt("Object: "+oObj.ObjDef().Name(loc)+"\r\n")
    replaceObjDefs(occs)
    oOutput.OutputTxt("----")
    oOutput.WriteReport()
}

main()

BR, Nikita