Create List and Update it


Badge +1

I am stumped here. I want to create a task list from a template that contains a set of standard task (about 8) already in it.  Then I want to update the due date on the new task list from a calculated date I create earlier in my workflow.  My issues is 

1. each task date is different 

2.  I am not sure how to update a task list that doesn't exist.  I thought about doing a web services call but would I have to do that for EACH item?(There will be about 8)

I could create a blank task list and then add each task with a due date but again I am not sure how to do so since each task is different. Maybe create item and then list out all 8?  This seems rather ineffective but maybe I have to do so. 

what I have is  a List as so I run a workflow on create of these items that make the Task list for Math

Program Review    Start Date

1. Math               5/1/2018

2. Science            6/1/2018

Task List                Due Date

1 Set Meeting       -7 Start Date

2 Set Site Visit      +30 Start Date  

Any help would be appreciated.

BTW I have Sharpoint 2013 on-prem and Nintext for same.


7 replies

Userlevel 5
Badge +14

  I am not sure how to update a task list that doesn't exist.  I thought about doing a web services call

yes that's only option if a list doesn't exists at design time.

would I have to do that for EACH item?(There will be about 8)

you can make it with single web service call/action.

see webservice documentation, there are examples how to perform an action on multiple items within single batch.

Lists.UpdateListItems method (WebSvcLists) 

Badge +1

you can make it with single web service call/action.

see webservice documentation, there are examples how to perform an action on multiple items within single batch.

Lists.UpdateListItems method (WebSvcLists)---I am sorry I don't understand how this can be done in a single web call because the due date changes for each item, can you explain or show an example.

 

Userlevel 5
Badge +14

you need to build batch XML like

<Method ID="1" Cmd="Update">
  <Field Name="ID">4</Field>
  <Field Name="Field_DateTime">{WorkflowVariable:DateForItem4}</Field>
</Method>
<Method ID="2" Cmd="Update">
  <Field Name="ID" >6</Field>
  <Field Name="Field_DateTime">{WorkflowVariable:DateForItem6}</Field>
</Method>
Badge +1

So I created

<Batch OnError="Continue" ListVersion="1" >
<Method ID="1" Cmd="Update">
<Field Name="ID">4</Field>
<Field Name="DueDate">{WorkflowVariable:Date1}</Field>
</Method>
<Method ID="2" Cmd="Update">
<Field Name="ID" >6</Field>
<Field Name="DueDate">{WorkflowVariable:Date2}</Field>
</Method>
</Batch>

and ran the workflow which completes with no errors however it does not update the Due Date column

Any Idean what maybe the issue I am trying to update the standard Due Date in a task list the internal mane is DueDate.

my Web method is UpdateListItems

Userlevel 5
Badge +14

what're datatypes of Date variables?

what format do you supply dates to the web service in?

Badge +1

what're datatypes of Date variables? The variables are date types I have to do a Calculate date on them first whatworkflow steps

format do you supply dates to the web service in? I don't have a way to change unless I did a build string or something before setting them, this is how they show in the log. 

Date 1: 4/7/2018 12:00 AM
Date 2: 3/24/2018 12:00 AM
Userlevel 5
Badge +14

that's the problem I guess.

you have to supply date in ISO format, like 2018-03-24T00:00:00Z

and it has to be string not a DateTime.

calculate date option has an option to get calculation result as a ISO formatted string.  so try it this way.

Reply