The "Create" button that creates a project will need the following code at the end to create two new work items for Milestone 1 (Solution Design and Project Plan):
Patch(
'Project Work Items',
Defaults('Project Work Items'),
{
Name: "Solution Design",
'Team Member': cmbAddWorkItemTeamMember.Selected,
Category: cmbAddWorkItemCategory.Selected,
Description: txtAddWorkItemDesc.Text,
ETA: datAddWorkItemTargetDate.Value,
Milestone: First(gblProject.Milestones),
Priority: cmbAddWorkItemPriority.Selected,
Project: gblProject,
'Work Item Status': LookUp(
'Project Work Item Statuses',
'Project Work Item Status' = cmbAddWorkItemStatus.Selected.'Project Work Item Status'
)
}
);
Patch(
'Project Work Items',
Defaults('Project Work Items'),
{
Name: "Project Plan",
'Team Member': cmbAddWorkItemTeamMember.Selected,
Category: cmbAddWorkItemCategory.Selected,
Description: txtAddWorkItemDesc.Text,
ETA: datAddWorkItemTargetDate.Value,
Milestone: First(gblProject.Milestones),
Priority: cmbAddWorkItemPriority.Selected,
Project: gblProject,
'Work Item Status': LookUp(
'Project Work Item Statuses',
'Project Work Item Status' = cmbAddWorkItemStatus.Selected.'Project Work Item Status'
)
}
)
Since users are not going to picking values for assigned to, status, priority etc., you can hard code those values based on your requirements. Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Microsoft Certified Trainer MCT
Blog | Twitter | LinkedIn | Facebook | YouTube | Email