Calculating Dates in Pro using Tasks: Additional Actions

494
1
Jump to solution
02-07-2019 05:06 PM
AndrewHargreaves2
Occasional Contributor III

Hello ArcGIS Pro‌ team & ArcGIS Pro Tasks‌ team

I'm using the additional actions‌ steps to calculated fields‌ when exiting a step. I followed this documentation  to Calculate the current date into my assignedDate field using:

time.strftime("%m/%d/%Y")

 I then attempt to add 14 days to the current date and calculate that value into my dueDate field. According to the same page I should be able to use:

!assignedDate!+datetime.timedelta(days=14)

If i perform the field calculation manually this works fine. However, when using the exact same expression in my additional actions‌ I get the below error 

0 Kudos
1 Solution

Accepted Solutions
AndrewHargreaves2
Occasional Contributor III

I figured this out immediately after posting my original question. I think the value for !assignedDate! isn't actually saved back to the feature service before the task attempts to run the next calculate of 

!assignedDate!+datetime.timedelta(days=14)

Instead I simply calc !assignedDate!  using 

datetime.datetime.now()

and !dueDate! using 

datetime.datetime.now()+datetime.timedelta(days=14)

View solution in original post

0 Kudos
1 Reply
AndrewHargreaves2
Occasional Contributor III

I figured this out immediately after posting my original question. I think the value for !assignedDate! isn't actually saved back to the feature service before the task attempts to run the next calculate of 

!assignedDate!+datetime.timedelta(days=14)

Instead I simply calc !assignedDate!  using 

datetime.datetime.now()

and !dueDate! using 

datetime.datetime.now()+datetime.timedelta(days=14)
0 Kudos