locked
How can I set the due date for "Collect Data from User" action in Sharepoint Designer workflow??? RRS feed

  • Question

  • I have a Sharepoint Designer workflow, and have some "collect data from user" actions that are run when a new item is created in a list. For each "collect data from user" action, a task is created in the task list. I would like to be able to set the due date for each of these tasks, but when I click "edit", the only editable fieds are the ones that were setup in the "collect data from user" action.

    Am I missing something here?

    Thanks for any feedback!

    Marcus
    Friday, February 27, 2009 7:44 PM

Answers

  • I have a solution to the problem with the help of someone on another forum. Adding the code below to the appropriate place in the edit form created by the "Collect Data From User" action will conditionally show the "assigned to" and "due date" fields depending on the user's permissions. Note that the conditional display part is the piece of xsl that wraps the html (i.e. < xsl:if  test = "ddwrt:IfHasRights(2)" > ). Check out this link on how to conditionally display parts of a page using Sharepoint Designer http://www.wssdemo.com/Blog/archive/2007/08/04/sharepoint-data-view-conditional-formatting-based-on-user-permissions.aspx .

    One thing to be careful of in the code below is not make sure that id attribute unique on the page. For example, below the values are id = "ff5{$Pos} ". If the page already has the same id elsewhere, then just change the it to another value, like id = "ff99{$Pos} " for example.

    Marcus

                         < xsl:if  test = "ddwrt:IfHasRights(2)"
                        < tr >  
                            < td  width = "190px"   valign = "top"   class = "ms-formlabel"
                                < H3  class = "ms-standardheader"
                                    < nobr > Assigned To </ nobr >  
                                </ H3 >  
                            </ td >  
                            < td  width = "400px"   valign = "top"   class = "ms-formbody"
                                < SharePoint:FormField  runat = "server"   id = "ff5{$Pos}"   ControlMode = "Edit"   FieldName = "AssignedTo"  __designer: bind = "ddwrt:DataBind('u',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@AssignedTo')}" /> 
                                < SharePoint:FieldDescription  runat = "server"   id = "ff5description{$Pos}"   FieldName = "AssignedTo"   ControlMode = "Edit" /> 
                            </ td >  
                        </ tr >  
                        < tr >  
                            < td  width = "190px"   valign = "top"   class = "ms-formlabel"
                                < H3  class = "ms-standardheader"
                                    < nobr > Due Date </ nobr >  
                                </ H3 >  
                            </ td >  
                            < td  width = "400px"   valign = "top"   class = "ms-formbody"
                                < SharePoint:FormField  runat = "server"   id = "ff9{$Pos}"   ControlMode = "Edit"   FieldName = "DueDate"  __designer: bind = "{ddwrt:DataBind('u',concat('ff9',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@DueDate')}" /> 
                                < SharePoint:FieldDescription  runat = "server"   id = "ff9description{$Pos}"   FieldName = "DueDate"   ControlMode = "Edit" /> 
                            </ td >  
                        </ tr >  
                        </ xsl:if >  
     

    • Marked as answer by Marcus H Bell Wednesday, May 27, 2009 5:46 PM
    Tuesday, March 24, 2009 6:51 PM

All replies

  • I have not replicated this on my system to test, but can you modify the due date field using another SPD workflow that is attached to the task list and is set to run when an item is added?  Perhaps that workflow can run when a new task is added and set your due date, I'm not sure if you'd have access to any additional fields than you do just attempting to manually edit the task through the UI but it might be worth a try.
    Saturday, February 28, 2009 4:39 AM
  • Thanks for your feedback, Chanda. Yes, I can do what you suggest by setting the due date in another workflow attached to the tasks list, and in fact that is exactly what I have been doing. However, the problem is that I need to have a way to edit the due date as well as the "assigned to" fields at a later point as these sometimes change in our company. You would think that I would just be able to open the task in edit view and have those two fields available. Does anyone know of a way to edit the editform.aspx page in Sharepoint Desinger to add these two fields, but make those two fields visible only to certain users (i.e. admins?)?

    Thanks,
    Marcus
    Monday, March 2, 2009 12:04 AM
  •  I would also like to be able to edit the "assigned to" field for the task that is created by the "collect data from user" action in the workflow. People do sometimes leave the company, after all, before as task is complete, so why should it be such a struggle to change this field??? If this was just a pure task generated directly from the task list utilizing the "task" content type, one can edit the "due date" and "assigned to" fields. But since this is a content type created by the "collect data from user" action in the workflow, the only fields that appear in the edit form are the ones for which I asked the user to provide. I REALLY need to have the ability to edit these fields. Do I really need to code something in Visual Studio to do this?!?! I hope is doesn't need to be that complicated.

    Thanks,
    Marcus

    Monday, March 2, 2009 7:10 PM
  • Marcus,

    I see what you're saying - I'd never had the need to edit a workflow task item so I didn't know that you were only able to edit what was collected during the workflow.  Interesting, and I agree that you should be able to use the other columns that are part of the list.  My guess is that there is some underlying code within SP that controls the editform.aspx page on the fly depending on the content type, so I can think of 2 options, although someone else may have a better idea.

    Option 1: Create a second workflow that can be run manually when the date and/or assignee need to be modified.  You could use the Collect Date From User action again here, but since the Due Date and Assigned To fields already exist you may have to collect the values in Step 1 (into dummy fields) and then copy them over to the original Due Date and Assigned To fields in Step 2 of the workflow.  Of course this would take some training for your users since it wouldn't be like normal editing of the task but rather going to the workflow page for the item and choosing to run the second workflow.

    Option 2: Modify the editform.aspx page using SharePoint Designer.  You can modify this page by choosing to close and hide the original web part (but be sure to leave it on the page), then add a custom list form which shows all of the fields and hide the ones you don't want to see.  I was trying to recreate this on my test system here and it seems logical, but I'm just not sure how to make the fields visible only to admins.  I did find this posting that might work but have not tried it myself (this covers hiding a field on the displayform, I would assume it would work for editform also): http://blog.gemsolution.co.uk/2008/07/16/hiding-a-column-based-on-security-permissions/

    One thing I did notice is that if you choose to edit the item from the list view using the context menu (rather than clicking on the item to display, then choosing edit) the modified editform.aspx page is shown; if you click to display the item then click the edit option it does not show you the modified page, it shows the original with the limited fields...(hope that makes sense, but at least you could train your admins to do it the one way to get the custom page)

    Note: If this is the first time you've customized a list page (new, edit, display) I'd recommend you create a test workflow tasks list and try it out to be sure it works first - if you modify a default lit page like this and accidentally remove or modify the original form web part it can break your list cause you to have to start over.  Here is one post about the process (there are plenty out there, check out a few if you can before you start): http://njbblog.blogspot.com/2007/03/sharepoint-v3-configuring-custom.html

    Hope that helps,
    Chanda

    Tuesday, March 3, 2009 2:14 AM
  • I have attempted Option 1 but i am having an issue with manual workflow being kickoff. Workflow menu option for the task list item is not available to be selected.  This seems to be because the task was assigned from another list. Any ideas why this is? This is really confusing me. All i want to do is change the "Assign To" after a task has been assigned.
    Wednesday, March 4, 2009 6:50 PM
  • Hi, Chanda

    Thanks a lot for your suggestions. That link you provided for hiding columns based on security I think will be quite useful. Regarding your Option 1, creating another workflow with a "collect data from user" action would create another task in my task list that will confuse the end user. Unless I could make that go to another task list and hide it. Hmmm.... Regarding your Option 2, the "Collect Data From User" action creates its own editform under the workflow folder. This form only has the fields that are desired to be gathered from the user. I guess I would try to figure out how to add other fields here (i.e. the "Due date" and "Assigned To") and then try to conditionally show these depending on the user permissions.

    Cheers,
    Marcus
    Thursday, March 5, 2009 6:44 PM
  • Marcus,

    If you want to go with Option 1, check out these two posts about changing the default workflow task list in an SPD worfklow:

    SharePoint Designer's blog: http://blogs.msdn.com/sharepointdesigner/archive/2008/03/31/associate-an-spd-workflow-with-a-specific-task-list.aspx (this is how to change it when first creating a workflow)

    Changing the .xoml file: http://nickgrattan.wordpress.com/2008/04/29/changing-the-task-list-for-sharepoint-designer-workflows/ (which is probably quicker, especially if you already have the workflow created)

    Chanda
    Tuesday, March 10, 2009 2:19 PM
  • I have a solution to the problem with the help of someone on another forum. Adding the code below to the appropriate place in the edit form created by the "Collect Data From User" action will conditionally show the "assigned to" and "due date" fields depending on the user's permissions. Note that the conditional display part is the piece of xsl that wraps the html (i.e. < xsl:if  test = "ddwrt:IfHasRights(2)" > ). Check out this link on how to conditionally display parts of a page using Sharepoint Designer http://www.wssdemo.com/Blog/archive/2007/08/04/sharepoint-data-view-conditional-formatting-based-on-user-permissions.aspx .

    One thing to be careful of in the code below is not make sure that id attribute unique on the page. For example, below the values are id = "ff5{$Pos} ". If the page already has the same id elsewhere, then just change the it to another value, like id = "ff99{$Pos} " for example.

    Marcus

                         < xsl:if  test = "ddwrt:IfHasRights(2)"
                        < tr >  
                            < td  width = "190px"   valign = "top"   class = "ms-formlabel"
                                < H3  class = "ms-standardheader"
                                    < nobr > Assigned To </ nobr >  
                                </ H3 >  
                            </ td >  
                            < td  width = "400px"   valign = "top"   class = "ms-formbody"
                                < SharePoint:FormField  runat = "server"   id = "ff5{$Pos}"   ControlMode = "Edit"   FieldName = "AssignedTo"  __designer: bind = "ddwrt:DataBind('u',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@AssignedTo')}" /> 
                                < SharePoint:FieldDescription  runat = "server"   id = "ff5description{$Pos}"   FieldName = "AssignedTo"   ControlMode = "Edit" /> 
                            </ td >  
                        </ tr >  
                        < tr >  
                            < td  width = "190px"   valign = "top"   class = "ms-formlabel"
                                < H3  class = "ms-standardheader"
                                    < nobr > Due Date </ nobr >  
                                </ H3 >  
                            </ td >  
                            < td  width = "400px"   valign = "top"   class = "ms-formbody"
                                < SharePoint:FormField  runat = "server"   id = "ff9{$Pos}"   ControlMode = "Edit"   FieldName = "DueDate"  __designer: bind = "{ddwrt:DataBind('u',concat('ff9',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@DueDate')}" /> 
                                < SharePoint:FieldDescription  runat = "server"   id = "ff9description{$Pos}"   FieldName = "DueDate"   ControlMode = "Edit" /> 
                            </ td >  
                        </ tr >  
                        </ xsl:if >  
     

    • Marked as answer by Marcus H Bell Wednesday, May 27, 2009 5:46 PM
    Tuesday, March 24, 2009 6:51 PM