There's a couple of minor things that are causing issues here. NetworkMapLink expects IDs within map, not netxms object IDs, so there's a function to convert. And we need to explicitly specify that IDs of status-providing nodes are of type "Long". Here's an example of working script:
Code Select
from java.util import ArrayList
from java.lang import Long
amap = s.findObjectById(2722)
mapPage = amap.createMapPage()
cd = NetworkMapLink(NetworkMapLink.NORMAL, mapPage.findObjectElement(672).id, mapPage.findObjectElement(674).id)
sList = ArrayList()
sList.add(Long(674))
sList.add(Long(672))
cd.setStatusObjects(sList)
cd.setRouting(NetworkMapLink.ROUTING_DIRECT)
cd.setColorSource(LinkConfig.COLOR_SOURCE_OBJECT_STATUS)
mapPage.addLink(cd)
data = NXCObjectModificationData(2722)
data.setMapContent(mapPage.getElements(), mapPage.getLinks())
s.modifyObject(data)