Custom Field Invalid Type Column using PSI in Project Server

In Project Server, when I tried to update a custom field value for specific project using PSI web service. I got the following exception

ProjectServerError(s) LastError=CustomFieldInvalidTypeColumnFilledIn Instructions: Pass this into PSClientError constructor to access all error information

Custom Field Invalid Type Column During updateing a custom field value via PSI in Project Server

This exception specifically occurred when the debug hit the below line of code:

projectSvc.QueueUpdateProject(jobId, sessionId, project, validateOnly);

Cause:

This problem might occur if the custom field type is not matched with the assigned value.

For example, if you tried to update a text data type custom field with date or number value, you will get this error because the field datatype must be matched with the data assigned.


Solution:

The below steps would help to trace this exception and solve it:

  • First of all, you can check the Project Server Error Code from this link.
  • As per the Project error code list, I got that I updated a custom field value with an invalid value.
    • The values type should fall in the following types:
      • (DATE_VALUE).
      • (TEXT_VALUE).
      • (DUR_VALUE).
      • (CODE_VALUE).
      • (FLAG_VALUE).
      • (NUM_VALUE).
  • I checked the custom field data type that I need to update it, by doing the following:
    • Go to Project Server setting:
Project Server Setting
  • Below “Enterprise Data” -> Click “Enterprise Custom Fields and Lookup Tables“.
Enterprise Custom Fields and Lookup Tables
  • Find the required custom field > Below type column check its type.
  • As shown below, the custom field type is Text!
CustomFieldType
  • Go back to the code, and check what’s the assigned value type that you were using
    • In my case, I used the type as DATE_VALUE! that must be TEXT_VALUE.
  • The final code must be as the following:
if (row.MD_PROP_UID == LastHijriUpdatedDate)
 {
 //if yes, write it into the container
 System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("ar-SA");
 row.TEXT_VALUE = DateTime.Now.Date.ToString();
 //and set the indicater
 updatedatacount += 1;
 }

Applies To

  • Project Server 2013.
  • Project Server 2010.

See Also

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s