Documentation > CMS Template API Library > Asset > GetWorkflowByAsset(Asset)

GetWorkflowByAsset

Gets information about a workflow from its workflow asset. This is an asset that is a "workflow file" that can be found in "/System/Workflows" or in the "Workflows" subfolder of a project when using project specific workflows. Use Asset.LoadDirect() with the actual asset id to get an instance of this asset.

public CrownPeak.CMSAPI.Workflow GetWorkflowByAsset(Asset)


Returns

A Workflow object

Parameters

NameDescriptionType
workflowAsset An asset that is a workflow file. See summary for more details CrownPeak.CMSAPI.Asset

Code Example

C#

Sample:
	Asset wfAsset = Asset.Load("/System/Workflows/Basic Workflow"); // Needs to be a workflow asset.
	if(wfAsset.IsLoaded)
	{
		Workflow wf = Asset.GetWorkflowByAsset(wfAsset);
		Out.WriteLine("AssetId: " + wf.AssetId + "<br />");		
		Out.WriteLine("Description: " + wf.Description + "<br />");
		Out.WriteLine("Name: " + wf.Name + "<br />");
		Out.WriteLine("WorkflowId: " + wf.WorkflowId + "<br />");		
	}	

Connect with Crownpeak