Jump to content

Duplicate entity with data


kylebjordahl

Recommended Posts

Hey everyone, I'm wondering if there is an easy way to duplicate entities via the python API? 

My aim is to allow non-programmer team members define a template project and then duplicate it into a newly created project.  My plan is to recurse through the descendants tree, but there doesn't seem to be a nice way to duplicate an entity while leaving the immutable stuff out (I've tried creating the project with the template project supplied as the 'data' value in the create method, to no avail). Ideally, I would like to include all the aspects of the project, including the project specific user groups, task assignments, etc.

 

Link to comment
Share on other sites

Hey Mattais,

I figured this was the case, so then I run into a slightly different problem: is there a way to tell which data members of an entity are immutable? I was hoping to iterate through the dictionary for each entity and create a new dict which could be passed as the 'data' argument for the create function, but need to be sure that I don't pass any immutable values, since the create will fail.

Alternately, I suppose it could be done by creating the entity first, then attempting to assign values to the new entity while iterating through the old one, and catching the exceptions along the way. 

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...