Documentation > CMS Template API Library > Asset > Route(Status,Boolean)


Route the given asset to a workflow step that corresponds to the given status. The asset must have workflow. The status must correspond to one of the steps on the asset's current workflow. If more than one workflow step has the given state, then the lowest step will be chosen. Use Status.Load(string statusName) to load the status. If it returns false, check the context.Error property. Currently, you may only route file assets, routing folders in not supported.

public System.Boolean Route(Status,Boolean)


True if successful, false otherwise.


status The status. CrownPeak.CMSAPI.Status
publishDependencies Optional: Applies only when workflow results in a publish. If true, dependencies will be computed and published if necessary. Defaults to false. System.Boolean

Code Example


// Move the asset to the workflow step that has status set to "LIVE".
bool WasSuccessful = asset.Route(Status.Load("LIVE"));
if (!WasSuccessful)
  Out.WriteLine("Route failed: " + content.Error);

Connect with Crownpeak