Looking to see if anyone has tried to develop a script that could create a series of task records from a predefined list. For example; if a phase of a standard project plan always uses the same tasks is there a way to create these tasks via scripting automatically any time that a new record of that project phase is created?
This would then allow us to give ownership of these tasks to a specific resource as a means of supporting project management without having to re-create the taks manually each time.
Thanks!
Hi Dan,
Yup your right, you can script task into the proget management tab, Attacted is a handy guilde for working with task in the Progect Management tab.
Hi Joe,
Can scripting not be used to add a task to the PM tab? The text below is taken from the help section;
Methods on the item.project Object
item.project.addTask(); item.project.addTask(TASK_NAME, START_DATE, END_DATE, "PROGRESS_PCT"); item.project.addTask(TARGET_ITEM, START_DATE, END_DATE, PROGRESS_PCT)
Method to add manual or linked tasks to the item's Project Management tab. You can pass task property values in a task object, as an array of values, or in a related item. Properties passed are TASK_NAME=title, TARGET_ITEM=target, START_DATE=start_date, END_DATE=end_date, PROGRESS_PCT=progress.
David.
Dan,
Sorry, not sure what I was thinking about in the earlier reply, I have edited to give a correct answer.
Here’s how you could go about completing what you are looking for.
You could complete this one of two ways: As a for loop, or as a hardcode if statement.
A great example of how to complete this task can be found in your tenant already under the script: CAPAMileStones with its library, createMileStones. The basic concept of the script is the same which is the Script sets what needs to be added and calls on the function for how and where to add it. This will very much translate into what you are looking for.
Hello David and thank you very much for your reply.
For reasons I will not get into here I have moved to attempting to spawn a new item record in a seperate workspace in support of project management. The script below runs about half way. By that I mean it creates the new item record as desired but does not carry over the data from the existing TITLE field to the new PROJECT_TITLE field like I would like it to.
I feel like it should work having reviewed some standard scripting. If you have any thoughts that you could spare they would be greatly appreciated.
if(item.CREATE_STATION_TASKS === 'Yes'){
var newItem = createNewItem('WS_STATION_1_TASKS', newProperties);
var newProperties = [];
newProperties.PROJECT_TITLE = item.TITLE;
if(newItem !== null){
item.CREATE_STATION_TASKS = newItem;
}
}
Regards,
Dan
Hi Dan,
Make sure that the fields are all compatible with the types of values you are writing into them. The easiest way to verify is to make all of the target fields into ‘single line text’ type with a 100 character length. Fields do not need to be editable to be able to write to them using a script.
Also, use a println line in your script to check that you’re script logic isn’t the issue.
Regards,
David
Is it possible through scripting to change the dates in a project management task? I have a tasks workspace with start date and end date. The items in this workspace are tasks in the pm tab of another workspace. Ideally, if the start or end dates in my tasks workspace are modified, a script would sync the new dates to the pm tab in the other workspace. The only documented method on the project item is addTask(). Is what I'm trying to do even possible?