locked
Table MSP_PROJECT_CUSTOM_FIELDS RRS feed

  • Question

  • Hello! I can't write value to task custom field. I try write value for field which in table MSP_PROJECT_CUSTOM_FIELDS. But I get error CustomFieldInvalidUID. For table MSP_CUSTOM_FIELDS no problems.
    Thursday, December 23, 2010 7:27 AM

Answers

  • Hi Andromeda,

    You set
    rProjCF.MD_PROP_UID = fieldUID;
    and
    fieldUID = New Guid("");
    You should set MD_PROP_UID  to the identifier of the custom field, not to a new Guid. In addition you need to set the CUSTOM_FIELD_UID property to Guid.NewGuid();

    Make sure to take a close look to Brian's code sample. It's all there.

    Let us know if this helps,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 11:42 AM

All replies

  • Hi Andromeda61,

    What version of Project Server are you using?

    Writing data directly to the database is not supported (for all versions) and will not work. So you should not even try to do this.

    • For Project Server 2003, you need to use the PDS or client object model to programmatically write to custom fields
    • For Project Server 2007 and 2010, you need to use the PSI or client object model to programmatically write to custom fields

    Check the SDK of the version you are using for instructions on how to write your own application that can update custom field values.

    I hope this helps,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 7:48 AM
  • I use Project Server 2010 and PSI. I use suсh code for custom task field:

    ProjectDataSet

     

     

    .TaskCustomFieldsRow rProjCF = projectDs.TaskCustomFields.NewTaskCustomFieldsRow();

    It works fo fields in table MSP_CUSTOM_FIELDS, but don't work for table MSP_PROJECT_CUSTOM_FIELDS

    Thursday, December 23, 2010 8:00 AM
  • In that case, I advice you to check out 2 excellent blog posts made by Brian Smith:

    General info (for 2007, but most of it still applies to 2010):
    http://blogs.msdn.com/b/brismith/archive/2007/12/06/setting-custom-field-values-using-the-psi.aspx
    Make sure to read through it as it contains valuable information (like custom field rows not created by default if no default value is specified, etc.)

    Code sample:
    http://blogs.msdn.com/b/brismith/archive/2010/08/25/project-server-adding-custom-fields-to-projects-and-tasks-using-the-psi.aspx

    I hope this helps,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 8:08 AM
  • Infortunately it doesn't help me. For fields in table MSP_PROJECT_CUSTOM_FIELDS this doesn't work.
    Thursday, December 23, 2010 8:46 AM
  • The code is in the blog post:

    WebSvcProject.ProjectDataSet.ProjectCustomFieldsRow cfRowCost = dsProject.ProjectCustomFields.NewProjectCustomFieldsRow();
    cfRowCost.PROJ_UID = projectGuid;
    // The Custom_Field_UID is the unique identifier for each custom field row
    cfRowCost.CUSTOM_FIELD_UID = Guid.NewGuid();
    // The MD_PROP_UID identifies the specific custom field
    cfRowCost.MD_PROP_UID = projCostGuid;
    // Cost custom fields have their value set in NUM_VALUE
    // The value entered is decimal and 100 times the actual cost - 5000 = $50 in my case
    cfRowCost.NUM_VALUE = 5000;

    What exactly do you mean by 'For fields in table MSP_PROJECT_CUSTOM_FIELDS this doesn't work.' Are you talking about a database table here? Or about a dataset? Do you get an error? Why are you referring to a  MSP_PROJECT_CUSTOM_FIELDS  table if you are trying to update a task custom field?

    Have you tried the code from the blog post?
    Can you post your code here (only the relevant part where the error occurs)?

    I'm sorry, but 'it doesn't work' is not sufficient information for us to help you. So please explain briefly what you are trying to achieve.

    Regards,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 8:59 AM
  • These fields is in PWA:  Server parametrs -> ViewsMain -> changing of viewmain -> item "table and fields" accessible fields (for example field Data1). I can't write a value to this field.

    Thursday, December 23, 2010 9:59 AM
  • Hi Andromeda61,

    Can you please give a detailed description of what you are trying to do.

    In your first post you say: "I can't write value to task custom field"
    In a next post you say you have problems with " table MSP_PROJECT_CUSTOM_FIELDS"
    And now you point me to "Manage Views" in PWA where you can't add a field to a view

    These are 3 totally different things so this is very confusing and I have no idea what you are trying to do. Can you please explain functionally what you are trying to do?

    Thank you,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 10:36 AM
  • This is my code:

    SvcProject.ProjectDataSet.TaskRow taskRow = projectDs.Task.NewTaskRow(); taskRow.PROJ_UID = projectId;

    taskRow.TASK_UID = taskGuid;

    taskRow.TASK_NAME = TaskName;

     taskRow.TASK_FINISH_DATE = dateFinish;

     taskRow.TASK_START_DATE = dateStart; projectDs.Task.AddTaskRow(taskRow);

    ProjectDataSet.TaskCustomFieldsRow rProjCF = projectDs.TaskCustomFields.NewTaskCustomFieldsRow();

     fieldUID = New Guid("");//MD_PROP_UID of field Data1 rProjCF.CUSTOM_FIELD_UID = Guid.NewGuid();

    rProjCF.MD_PROP_UID = fieldUID;

    rProjCF.PROJ_UID = projectId;

    rProjCF.TASK_UID = taskGuid; rProjCF.DATE_VALUE = DateTime.Now; projectDs.TaskCustomFields.AddTaskCustomFieldsRow(rProjCF);

    The field Data1 is not standart custom task field. It can be seen at adress: http://project/pwa/_layouts/pwa/Admin/ViewsMain.aspx then http://project/pwa/_layouts/pwa/Admin/ViewsAddMod.aspx for change views. At this page it is list of fields (Data1, Data2,..., Data10). I need do changing to fields Data1 and Data2 for my tasks.

    • Edited by Andromeda61 Thursday, December 23, 2010 11:24 AM formatting
    Thursday, December 23, 2010 11:22 AM
  • Hi Andromeda,

    You set
    rProjCF.MD_PROP_UID = fieldUID;
    and
    fieldUID = New Guid("");
    You should set MD_PROP_UID  to the identifier of the custom field, not to a new Guid. In addition you need to set the CUSTOM_FIELD_UID property to Guid.NewGuid();

    Make sure to take a close look to Brian's code sample. It's all there.

    Let us know if this helps,
    Hans


    My EPM blog: Projectopolis
    Thursday, December 23, 2010 11:42 AM
  • Hello! Thank you very much for your help.

     I set rProjCF.MD_PROP_UID = New Guid("52C15C90-0378-4650-BA4F-05AED6B9493A");//this is existing guid of field Data1

    This guid is exactly correct. But I get error CustomFieldInvalidUID. May be this is becаuse of the field Data1 is not standart custom field.

    I also set the CUSTOM_FIELD_UID property to Guid.NewGuid();

     

    Thursday, December 23, 2010 12:29 PM