public virtual IProcessInstanceWithVariables ExecuteWithVariablesInReturn(bool skipCustomListeners, bool skipIoMappings) { EnsureUtil.EnsureOnlyOneNotNull("either process definition id or key must be set", ProcessDefinitionId, ProcessDefinitionKey); if (IsTenantIdSet && !ReferenceEquals(ProcessDefinitionId, null)) { throw Log.ExceptionStartProcessInstanceByIdAndTenantId(); } ICommand <IProcessInstanceWithVariables> command; if (ModificationBuilder.ModificationOperations.Count == 0) { if (skipCustomListeners || skipIoMappings) { throw Log.ExceptionStartProcessInstanceAtStartActivityAndSkipListenersOrMapping(); } // start at the default start activity command = new StartProcessInstanceCmd(this); } else { // start at any activity using the instructions ModificationBuilder.SkipCustomListeners = skipCustomListeners; ModificationBuilder.SkipIoMappings = skipIoMappings; command = new StartProcessInstanceAtActivitiesCmd(this); } return(_commandExecutor.Execute(command)); }