Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

The specified contract can't be set on the project because it doesn't reference the project in any of its lines.

Posted on by 287

hi,

I am writing the below code & facing this  error on updating Project entity(The specified contract can't be set on the project because it doesn't reference the project in any of its lines). 

Any Idea why???

Guid id = new Guid("7E79BA04-AE38-E811-A956-000D3A2474D1");

Entity TaskObj = (Entity)service.Retrieve("task", id, new ColumnSet(true));
Guid ProjectID = ((EntityReference)TaskObj["beg_projecttaskid"]).Id;
// EntityReference ProjectID = new EntityReference("beg_projecttaskid", TaskObj.Id);
//EntityReference ProjectID = TaskObj.GetAttributeValue<EntityReference>("beg_projecttaskid");
string Description = TaskObj["description"].ToString();
Entity projectObj = service.Retrieve("msdyn_project", ProjectID, new ColumnSet(true));
projectObj["beg_taskcompletion"] = Description;
service.Update(projectObj);

Thanks

Prashant Verma

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans