Assignment Custom Fields through PSI
-
Tuesday, April 24, 2012 10:39 AM
Hi!
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!
All Replies
-
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 Gill
The 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
Jan Cirpka
-
Wednesday, April 25, 2012 9:20 AM
Thanks Rod,
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.
Regards.
- Marked As Answer by Rod Gill MVPMVP, Moderator Wednesday, April 25, 2012 9:51 PM
-
Wednesday, April 25, 2012 9:23 AM
Thank Jan,
I'll try this way.
Regards.