Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

How to set NULL value to custom fileds

$
0
0

Hi,

I want to set new custom field & to update custom field as NULL.

Please provide some solution, I am trying below code while updating and creating new custom field , but while executing code SoapException of Required field is occurring.

 //If custom field not exist
                            if (!isExisting)
                            {
                                ProjectDataSet.ProjectCustomFieldsRow newRow = dtProjCustomFields.NewProjectCustomFieldsRow();
                                newRow.PROJ_UID = project_uid;
                                newRow.MD_PROP_UID = MD_PROP_UID;

                               string filedVAlue = UpdateProjectInfoFromPrjPlan_CFGPC.Program.GetValueForField(customFieldName, projectUID);

                                newRow.CUSTOM_FIELD_UID = Guid.NewGuid();
                                dtProjCustomFields.AddProjectCustomFieldsRow(newRow);

                                //create a new row
                                ProjectDataSet.ProjectCustomFieldsRow cfRow =
                                    dtProjCustomFields.NewProjectCustomFieldsRow();

                                //General parameter
                                cfRow.MD_PROP_UID = MD_PROP_UID; //custom field enterprise id
                                cfRow.CUSTOM_FIELD_UID = Guid.NewGuid();
                                cfRow.PROJ_UID = project_uid; //current project id
                                cfRow.FIELD_TYPE_ENUM = (byte)filedTypeEnum;


                                //field value
                                filedVAlue = UpdateProjectInfoFromPrjPlan_CFGPC.Program.GetValueForField(customFieldName, projectUID);

                                switch (filedTypeEnum)
                                {
                                    case 15:
                                        {
                                            if (filedVAlue != null && filedVAlue != "")
                                            {
                                                newRow.NUM_VALUE = Convert.ToInt32(filedVAlue);
                                            }
                                            else
                                            {
                                                newRow.SetNUM_VALUENull();
                                            }

                                            break;
                                        }
                                    case 21:
                                        {
                                            if (filedVAlue != null && filedVAlue != "")
                                            {
                                                newRow.TEXT_VALUE = filedVAlue;

                                            }
                                            else
                                            {
                                                newRow.SetTEXT_VALUENull();
                                            }

                                            break;
                                        }
                                    case 4:
                                        {
                                            if (filedVAlue != null && filedVAlue != "")
                                            {
                                                try
                                                {
                                                    newRow.DATE_VALUE = Convert.ToDateTime(filedVAlue);
                                                }
                                                catch (Exception ex)
                                                {

                                                }
                                            }
                                            else
                                            {
                                                newRow.SetDATE_VALUENull();
                                            }

                                            break;
                                        }
                                }

 

 


Viewing all articles
Browse latest Browse all 5347

Trending Articles