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

Starting a workflow from the ribbon

$
0
0

Hi

I'm running SharePoint 2013 with Workflow Manager 1.0.

I have a SharePoint Desginer Workflow which start from the following URL:

~site/wfsvc/06f8de2413bc41fe869414fc061435f9/WFInitForm.aspx?List={ListId}&ID={SelectedItemId}&TemplateID="

+ workflowTemplateId +"&WF4=1&Source={Source}'

I've included the above in my Custom Action Definition (created programmatically in c# code).

I can however not figure out where to get my workflowtemplateId from. I found some articles about how to do this in 2010 workflows but none about workflow manager 1.0 workflows.

 

 

Just in case it helps. I'm creating the workflow subscription as follows:

 

var clientContext = new ClientContext(web.Url);
var workflowServiceManager = new WorkflowServicesManager(clientContext, clientContext.Web);
var workflowDeploymentService = workflowServiceManager.GetWorkflowDeploymentService();
var workflowSubscriptionService = workflowServiceManager.GetWorkflowSubscriptionService(); 

var unpublishedWorkflowDefinitions = workflowDeploymentService.EnumerateDefinitions(false);
clientContext.Load(unpublishedWorkflowDefinitions);
clientContext.ExecuteQuery();

foreach (var unpublishedWorkflowDefinition in unpublishedWorkflowDefinitions)
{
     if (unpublishedWorkflowDefinition.DisplayName == workflowName)
    {
                                    // Re-Publish the Definition
                                    workflowDeploymentService.RefreshLoad();
                                    clientContext.ExecuteQuery();
                                   
                                    workflowDeploymentService.SaveDefinition(unpublishedWorkflowDefinition);
                                    clientContext.ExecuteQuery();
                                   
                                    workflowDeploymentService.PublishDefinition(unpublishedWorkflowDefinition.Id);
                                    clientContext.ExecuteQuery();
                                                            
                                    // Create new subscription

                                    WorkflowSubscription newSubscription = new WorkflowSubscription(clientContext)
                                    {
                                        DefinitionId = unpublishedWorkflowDefinition.Id,
                                        Enabled = true,
                                        Name = associationName
                                    };

....

I expected templateId to be something like the newSubscription.DefinitionId but that doesn't give me the right Guid.

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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