I try to evaluate via Automation Code Snippet the value of requested task due date.
(see attached.)
meanwhile with no success.
How can I do it?
Thanks in advance!
Get Value for Requested tasks due date
Get Value for Requested tasks due date
- Attachments
-
- The required field.
- dueDate.PNG (34.14 KiB) Viewed 26288 times
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Get Value for Requested tasks due date
Here is an example of reading that field and displaying the value in the Errors and Windows panel.
Code: Select all
def RequestedTask_RequestDueDate_Validate(args):
task = args.Context
args.RaiseInformation(str(task.RequestDueDate))
Bob Richards, Senior Software Developer, SoftPro
Re: Get Value for Requested tasks due date
Thank you so much!
But I don't want to create a validation, I want to do something like this:
Each time an order is saved, and the task.requestDueDate field is updated, I want to send a webhook to my server with the new value.
This is what I tried:
1. I went to SPAdmin > Automation > New process.
2. I chose "Each time an order is saved"
3. I added a filter: "The order has a task with specific field...". see attached.
4. I wrote a code snippet, but I don't know how to get the value of requestedDueDate.
def SendWebhook():
order = Context.Root
orderNum = IOrderItem.GetProperty(Context, 'Number')
RequestDueDate = ????? //here I need your help how to do it.
// Send the data to my server, I know how to do it.
SendWebhook()
Thanks!
But I don't want to create a validation, I want to do something like this:
Each time an order is saved, and the task.requestDueDate field is updated, I want to send a webhook to my server with the new value.
This is what I tried:
1. I went to SPAdmin > Automation > New process.
2. I chose "Each time an order is saved"
3. I added a filter: "The order has a task with specific field...". see attached.
4. I wrote a code snippet, but I don't know how to get the value of requestedDueDate.
def SendWebhook():
order = Context.Root
orderNum = IOrderItem.GetProperty(Context, 'Number')
RequestDueDate = ????? //here I need your help how to do it.
// Send the data to my server, I know how to do it.
SendWebhook()
Thanks!
- Attachments
-
- code snippet.PNG (31.94 KiB) Viewed 26273 times
-
- Capture.PNG (16.25 KiB) Viewed 26273 times
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Get Value for Requested tasks due date
The problem with using a condition where you monitor a property for changes is that if the property exists on an item in a collection you won't be able to determine which item was changed - in fact multiple items could have changed. In your use (changes in tasks), you should use the "Everytime a task is added or updated" so you can know which task was changed is you have more than one.
This code snippet can be used as an example of how to get the RequestedDueDate. Your context will be the Requested Task that has the update property. The really nice thing about this technique is if more than one task has a change, the Automation Snippet code will run once for each changed task.
This code snippet can be used as an example of how to get the RequestedDueDate. Your context will be the Requested Task that has the update property. The really nice thing about this technique is if more than one task has a change, the Automation Snippet code will run once for each changed task.
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
# Context is the modified task.
order = Context.Root
# Write modified RequestDueDate to order Project.
order.Project = str(Context.RequestDueDate)
Bob Richards, Senior Software Developer, SoftPro