大家好,
Hi All ,
我正在编写使用psi更新企业项目自定义字段的代码,该值在任务级别得到更新(我的意思是我在项目专业中添加一个任务,我能够看到这个字段自动更新给定值),当我在项目中心视图中添加projectcustom字段时,它显示为null。我该怎么做才能显示那里的值。
I am writing the code to update the enterprise project custom field using psi , the value is getting updated in the task level(I mean when i add a task in project professional i am able to see this field getting automatically updated with the given value) , when i add the projectcustom field in project center view, Its showing null. What should i do to display the values there.
下面是代码 -
是否需要进行任何修改代码。请帮忙。
Should any modifications need to be done in the code.Please help.
Indresh
推荐答案
Indresh,
Indresh,
您提供的代码将仅用于更新项目中已存在的自定义字段。如果需要添加自定义字段,则需要更改。
The code you have provided will ONLY work for updating a custom field that already exists on the project. If the custom field needs to be added, things need to change.
1。您需要实例化一个新的ProjectDataSet(您不能使用您用于读取项目的那个,它必须是一个新的ProjectDataSet())。
1. You need to instantiate a new ProjectDataSet (you cannot use the one that you used to read the project, it has to be a new ProjectDataSet()).
2。您将新的自定义字段添加到此新ProjectDataSet,但您只需设置CUSTOM_FIELD_UID,PROJ_UID,MD_PROP_UID和NUM_VALUE,不要混淆任何其他字段。
2. You will add the new custom field to this new ProjectDataSet, but you only have to set CUSTOM_FIELD_UID, PROJ_UID, MD_PROP_UID and NUM_VALUE, don't mess with any other fields.
3。您将需要调用project.QueueAddToProject()并传入我在上面的步骤1和2中描述的新ProjectDataSet。
3. You will need to call project.QueueAddToProject() and pass in the new ProjectDataSet that I described in step 1 and 2 above.
底线是您不能使用现有的ProjectDataSet来添加新的自定义字段。我上面描述的是许多有经验的PSI开发人员使用的众所周知的模式。
The bottom line is that you cannot use an existing ProjectDataSet to add new custom fields. What I described above is a well known pattern used by many experienced PSI developers.
更多推荐
无法使用PSI更新项目自定义字段。
发布评论