none
Project Server 2010 - Custom Workflow reads XML file of GUIDs Fails RRS feed

  • Question

  • Basically, I need to a modify my Project Server 2010 custom workflow to be reusable on different servers, which means I can not hard code the GUIDs.  

    This workflow has 3 phases, 18 stages, 8 custom fields, and 2 lookup tables.  So, I have a way that the workflow reads an XML file to get a GUID for the phases and stages and that works.  Now, I need it to do the same for the custom field and lookup tables and it fails.  

    The failure is when running the workflow and submitting the first stage, the Edit button is enabled (Submit is disabled), so I click it to Submit again.  Then the Edit button is disabled, plus the Submit button is still disabled, which I think should NEVER happen!!!  I have tried debug it and it fails to show me values from function.  If I restart the workflow, then I get the error that workflow did not initialize correctly.

    Any ideas? Thanks!

    Friday, October 18, 2013 12:36 PM

Answers

All replies

  • To your point 1&2 if workflow can read values from XML for stages and phases, i think it shouldn't have any problem doing the same for custom fields or lookup tables, as an alternative i have used a custom sharepoint list to hold different UID's at PWA level and is using that for getting all dynamic GUID's for different environment and haven't had any trouble with it for years

    What do you mean by running the workflow and submitting the first stage ? does it means Hitting new button in project center and on New project PDP enetering name for project and hitting save ?

    to your point, Edit button seems to be doing what its expected to do, i.e. checkout the project, and submit ideally wouldn't get enabled unless you checkout the project, now submit button being disabled means yoru workflow is erroring out and hence there is no way for workflow to move forward, hence the submit button disabled

    Failure of workflow can be caused by many things, seems to be related to point 1 wherein you say XML not reading the custom field values, i am assuming "does not show me the values from function" is referring to the values not beong read from the XML file

    Its difficult to troubleshoot the issue without looking at the workflow code and hence would suggest increase the instrumentation in your code and try to debug why it's not reading those values and that might be the key issue here

    Failure of workflow initialization does means its not setting the EPT and associated workflow properly, which can be caused by many things, it could be your XML config file, could be some script not executing properly, which means there is some error being thrown in the workflow, and as said earlier its difficult to troubleshoot the issue without looking at the workflow code


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Friday, October 18, 2013 6:32 PM
    Moderator
  • Thanks for the response!  I will look into using a SharePoint list to hold the GUIDs to get them from the workflow.  Any clues on getting that done as for me time is of the essence! :-)

    David L. Crooks

    Friday, October 18, 2013 6:54 PM
  • Create a custom list on PWA and modify the function below accordingly to read a list item from sharepoint list

      internal static  string GetConfigValue(SPWeb Web , string keyName) // Web = SPContext.Current.Web, keyName = Search Item 
            {
                SPList list = null;
                string returnVal = string.Empty;
    
                try
                {
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                    {
                        list = Web.Lists[“ConfigurationList”];
                        SPListItemCollection itemCollection = list.Items;
                        foreach (SPListItem item in itemCollection)
                        {
                            if (!string.IsNullOrEmpty(item["ItemKey"].ToString()))
                            {
                                if (item["ItemKey"].ToString().ToLower() == keyName.ToLower())
                                {
                                    if (!string.IsNullOrEmpty(item["ItemKey"].ToString()))
                                    {
                                        returnVal = item["Value"].ToString();
                                        break;
                                    }
                                }
    
                            }
                        }
                    });
    
                }
                catch (Exception ex)
                {
                    LoggingService.LogError("Error reading ConfigValue", ex.Message);
                }
    
                return returnVal;
            }
    
    


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Friday, October 18, 2013 7:06 PM
    Moderator
  • Thanks a lot for your quick response!  

    Friday, October 18, 2013 7:34 PM
  • Sunil,

    Quick question.  Where does LogginService come from?  Thanks!

    David L. Crooks

    Monday, October 21, 2013 12:34 PM
  • its part of Sharpoint administration, its used to log the errors in ULS log


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Monday, October 21, 2013 12:38 PM
    Moderator
  • Sunil,

    I get an error that LoggingService does not exist in the current context.

    I created the ConfigurationList SharePoint list with columns ItemKey and Value.

    I am calling the function:

    public Guid Stage1Guid = new Guid(GetConfigValue(SPContext.Current.Web, "<SearchText>");

    I get an error:

    Could not create activity of type <Workflow1.Workflow1> System.NullReferenceException:

    Object reference not set to an instance of an object....

    ----

    Any ideas how I can get passed this?  Thanks!

    David L. Crooks

    Monday, October 21, 2013 2:30 PM
  • I moved the code to the Invoke of the workflow and then it worked.

    • Marked as answer by davidlcrooks Wednesday, November 6, 2013 1:30 PM
    Wednesday, November 6, 2013 1:30 PM