A workflow defines the action an application should offer the user for a particular tag, such as purchasing a product or claiming a coupon.

Each workflow includes all information required to display the actions (such as the product information) to the user.

After obtaining the tag, use the WorkflowManager to retrieve the workflow information for the tag.


Workflow Types


The WorkflowManager will return one of the following workflow types:

Product
A workflow for a single product that can be purchased immediately or saved in a basket for later.

Basket
A workflow for a 'TemporaryBasket' containing a set of items that can be purchased.

Act
A worfklow for an 'Act' containing custom information required by a merchant as part of a "Call to action".

Catalog
A workflow for a catalog which contains products for review, selection and purchase.


Retrieving a Workflow


  1. Retrieve an instance of WorkflowManager:
WorkflowManager wm = ManagerFactory.GetInstance().WorkflowManager;

  1. Get the workflow using a tag:
Workflow workflow = await wm.GetWorkflowAsync(tag);
switch (workflow.WorkflowType) {
 // Determine the workflow type
}

Determining the Workflow Type


  1. Use the WorkflowType convertion methods to convert the generic workflow object to the correct workflow subclass:
switch (workflow.WorkflowType) {
	case Product:
		ProductWorkflow productWorkflow = WorkflowTypeExtensions.AsProductWorkflow(workflow);
		Product product = productWorkflow.Product;
		break;
	case Basket:
		TemporaryBasketWorkflow basketWorkflow = WorkflowTypeExtensions.AsTemporaryBasketWorkflow(workflow);
		TemporaryBasket basket = basketWorkflow.Basket;
		break;
	case Act:
		ActWorkflow actWorkflow = WorkflowTypeExtensions.AsActWorkflow (workflow);
		Act act = actWorkflow.Campaign;
		break;
	case Catalog:
		CatalogWorkflow catalogWorkflow = WorkflowTypeExtensions.AsCatalogWorkflow (workflow); 
		Catalog catalog = catalogWorkflow.Catalog;
		break;
}

Next Steps

Depending on the returned workflow type you can navigate to the following sections for implementation details for each one:

ProductWorkflow - review the Products page
TemporaryBasketWorkflow - review the Baskets page
ActWorkflow - review the Acts page
CatalogWorkflow - review the Catalogs page