SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

Task URL in workflows..

Last post 09-26-2008, 1:29 PM by DougWare. 25 replies.
Page 2 of 2 (26 items)   < Previous 1 2
Sort Posts: Previous Next
  •  02-27-2008, 10:16 AM 8698 in reply to 8687

    Re: Task URL in workflows..

    Ok, I think I understand what you're trying to do. I've had a little play in the designer and think your workflow must look something like this?

    If it does, then I'm not sure why it wouldn't work, However it's not something I've tried in anger, so I'm not sure whether the workflow will handle task creation within the while loop very well.

    I'd step through the code and check the status of the tasks when you're marking the supervisor task as unapproved, and check on the deletion and recreation of the task.

    http://www.myfatblog.co.uk/images/workflowtop.jpg

    http://www.myfatblog.co.uk/images/workflowbottom.jpg


    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  02-27-2008, 12:11 PM 8713 in reply to 8698

    Re: Task URL in workflows..

    Paul, the workflow is like the one you draw.

    The problem is inside the activity "CreateTaskUser", in that activity the listitemid is -1, i didn't understand what you want me to check..

    What i should check on the deletion and recreation of the task?

    In the createtaskuser i am putting the code i posted before.

    Thanks for your help paul

     

  •  02-27-2008, 12:28 PM 8715 in reply to 8713

    Re: Task URL in workflows..

    Hmm, that method should certainly return an item id integer if the task has been created. the problem is SharePoint doesn't always create the objects when you expect it to, it prepares everything, and then waits for the workflow to hit a point where it would serialize to the database.

    I would be tempted to try placing an OnTaskCreated after the createTask item, and move your code into the methodInvoking for the onCreated. This will force the workflow to wait for the task to be created before trying to do anything with it.

    Paul.


    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  02-27-2008, 12:33 PM 8718 in reply to 8715

    Re: Task URL in workflows..

    Paul i did what you say, i though that what you said was the problem, but the listitemid is still -1 after the onTaskCreated!

    I test it whith cag instead a while and i had the same problem!

  •  02-27-2008, 12:43 PM 8719 in reply to 8718

    Re: Task URL in workflows..

    Hmm, I'm pretty stumped then I have to say.. If you're coming to the userGroup meeting tonight, bring a printout of the SP designer view and your code and we'll take a look if you like.. I'll keep an eye out for a frustrated looking developer with a pile of paper under his arm.. 8-)
    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  02-27-2008, 1:58 PM 8721 in reply to 8719

    Re: Task URL in workflows..

    Paul i don't live in UK, in fact i am far for UK, so i am not going to the meeting tonight.

    If you want i  can send you a simple test with a simple workflow, so you can see the problem.

    Thanks

     

  •  02-27-2008, 2:23 PM 8722 in reply to 8721

    Re: Task URL in workflows..

    No probs, I'll send you my personal e-mail address and you can send me the zipped up VS project.
    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  05-16-2008, 8:06 AM 10781 in reply to 8687

    Re: Task URL in workflows..

    We are also facing the same problem, is it resolved for you, if so please let me know the solution..

    Thanks in advance.

  •  05-16-2008, 10:22 AM 10795 in reply to 10781

    Re: Task URL in workflows..

    What problem are you facing? This thread slipped a little off topic. Post a new message stating what issues you're having and one of us will try and help I'm sure.

    Paul.


    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  09-09-2008, 10:29 AM 13513 in reply to 8684

    Re: Task URL in workflows..

    When I get listItemId it return -1 because I use CreateTask Activity in loop activity but I can use below method for get next ID of task in CreateTask method

     

    taskId = GetNextAvailableIdFromList(workflowProperties.Site, workflowProperties.TaskListId);

     

    public static int GetNextAvailableIdFromList(SPSite site, Guid listId)
            {
                int NextAvailableId = -1;
                if (site.WebApplication.ContentDatabases.Count > 0)
                {
                    string DBConnString = site.WebApplication.ContentDatabases[0].DatabaseConnectionString;
                    SqlConnection con = new SqlConnection(DBConnString);
                    try
                    {
                        con.Open();
                        SqlCommand com = con.CreateCommand();
                        com.CommandText = String.Format("select tp_NextAvailableId from AllLists where tp_ID = '{0}'", listId.ToString());

                        NextAvailableId = (int)com.ExecuteScalar();
                    }
                    finally
                    {
                        con.Close();
                    }
                }
                return NextAvailableId;
            }

  •  09-26-2008, 1:29 PM 13996 in reply to 13513

    Re: Task URL in workflows..

    Bind the ListItemId to a field or property to avoid the -1 problem.
Page 2 of 2 (26 items)   < Previous 1 2
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems