Post

2 followers Follow
0
Avatar

Creating Milestone and child Tasks via REST

I have a process that essentially "copies" a milestone and it's children.  I have code written using VB.NET that has been running successfully for some time, and I am attempting to convert the code base to C#.  While re-creating the process, I am taking the opportunity to modernize a few things.  My problem comes when creating the child tasks (which I do via a bulk/execute call.  I can successfully copy the milestone and children the first time, but when I go to make another copy, the Milestone is copied but the children all fail with the error "Parent object (31.6333833603.23770113) of target object (8.-1.0) not found."  I create the milestone using createAndRetrieve and pull back the External Id for the newly created milestone.  I use that as the "parent" of the tasks.  If I take the call generated by my code and execute it in Fiddler, I get the same result.  If I wait several minutes (30+), and execute the exact code again in Fiddler, it works just fine and generates the children.  Several things don't make sense to me:

 1.  Why can I create it the first time successfully (consistently), but not when I try to make another copy?

 2.  Why does the same code executed half an hour later work?

3.  Why can I consistently copy the same Milestone to a different Project and have it work successfully when I never reference the GrandParent of the child tasks?

4.  Why do I get back a valid External Id for the milestone that I can use in queries, but cannot use for creating the children?

Dierker, Ed Answered

Official comment

Avatar

Hi Ed,

It is very hard to answer your questions without seeing the requests, that you sent to Clarizen. It may be related to some customization in your account or it may be a bug.

Can you please describe your scenario more detailed with requests examples?

Alex Broitman

Please sign in to leave a comment.

3 comments

0
Avatar

sure.  I first Create a Milestone using CreateAndRetrieve (with a body such as: {'entity':{'id':'/Milestone/','Name':'[TRM] Email - detail 10','StartDate':'8/8/2019 8:00:00 AM', 'Parent':'5cmk9iq2he31flpvxckni4zpt11','C_LNRItemType':'Treatment/Project','C_Medium':'Eloqua Email','C_Level3Type':'Treatment','C_LNRLevel':3}, 'fields':['ExternalID']} ).  I am then returned an ExternalID (say: 1u5md7so75lpqgnteicgsibwm46), which I then use as the "Parent" in the body of a CreateAndRetrieve of a Task.  (sample:  {'entity':{'id':'/Task/','TaskType':'General','C_LNRItemTYpe':'Task','C_LNRLevel':'4','C_LNRStatus':'New', 'Name':'[TSK] List - Pull/Scrub','Description':'','Manager':'4e9c8146-893e-4f08-9ab3-e76a646cba7b', 'Parent':'/Milestone/1u5md7so75lpqgnteicgsibwm46', 'C_LNRTaskType':'List Pull/Scrub','C_ReviewDate':'5/3/2017 9:00:00 PM','Duration':{'Value':3,'Unit':'Days'}},'fields':['SYSID']} ).  This works fine when I execute it via Fiddler, but when I build it in to my C# customization, I receive an error:  500 {"errorCode":"General","message":"Parent object (31.6331556547.23770113) of target object (8.-1.0) not found.\r\n","referenceId":"2XNcgQWKUF2IRHhhvKZxbJ"} 

 

at that point, even if I try to re-execute the CreateAndRetrieve in Fiddler, I get the same error.  But, If I wait 30+ minutes, and execute it again, it works.

Dierker, Ed 0 votes
0
Avatar

HI Ed,

Reference fields in your request are without entity type.

For example the "Parent" field should be in form of "/Project/5cmk9iq2he31flpvxckni4zpt11", "manager" field should be "/User/4e9c8146-893e-4f08-9ab3-e76a646cba7b".

After fixing your request (and eliminating the custom fields) I succeeded to run them without any issues.

Can you please fix your requests and try again?

Just a recommendation, please use double quotas in JSON, because this is a JSON standard. While our API interpret this correctly we strongly recommend to follow standard. It is harder to work with single quotas, because many JSON related tools does not understand it.

Alex Broitman 0 votes