Showing posts with label custom workflow. Show all posts
Showing posts with label custom workflow. Show all posts

Saturday, October 4, 2014

SharePoint 2010 workflow error – “Due to heavy load, the latest workflow operation has been queued”

While working with custom workflows in SharePoint 2010, I got error in workflow as “Due to heavy load, the latest workflow operation has been queued”. After refreshing the page, most of the times error may fixed and workflow completed as usual. Sometimes I used to stuck on the workflow and I can see only the non-reactive screen with the error. I didn’t event fix the error after resetting the workflow and IIS Manager. After digging for the solution finally I got a fix for the error by updating the Workflow Postpone threshold in farm config manager by using following PowerShell commands,

Set-SpFarmConfig -WorkflowPostponeThreshold 30

By running the command, workflow threshold will be increased from 15 to 30

get-sptimerjob | ?{$ -like "job-workflow"} | set-sptimerjob -schedule "every 1 minutes between 0 and 59"

By running this command frequency of execution for SP timer job, job-workflow will be increased to every minute. After running the commands, if workflow don’t have any issues will be completed as expected.

Sunday, September 7, 2014

SharePoint custom workflow send email task error: The e-mail message cannot be sent. Make sure the email has a valid recipient

While working with SharePoint custom workflow with Send email task, i am seeing “The e-mail message cannot be sent. Make sure the email has a valid recipient” error in workflow history list every time workflow fired. I was in a confusion that why I am seeing that every time.

Very first time designing workflow I have left all properties for “Send Mail” task empty as I am sending emails through code without interacting any property in Send mail task. I have updated all the properties by creating new Field Properties in the code. But still seeing the same error in workflow history list.

By checking few posts, the error may cause because of two reasons,
  • ·         There is no e-mail in Active directory for system Account.
  • ·         Getting null values for existing properties as not assigning the values.

Here in my case iam getting null values from field properties. So I have updated a dummy email in To field as I am not using the the property anywhere in the code.

Hope this will helps.

Saturday, April 19, 2014

Send meeting request in SharePoint custom workflow

Working with SharePoint workflow I got a requirement to send meeting request by using the code. I have dig into deep to check if there is any option to send meeting requests by using SharePoint workflow but I couldn’t find anything. So we have only option to send meeting request through C# code.
My friend Ravi helped me on the code finally by using the code below we are able to send the meeting requests.

private void SendMeetingRequestMail(VacationRequestMail reqMail, string smtpTO, string smtpServer, string smtpFrom)
            using (MailMessage mailMessage = new MailMessage(smtpFrom, smtpTO))
                mailMessage.Subject = “Subject”;
                mailMessage.Body = “Body”;

                DateTime startDate = “Start Date and Time
                DateTime endDate = “End Date and Time

                StringBuilder str = new StringBuilder();
                str.AppendLine("PRODID:-//Vacation Request Portal");
                str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", startDate));
                str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endDate));
                str.AppendLine("LOCATION: Vacation Request Portal, India");
                str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
                str.AppendLine(string.Format("DESCRIPTION:{0}", mailMessage.Body));
                str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", mailMessage.Body));
                str.AppendLine(string.Format("SUMMARY:{0}", mailMessage.Subject));
                str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", mailMessage.From.Address));
                System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
                ct.Parameters.Add("method", "REQUEST");
                AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);

                using (SmtpClient smtpClient = new SmtpClient(smtpServer))

We have multiple options while sending meeting requests. For example “X-MICROSOFT-CDO-BUSYSTATUS:FREE” will set the user state to free even user accept the meeting request. Hope this will help.

Friday, March 28, 2014

SharePoint workflow deployment issue: Error occurred in deployment step ‘Activate Features’, Unable to locate workflow association data

While deploying with SharePoint workflow I got an error saying that “Error occurred in deployment step 'Activate Features': Unable to locate the workflow's association data. To restore the association data to the workflow, restart the workflow settings wizard by selecting the workflow node in Solution Explorer and then clicking the ellipsis button (…) on one of the properties in the Properties window that has an ellipsis button

Workflow is combination of events like task creation, Task updating and completion. By adding a workflow to the site, we have to specify the task list and history lists. Instances of task list and history list will track the events for workflow. Task list allows users to interact with workflow and history list contains information about the workflow events including date, status, participant etc.

While creating a new workflow visual studio will associate the lists. Some cases association will goes away whenever we change or delete the workflow designer file, we can get association error. To fix this error we have to set “Auto Associate” property to ‘false’ in workflow properties.

 By deploying the workflow now workflow will deploy without any issues and user will manually go and create the associations instead of automatic associations.