Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

"New instances of this workflow template are currently disallowed" for programmaly start workflow for new SPListItem

$
0
0

Hi, everybody! I need help or advice. I have custom save button for NewForm.aspx and I have exception ""New instances of this workflow template are currently disallowed"", but this button fine work on EditForm.aspx. Why?

protected override bool SaveItem()
        {
            bool result = base.SaveItem();
            if (result)
            {
                try
                {
                    Guid wfid = new Guid("e0e8ee1c-3626-422d-a90b-9e6716e03744");
                    SPWorkflowAssociation ass = base.ListItem.ParentList.WorkflowAssociations.GetAssociationByBaseID(new Guid("e0e8ee1c-3626-422d-a90b-9e6716e03744"));
                    if (ass != null)
                    {
                        base.ListItem.Web.Site.WorkflowManager.StartWorkflow(base.ListItem, ass, ass.AssociationData);
                    }
                }
                catch (Exception ex)
                {
                    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(
                        string.Format(StringResource.ExceptionWF, ".SaveApproveButton", ".StartWF"), TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
                }
            }
            return result;
        }
Exception on string 
base.ListItem.Web.Site.WorkflowManager.StartWorkflow(base.ListItem, ass, ass.AssociationData);


Aleksandr Shramko


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>