Hi,
We are using a custom workflow task edit form ,
when the user tries to approve the task the task status gets updated as 'completed' , but the workflow does
not progress further, The same does not happen if the user uses the OOB workflow task edit form to 'Approve' .
When we looked into the 'taskitem.xml' file before the 'approve' action and after ,
we noticed ,workflow outcome field does not get updated when using the custom .
I have attached the code snippet of the custom approval task screen and also taskitem.xml files before and after the approval action.
And also this code works perfectly fine in Dev and QA , but it does not work in Production environment alone.
Taskitem.xml ( After update )
<?xml version="1.0"?><z:row ows_ServerRedirected="0" ows_FolderChildCount="2;#0" ows_ItemChildCount="2;#0" ows__IsCurrentVersion="1" ows__Level="1" ows_MetaInfo="2;#WorkflowCreationPath:SW|c1eadd66-1bf5-4107-b9a6-e1ec2b8d0b88; " ows_BaseName="2_" ows_EncodedAbsUrl="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/2_.000" ows_ServerUrl="/apps/ITDR/Lists/Tasks/2_.000" ows_LinkFilename2="2_.000" ows_LinkFilename="2_.000" ows_LinkFilenameNoMenu="2_.000" ows__EditMenuTableEnd="2" ows__EditMenuTableStart2="2" ows__EditMenuTableStart="2_.000" ows_ScopeId="2;#{33C6A65F-123B-4236-8C96-4B30B0A39286}" ows_ProgId="2;#" ows_UniqueId="2;#{0FA745E3-A05D-49F9-9A94-BCE5AE92F122}" ows_FileLeafRef="2;#2_.000" ows_PermMask="0x400001f07fff1bff" ows_SortBehavior="2;#0" ows_FSObjType="2;#0" ows_Created_x0020_Date="2;#2014-03-21 11:32:15" ows_Last_x0020_Modified="2;#2014-03-21 11:32:15" ows_FileDirRef="2;#apps/ITDR/Lists/Tasks" ows_FileRef="2;#apps/ITDR/Lists/Tasks/2_.000" ows_Order="200.000000000000" ows_SelectTitle="2" ows__ModerationStatus="0" ows_Attachments="0" ows__UIVersionString="2.0" ows__UIVersion="1024" ows_WorkflowVersion="1" ows_owshiddenversion="3" ows_Editor="1073741823;#System Account" ows_Author="10;#Arputharaj, Joseph R." ows_Created="2014-03-21 11:32:15" ows_Modified="2014-03-21 11:34:09" ows_ID="2" ows_WorkflowInstanceID="{E8FA3B9F-FB85-47F6-A868-7D4D345FD3AC}" ows_GUID="{DF68F0AA-9130-496D-B461-0707AEC12CDC}" ows_ExtendedProperties="ows_FieldName_ConsolidatedComments='Publication Workflow Task started by Arputharaj, Joseph R. on 3/21/2014 11:32 AM<br />Comment: <a href="http://ea.share.dtcc.com/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br>Approvers Instructions: <br>Distribution Instructions: ' ows_FieldName_Comments='Approved by ranjit' " ows_WorkflowItemId="51" ows_WorkflowListId="{D17E0B4A-A2F0-4CCC-9919-3107B1EAEA17}" ows_Completed="1" ows_PendingModTime="2014-03-21 11:34:11" ows_SendEmailNotification="0" ows_HasCustomEmailBody="0" ows_EmailBody="<html> <head> <style> table.mail { border-collapse:collapse; width:100%; font: 8pt Tahoma; } td.header { background:#F8F8F9; border:1px solid #E8EAEC; padding: 12pt 10px 20px 10px; font: 16pt Verdana} td.body { border- border-bottom:1px solid #E8EAEC; padding: 12pt 10px 24pt 10px; } td.footer { border- border-bottom:1px solid #9CA3AD; padding: 4pt 10px 4pt 10px; } a { color:#003399; text-decoration:none; } a:visited { color:#aa00aa; }.bodytext { font: 8pt Tahoma; color: #000000; } </style> </head> <body class="bodytext"> <table class="mail" cellspacing="0" dir=ltr> <tr class="header"> <td class="header">Task assigned by Arputharaj, Joseph R. on 3/21/2014.<br><div style="font: 8pt Tahoma">Due by 3/25/2014.</div></td> </tr> <tr class="body"> <td class="body"><a href="http://ea.share.dtcc.com/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br>Approvers Instructions: <br>Distribution Instructions: </td> </tr> <tr class="footer"><td class="footer">To complete this task:<br><ol><li>Review <a href="http://ea.share.dtcc.com/apps/ITDR/Document/000F6B5D29B22339852571FF00687D82_1.doc">000F6B5D29B22339852571FF00687D82_1.doc</a>.</li><li>Perform the specific activities required for this task.</li><li><!--[if gte mso 12]>Use the <b>Open this task</b> button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click <a href="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/DispForm.aspx?ID=2">here</a> to request access.)<![endif]--><![if !(gte mso 12)]><a href="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/DispForm.aspx?ID=2">Open this task</a> to mark the task as completed.<![endif]></li></ol></td></tr> </table> </body> </html>" ows_FormData="Completed" ows_TaskType="0" ows_WorkflowName="DocApproval" ows_WorkflowLink="http://ea.share.dtcc.com/apps/ITDR/Document/000F6B5D29B22339852571FF00687D82_1.doc, 000F6B5D29B22339852571FF00687D82_1" ows_ContentType="Approval Workflow Task _x0028_en-US_x0029_ Copy 9" ows_LinkTitle2="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_LinkTitle="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_LinkTitleNoMenu="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_DueDate="2014-03-25 20:00:00" ows_StartDate="2014-03-21 11:32:15" ows_Body="<div class="ExternalClassC403724A8A07417080F12FF35AFEDDBF"><a href="/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br />Approvers Instructions: <br />Distribution Instructions: </div>" ows_AssignedTo="10;#Arputharaj, Joseph R." ows_PercentComplete="1.00000000000000" ows_Status="Completed" ows_Priority="(2) Normal" ows_Predecessors="" ows_Title="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_ContentTypeId="0x01080100C9C9515DE4E24001905074F980F9316000752C489605FF424BA2C1B0D2CE27C6E100D42F721FEF83F34B9C1A6459CC75D3FD" xmlns:z="#RowsetSchema"/>
Taskitem.xml ( Before update)
<?xml version="1.0"?><z:row ows_ServerRedirected="0" ows_FolderChildCount="2;#0" ows_ItemChildCount="2;#0" ows__IsCurrentVersion="1" ows__Level="1" ows_MetaInfo="2;#WorkflowCreationPath:SW|c1eadd66-1bf5-4107-b9a6-e1ec2b8d0b88; " ows_BaseName="2_" ows_EncodedAbsUrl="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/2_.000" ows_ServerUrl="/apps/ITDR/Lists/Tasks/2_.000" ows_LinkFilename2="2_.000" ows_LinkFilename="2_.000" ows_LinkFilenameNoMenu="2_.000" ows__EditMenuTableEnd="2" ows__EditMenuTableStart2="2" ows__EditMenuTableStart="2_.000" ows_ScopeId="2;#{33C6A65F-123B-4236-8C96-4B30B0A39286}" ows_ProgId="2;#" ows_UniqueId="2;#{0FA745E3-A05D-49F9-9A94-BCE5AE92F122}" ows_FileLeafRef="2;#2_.000" ows_PermMask="0x400001f07fff1bff" ows_SortBehavior="2;#0" ows_FSObjType="2;#0" ows_Created_x0020_Date="2;#2014-03-21 11:32:15" ows_Last_x0020_Modified="2;#2014-03-21 11:32:15" ows_FileDirRef="2;#apps/ITDR/Lists/Tasks" ows_FileRef="2;#apps/ITDR/Lists/Tasks/2_.000" ows_Order="200.000000000000" ows_SelectTitle="2" ows__ModerationStatus="0" ows_Attachments="0" ows__UIVersionString="1.0" ows__UIVersion="512" ows_WorkflowVersion="1" ows_owshiddenversion="1" ows_Editor="1073741823;#System Account" ows_Author="10;#Arputharaj, Joseph R." ows_Created="2014-03-21 11:32:15" ows_Modified="2014-03-21 11:32:15" ows_ID="2" ows_WorkflowInstanceID="{E8FA3B9F-FB85-47F6-A868-7D4D345FD3AC}" ows_GUID="{DF68F0AA-9130-496D-B461-0707AEC12CDC}" ows_ExtendedProperties="ows_FieldName_ConsolidatedComments='Publication Workflow Task started by Arputharaj, Joseph R. on 3/21/2014 11:32 AM<br />Comment: <a href="http://ea.share.dtcc.com/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br>Approvers Instructions: <br>Distribution Instructions: ' " ows_WorkflowItemId="51" ows_WorkflowListId="{D17E0B4A-A2F0-4CCC-9919-3107B1EAEA17}" ows_Completed="0" ows_SendEmailNotification="0" ows_HasCustomEmailBody="0" ows_EmailBody="<html> <head> <style> table.mail { border-collapse:collapse; width:100%; font: 8pt Tahoma; } td.header { background:#F8F8F9; border:1px solid #E8EAEC; padding: 12pt 10px 20px 10px; font: 16pt Verdana} td.body { border- border-bottom:1px solid #E8EAEC; padding: 12pt 10px 24pt 10px; } td.footer { border- border-bottom:1px solid #9CA3AD; padding: 4pt 10px 4pt 10px; } a { color:#003399; text-decoration:none; } a:visited { color:#aa00aa; }.bodytext { font: 8pt Tahoma; color: #000000; } </style> </head> <body class="bodytext"> <table class="mail" cellspacing="0" dir=ltr> <tr class="header"> <td class="header">Task assigned by Arputharaj, Joseph R. on 3/21/2014.<br><div style="font: 8pt Tahoma">Due by 3/25/2014.</div></td> </tr> <tr class="body"> <td class="body"><a href="http://ea.share.dtcc.com/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br>Approvers Instructions: <br>Distribution Instructions: </td> </tr> <tr class="footer"><td class="footer">To complete this task:<br><ol><li>Review <a href="http://ea.share.dtcc.com/apps/ITDR/Document/000F6B5D29B22339852571FF00687D82_1.doc">000F6B5D29B22339852571FF00687D82_1.doc</a>.</li><li>Perform the specific activities required for this task.</li><li><!--[if gte mso 12]>Use the <b>Open this task</b> button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click <a href="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/DispForm.aspx?ID=2">here</a> to request access.)<![endif]--><![if !(gte mso 12)]><a href="http://ea.share.dtcc.com/apps/ITDR/Lists/Tasks/DispForm.aspx?ID=2">Open this task</a> to mark the task as completed.<![endif]></li></ol></td></tr> </table> </body> </html>" ows_TaskType="0" ows_WorkflowName="DocApproval" ows_WorkflowLink="http://ea.share.dtcc.com/apps/ITDR/Document/000F6B5D29B22339852571FF00687D82_1.doc, 000F6B5D29B22339852571FF00687D82_1" ows_ContentType="Approval Workflow Task _x0028_en-US_x0029_ Copy 9" ows_LinkTitle2="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_LinkTitle="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_LinkTitleNoMenu="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_DueDate="2014-03-25 20:00:00" ows_StartDate="2014-03-21 11:32:15" ows_Body="<div class="ExternalClassC403724A8A07417080F12FF35AFEDDBF"><a href="/apps/ITDR/sitepages/approve.aspx?ListItemUniqueID=4c9c4019-1dd7-48bb-afc2-8a20d9f52e99&">Please click on this link to go to the Status/Approval Screen: </a><br />Approvers Instructions: <br />Distribution Instructions: </div>" ows_AssignedTo="10;#Arputharaj, Joseph R." ows_Status="Not Started" ows_Priority="(2) Normal" ows_Predecessors="" ows_Title="Please approve 000F6B5D29B22339852571FF00687D82_1" ows_ContentTypeId="0x01080100C9C9515DE4E24001905074F980F9316000752C489605FF424BA2C1B0D2CE27C6E100D42F721FEF83F34B9C1A6459CC75D3FD" xmlns:z="#RowsetSchema"/>
SPSecurity.RunWithElevatedPrivileges(delegate()
{
_site.AllowUnsafeUpdates = true;
SPList _taskList = _web.Lists["Tasks"];
_taskItem = _taskList.GetItemById(iTaskID);
string sXml = _taskItem.Xml.ToString();
if (_taskItem != null)
{
Hashtable ht = new Hashtable();
ht[SPBuiltInFieldId.Completed]
= "TRUE";
ht["Completed"]
= "TRUE";
ht[SPBuiltInFieldId.PercentComplete]
= 1.0f;
ht["PercentComplete"]
= 1.0f;
ht["Status"]
= "Completed";
ht[SPBuiltInFieldId.TaskStatus]
= SPResource.GetString(new CultureInfo((int)_taskItem.Web.Language, false), Strings.WorkflowStatusCompleted, new object[0]);
ht[SPBuiltInFieldId.WorkflowOutcome]
= "Approved";
ht["TaskStatus"]
= "Approved";
ht["FormData"]
= SPWorkflowStatus.Completed;
ht["ows_FieldName_Comments"]
= txtComments.Text;
_web.AllowUnsafeUpdates
= true;
bool alterstatus = true;
while (!(alterstatus =
SPWorkflowTask.AlterTask(_taskItem, ht, true)))
{
System.Threading.Thread.Sleep(1000);
alterstatus = SPWorkflowTask.AlterTask(_taskItem, ht, true);
}
_web.AllowUnsafeUpdates
= false;
}
});
Has anybody come across this earlier ?
Thanks,
Ranjit