/// <summary> /// Runs when the activity is run by the workflow. /// </summary> /// <param name="context">The run state.</param> /// <param name="inputs">The inputs.</param> void IRunNowActivity.OnRunNow(IRunState context, ActivityInputs inputs) { var text = GetArgumentValue <string>(inputs, "inLogActivityMessage"); var refencedObject = GetArgumentEntity <UserResource>(inputs, "inLogActivityObject"); IEntity logEntry; if (refencedObject != null) { logEntry = new LogActivityResourceLogEntry { ObjectReferencedInLog = refencedObject, ReferencedObjectName = refencedObject.Name }; } else { logEntry = new LogActivityLogEntry(); } logEntry.SetField(WorkflowRunLogEntry.Name_Field, ActivityInstance.Name); logEntry.SetField(WorkflowRunLogEntry.Description_Field, text); context.Log(logEntry); // Provide some context information to the log message EventLog.Application.WriteInformation(string.Format("Log | {1} | Message: {2}", DateTime.UtcNow.Ticks, context.GetSafeWorkflowDescription(), text)); }
void RecordInfoToUserLog(IRunState context, string message) { context.Log(new WorkflowRunLogEntry { LogEntrySeverity_Enum = LogSeverityEnum_Enumeration.InformationSeverity, Name = "Email send information", Description = message }); }
void RecordErrorToUserLog(IRunState context, Exception ex) { context.Log(new WorkflowRunLogEntry { LogEntrySeverity_Enum = LogSeverityEnum_Enumeration.WarningSeverity, Name = "Email send failed", Description = ex.Message }); }
void CreateLogEntry(IRunState context, DisplayFormUserTask userTask) { var actingPersonName = userTask.AssignedToUser != null ? userTask.AssignedToUser.Name : null; // Create the log entry context.Log(new WorkflowUserActionLogEntry { Name = ActivityInstance.Name, LogEventTime = DateTime.UtcNow, UserActionBeingLogged = userTask, WuleDueDate = userTask.UserTaskDueOn, ActingPersonReferencedInLog = userTask.AssignedToUser, ActingPersonName = actingPersonName, ObjectReferencedInLog = userTask.RecordToPresent, Description = string.Format("Assigned to: {0}, Due: {1}", actingPersonName ?? "", userTask.UserTaskDueOn) }); }