none
MS Project Server 2013 Cannot remove Task Custom Field Value via PSI RRS feed

  • Question

  • Cannot clear task custom (enterprise) field value in checked out project. What am I doing wrong?

    My update task custom (enterprise) field value is here:

    /// <summary>
    /// Set new task custom field value
    /// </summary>
    /// <param name="projectDS">Checked out single project</param>
    /// <param name="taskRow">Task for update</param>
    /// <param name="lookupTableDS">Lookup tables</param>
    /// <param name="mdPropRow">Enterprise task custom field</param>
    /// <param name="fieldValue">New value for enterprise task custom field</param>
    static internal void SetTaskCustomField(ProjectDataSet projectDS, ProjectDataSet.TaskRow taskRow, LookupTableMultiLangDataSet lookupTableDS, CustomFieldDataSet.CustomFieldsRow mdPropRow, string fieldValue)
    {
        var taskCustomFieldsTable = projectDS.TaskCustomFields;
        var projUid = taskRow.PROJ_UID;
        var taskUid = taskRow.TASK_UID;
        //...
        //Getting current custom field value
        var customFieldRow = taskCustomFieldsTable.Rows.Cast<ProjectDataSet.TaskCustomFieldsRow>().Where(x => x.MD_PROP_UID == mdPropRow.MD_PROP_UID && x.PROJ_UID == projUid && x.TASK_UID == taskUid).FirstOrDefault();
    
        if (!string.IsNullOrEmpty(fieldValue))
        {
            //If new value for task custom field is non empty -> update custom field value. It's WORKING correct
        }
        else
        {
            if (customFieldRow != null)
            {
                try
                {
                    taskCustomFieldsTable.RemoveTaskCustomFieldsRow(customFieldRow);
                }
                catch (Exception e)
                {
                    //Custom logging
                    Logger.WriteError(String.Format("SetTaskCustomField TaskUID = \"{0}\" Deleting Task custom field value Error", taskRow.TASK_UID.ToString()), e);
                }
            }
        }
    }

    After update i call Publish and ChekIn for this project.

    In Project Server Queue all tasks (Update via PSI, Publish and CheckIn) сoncludes with succes status, but task custom field value is not clear!

    Friday, March 31, 2017 6:22 AM