4

Hello i have associated a imported a out of the box SharePoint 2010 Publishing Approval Workflow from Sharepoint Designer 2013 to Visual studio 2012 with the import Sharepoint 2010 workflow project in Visual Studio. I have also Assocaited the workflow with C# like you see below:

 public void AddWorkflowAssociationToPagesList(SPList assoicationList, string spWorkflowTemplateGuid)
        {

            try
            {

                SPWorkflowTemplate workflowTemplate =
                    _web.WorkflowTemplates.GetTemplateByBaseID(new Guid(spWorkflowTemplateGuid));

                if (workflowTemplate == null) { _logger.LogError(LoggingCategory.Workflow, "Error in associating workflow with guid: " + spWorkflowTemplateGuid + " The workflowtemplate does not exist in: " + _web.MasterUrl); }

                SPList pagesList = _web.Lists[PublishingWeb.GetPagesListName(_web)];

                if (workflowTemplate != null)
                {
                    var taskList = _listProvisioner.TryGetList(_web, _localaizedWorkFlowTaskList, string.Empty, true, SPListTemplateType.Tasks);
                    var historyList = _listProvisioner.TryGetList(_web, _localaizedWorkFlowHistoryList, string.Empty, true, SPListTemplateType.WorkflowHistory);

                    SPWorkflowAssociation workflowAssocaition = SPWorkflowAssociation.CreateListAssociation(workflowTemplate,_workflowAssociationName, taskList, historyList);
                    assoicationList.WorkflowAssociations.Add(workflowAssocaition);

                    _web.AllowUnsafeUpdates = true;
                    assoicationList.DefaultContentApprovalWorkflowId = workflowAssocaition.Id;
                    assoicationList.Update();
                    _web.AllowUnsafeUpdates = false;
                }
            }
             catch (Exception ex)
            {
                _logger.LogError(LoggingCategory.Workflow, "Error: " + ex + " in associating workflow with id: " + spWorkflowTemplateGuid);                
            }   
        }

The error occurs when i try to publish a page in the pages library: The workflow template has specified no FormURN for this page

The ULS Log gives me this on the correlation id:

    Application error when access /_layouts/15/IniWrkflIP.aspx, Error=The workflow template has specified no FormURN for this page.  
     at Microsoft.Office.Workflow.IniWrkflIPPage.LoadFromWorkflowAssociation()    
     at Microsoft.Office.Workflow.IniWrkflIPPage.OnLoad(EventArgs ea)    
     at System.Web.UI.Control.LoadRecursive() 
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

This does not occur if i change the start condition of the workflow to start when creating a new item in the library, only when starting the workflow by publishing a page.

Has anyone experienced this kind of problem before ?

Regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.