This is the code I have used when I played around with the SDK to create activities. Note: this code assumes many things about the complete structure of the microflow, such as the existence of an Address object and the existence of a Customer entity with attributes Street and City etc.
function addActivities(microflowToAdd: data.Microflow, newMicroflow: microflows.Microflow): microflows.MicroflowObject[] {
let objects: microflows.MicroflowObject[] = [];
let objCol = newMicroflow.objectCollection;
let start = createStartEvent(newMicroflow);
objects.push(start);
microflowToAdd.activities.forEach(activity => {
let action = microflows.ActionActivity.createIn(objCol);
const coordinates = getCoordinatesForMicroflow(microflowToAdd, activity, 1);
action.relativeMiddlePoint = {x: coordinates.width, y:coordinates.height};
action.size.height = 60;
action.size.width = 120;
switch (activity.type) {
case data.ActivityType.ChangeObject:
let changeObject = microflows.ChangeObjectAction.createIn(action);
changeObject.commit = microflows.CommitEnum.No;
changeObject.refreshInClient = true;
changeObject.changeVariableName = 'Customer';
let changeStreet = microflows.MemberChange.createIn(changeObject);
changeStreet.attribute = newMicroflow.containerAsFolderBase.model.findEntityByQualifiedName('CustomerManagement.Customer').attributes.filter(a => a.name == 'Street')[0];
changeStreet.value = '$Address/Street';
let changeCity = microflows.MemberChange.createIn(changeObject);
changeCity.attribute = newMicroflow.containerAsFolderBase.model.findEntityByQualifiedName('CustomerManagement.Customer').attributes.filter(a => a.name == 'City')[0];
changeCity.value = '$Address/City';
break;
objects.push(action);
});
let end = createEndEvent(microflowToAdd, newMicroflow);
objects.push(end);
return objects;
I would imagine that in your code, you would loop over the attributes of one of the entities and add a Microflows.MemberChange for each attribute you encounter. You would set the value based on an existing object/attribute combination, like I have done.