Get connection by ActivityId

Hey Guys,

first of all Bpmn.io is really a great project! At the moment I’m trying to create a process flow diagram. For that, I want to change the color of the outgoing connections of an activity based on the amount of process instances. Is there a way to get the connection element (the graphic) by it’s connected activityId?

I know that i can get the connection via

var connection = elementRegistry.get('sequenceFlowId');

Thanks for help in advance

greets,
Schleusenfrosch

You can get the activity and traverse its incoming / outgoing edges like this:

var activityShape = elementRegistry.get('someactivityId');

var outgoing = activityShape.outgoing;
var incoming = activityShape.incoming;

That should give you access to the respective connections.