Passing Context Map to Configurable Flow Wizard
In Backoffice Framework, there is a functionality that allows you to pass the context map to the Configurable Flow Wizard widget. Owing to the context mapping, the wizard opens with the fields defined in the mapping and already filled in basing on the base item.
- to trigger the configurableFlowWizard from a custom action or a custom widget
- to trigger the configurableFlowWizard from a reference editor
Triggering configurableFlowWizard from Custom Action or Widget
You might pass the context map to a wizard when it is triggered by a custom action or a custom widget. See the example how to configure it.
Context
For the purpose of this example, let's assume that you want to create a custom action responsible for opening the configurableFlowWizard with some populated fields.
The second assumption is that the action input socket is connected with a widget that provides ProductModel on this socket.
The goal is to create a context map that consists of a string, reference, and localized elements.
Procedure
Results
Triggering configurableFlowWizard from Reference Editor
You might pass the context map to a wizard when it is triggered from a reference editor. See the example of how it is done.
Context
Defining a context map for the configurableFlowWizard when it is triggered from the reference editor is simpler than in the case when it is triggered from an action or a widget. The connection between a wizard and a reference editor is already done. Passing the context map to a wizard is done through the cockpit-config.xml file.
- code
- catalogVersion
- name
Procedure
<wz:prepare id="productPrepare"> <wz:initialize property="newProduct" type="ctx.TYPE_CODE"/> <wz:assign property="newProduct.code" value="ctx.parentObject.code"/> <wz:assign property="newProduct.catalogVersion" value="ctx.parentObject?.catalogVersion"/> <wz:assign property="newProduct.baseProduct" value="ctx.parentObject"/> <wz:assign property="newProduct.name" value="ctx.parentObject.name"/> </wz:prepare>
As you can notice, the original context – ctx contains information about base product – parentObject. Owing to this, you can rewrite all of the properties of your interest (code, catalogVersion, and name) in an easy way.