Cloning a Change with Change Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2015 09:21 AM
We have a UI Action called "Clone Change" that makes a button that allows a Change to be cloned.
- action.setReturnURL(current);
- current.number='';
- current.state=1;
- current.active=true;
- current.u_send_approvals=false;
- current.u_task_work_effort='';
- current.u_planned_effort='';
- current.business_duration='';
- current.work_start='';
- current.work_end='';
- current.close_notes='';
- current.closed_at='';
- current.closed_by='';
- current.start_date='';
- current.end_date='';
- current.approval='not requested';
- current.insert();
- action.setRedirectURL(current);
- gs.addInfoMessage('Change has been cloned to: ' + current.number);
- action.setRedirectURL(current);
What our group is looking for is to add data from a related table to the cloned change, specifically the Change Tasks and to be honest I am not proficient with scripting to that point, so I am unsure how to recreate it.
I know the table is "change_task" and it has a listing for the Parent with an element of "change_request" So I was thinking that the script would need to look in the change_task table for (current) in the change_request element and if it finds the change number it then copy those change_task records to a newly created change_task record and make the newly created change_request element match the new Change number.
I might be over simplifying, or making it harder than it needs to be. Any suggestions or pointers would be appreciated.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2015 09:54 AM
Hi David,
You are on the right track(writing script to fetch the change tasks , i can help there if needed).
But i have a question.
When you "Clone" a change and create a new one with same values, what is the state on the newly created change.
And at the time of creating the change only all the tasks will be created??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2015 11:49 AM
Hi Anurag,
The state of the newly created change is "Open", no matter what the state of the older change is.
And yes, they want to clone/copy all the tasks from the old to the new change... if they need other tasks then they can create them manually after the clone process is complete.
Thank you with any help in the scripting of this.