24. dubna 2012 10:39
I'm having some problems to add custom fields values to an assignment through PSI. I have some questions:
- When I create an assignment between a resource and a task, the custom fields of both are accesibles in the assignment but is there any way to set their values automatically? They are in the table "MSP_EpmAssignment_UserView" but always with null value.
- When I call the ReadCustomFieldsByEntity I' getting an error "CustomFieldInvalidEntityUID" and I'm not able to find what's wrong in my code (here is the code).
CustomFieldsWebSvc.CustomFields customFieldsSvc = new CustomFieldsWebSvc.CustomFields(); entityTypeGuid = PSLibrary.EntityCollection.Entities.AssignmentEntity.UniqueId; CustomFieldsWebSvc.CustomFieldDataSet customFieldDs = new CustomFieldsWebSvc.CustomFieldDataSet(); customFieldDs = customFieldsSvc.ReadCustomFieldsByEntity(new Guid(entityTypeGuid));
Can anyone help me? Thank you in advanced!
24. dubna 2012 23:52Moderátor
MSP_EpmAssignment_UserView is a read only View in the Reporting db, not a table. It's only updated when the project is published.If you set a custom field to automatically roll down into Assignments, then I think your problem may be solved.
Rod GillThe one and only Project VBA Book Rod Gill Project Management
25. dubna 2012 7:22
We have taken a quite different route (succesfully). See the code snipped below:
// Retrieve the dataset ProjectDataSet projectDataSet = projectDataSet = ProxyHelper.ProjectProxy.ReadProject(projectUid, DataStoreEnum.WorkingStore); // ... some code to find the relevant assignment // var assnUid = ... // Retrieve the custom field (called ClosedUpTo) // The constants are defined elsewhere and are // valid throughout all assignments var closeUpToDateCustomFieldRow = projectDataSet.AssignmentCustomFields.OfType<ProjectDataSet.AssignmentCustomFieldsRow>().Where( acf => acf.MD_PROP_UID == CustomFields.ClosedUpTo.Uid && acf.ASSN_UID == assnUid).FirstOrDefault(); // Set the custom field value closeUpToDateCustomFieldRow.DATE_VALUE =new DateTime(2011,12,31,23,0,0); // ... Check out, Update and Check In
25. dubna 2012 9:20
It's true. It was a confusion when I wrote the post, "MSP_EpmAssignment_UserView" is a view and not a table.
I've just find how to set custom field automatically roll down into Assignments, that was my problem.
- Označen jako odpověď Rod Gill MVPMVP, Moderator 25. dubna 2012 21:51
25. dubna 2012 9:23
I'll try this way.