1) Command:

//replace task 004(task004) by the new task named task222

pmb.Replace( "004" , ActivityTypeEnum.TaskNode, "task222" , "222" )

Parameters: (currentActivityCode, replacedByActivityType, replacedByActivityName, replacedByActivityCode)

Note: The current node can be replaced with a new node. The new node is: replacedByActivity. The replacement operation is equivalent to performing a delete (Remove) operation first and then performing an add (Add) operation. After the node is replaced, the unique identification GUID of the original connection Transition will also change.

2) Graphical example after command execution:

https://img2018.cnblogs.com/blog/808949/201911/808949-20191128204450166-1178815908.png