Not sure I understand. But if you are looking for a specific entity by key after the save
// make sure that targetType is NOT null
var targetType = myEntityManager.metadataStore.getEntityType("Customer");
var targetId = 23452; // arbitrary id
function trapTargetEntityId(saveResult) {
saveResult.entities.forEach(function(entity) {
// assumes that you have a data property called 'id' on the 'Customer' entityType
if (entity.entityType === targetType && entity.id === targetId) {
targetEntity = entity;
// do something with 'targetEntity'
}
});
}
... and be careful with your casing - in your example it should have been 'entity.entityType' not 'entity.EntityType'