I am making an association for a SP2010 approval workflow to a list in SP2013.
I am using powershell for this:
$culture2 = New-Object System.Globalization.CultureInfo(“fr-BE”)
$wftemplate=$Web.WorkflowTemplates.GetTemplateByName(‘Approval – SharePoint 2010’,$culture2)
#create history and tasks lists
$historylistguid =$web.Lists.Add(“Workflow History”,””,140)
$historylist =$web.Lists[$historylistguid]
$tasklistguid =$web.Lists.Add(“Workflow Tasks”,””,107)
$tasklist=$web.Lists[$tasklistguid]
#associate the workflow to the list
$workflowAssociation=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($wftemplate,$workflowInstanceName ,$tasklist,$historylist)
$docLib.WorkflowAssociations.Add($workflowAssociation)
$docLib.Update()
While doing this I want to make sure that the workflow is configured to end on first rejection. Any idea on how I can script this?
I tried the method used here with no help https://blogs.msdn.microsoft.com/guruketepalli/2012/11/06/addremove-sharepoint-workflows-thru-powershell/
The information is tored in a field called AssiciatonData which I have no idea how to edit and lookes like this:
AssociationData : <dfs:myFields
xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmln
s:dms=”http://schemas.microsoft.com/office/2009/d
ocumentManagement/types” xmlns:dfs=”http://schema
s.microsoft.com/office/infopath/2003/dataFormSolu
tion” xmlns:q=”http://schemas.microsoft.com/offic
e/infopath/2009/WSSList/queryFields” xmlns:d=”htt
p://schemas.microsoft.com/office/infopath/2009/WS
SList/dataFields” xmlns:ma=”http://schemas.micros
oft.com/office/2009/metadata/properties/metaAttri
butes” xmlns:pc=”http://schemas.microsoft.com/off
ice/infopath/2007/PartnerControls” xmlns:xsi=”htt
p://www.w3.org/2001/XMLSchema-instance”><dfs:quer
yFields></dfs:queryFields><dfs:dataFields><d:Shar
ePointListItem_RW><d:Approvers><d:Assignment><d:A
ssignee /><d:Stage xsi:nil=”true” /><d:Assignment
Type>Serial</d:AssignmentType></d:Assignment></d:
Approvers><d:ExpandGroups>true</d:ExpandGroups><d
:NotificationMessage /><d:DueDateforAllTasks
xsi:nil=”true” /><d:DurationforSerialTasks
xsi:nil=”true”
/><d:DurationUnits>Day</d:DurationUnits><d:CC /><
d:CancelonRejection>false</d:CancelonRejection><d
:CancelonChange>false</d:CancelonChange><d:Enable
ContentApproval>false</d:EnableContentApproval></
d:SharePointListItem_RW></dfs:dataFields></dfs:my
Fields>