Tuesday, April 24, 2012 10:39 AM
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!
Tuesday, April 24, 2012 11:52 PMModerator
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
Wednesday, April 25, 2012 7:22 AM
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
Wednesday, April 25, 2012 9:20 AM
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.
- Marked As Answer by Rod Gill MVPMVP, Moderator Wednesday, April 25, 2012 9:51 PM
Wednesday, April 25, 2012 9:23 AM
I'll try this way.