且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将子任务的任务名称自动设置为父任务名称

更新时间:2023-01-31 23:12:42

如果我要创建这种自相关类型的列表,我将有一个名为ParentTaskID的字段,该字段返回到Task.ID(父代的ID.)通过此功能,可以在以下情况下选择TaskName来显示父代任务的名称: 您可以创建ParentTaskID字段.我之所以这样说,是因为我不同意在您已经可以免费获得父任务名称"的情况下复制它的需要.

If I were making this self-relational type of list, I would have a field, called ParentTaskID, that refers back to the Task.ID (The ID of the parent.) With that, there is the ability to display the name of the Parent Task, by selecting the TaskName when you create the ParentTaskID field.  I say this, as I don't agree with the need to duplicate the Parent Task Name, when you can already get it for free.

但是,我承认我并不了解所有情况,并声明如果您想自动执行该名称的填充,那么您可以使用SharePoint 2010 WorkFlow并将其关联到列表.

But, I'll admit to not knowing everything, and state that if you would like to automate the population of the name, then you could use a SharePoint 2010 WorkFlow, and associate it to the list.

从那里开始,在创建新项目时,您首先要检查该项目是否为子任务项目". (我不确定您使用什么来识别它,但是不管它是什么,请适当地创建代码.同样,我将有一个ParentTaskID并检查是否 它具有一个值,或者就像不等于零(0)一样简单.)

From there, when a new item is created, you would first check to see if the item is a Child Task Item. (I'm not sure what you're using to discern this, but whatever it is, create the code appropriately. Again, I would have a ParentTaskID, and check that it has a value or maybe just as simple as Not Equal To Zero (0).)

如果这是子任务,则使用WF查找功能,从另一个列表(或类似列表)获取项目,并进行适当的编码以返回父任务名称.您可能必须将其写入WF变量.

If it is a subtask, then use the WF lookup feature, Get Item from Another List (or something like that), and code appropriately to return the Parent Task Name. You may have to write this to a WF Variable.

获得名称后,您可以使用父任务名称更新子任务.

Once the name is obtained, then you can update the Subtask with the Parent Task Name.