Create Action

The Create action provides implementation of create operation. It provides the mechanism of invoking another widget logic that creates an object.

Action Definition

Name

Create Action

ID

com.hybris.cockpitng.action.create

Description

This action provides implementation of create operation. The action works as a trigger or proxy: it provides the mechanism of invoking another widget logic that creates an object.

The action allows selection of type that instance should be created. The selection is limited to subtypes of the preselected type. In case of preselection of an abstract type the action enforces selection of one of concrete subtypes.

Author

SAP

Action Class Name

com.hybris.cockpitng.actions.create.CreateAction

Custom Renderer Class Name

DefaultActionRenderer

For more information, see Action Parameters.

Inputs

Details of input sockets:

  • createdObject
    • Type: java.lang.Object
    • Description: A created object instance. The socket is intended to be a callback for the widget, which provides the business logic for the create operation. It is automatically forwarded to the createdObject output socket.

Outputs

Details of output sockets:

  • createdObject
    • Type: java.lang.Object
    • Description: Created object instance is passed through this socket as soon as the instance is returned to the action. The instance is pulled out by a widget that implements the business logic of object creation.
  • createContext
    • Type: com.hybris.cockpitng.actions.create.CreateContext
    • Description: It is used to pass information about the instance. The instance is pulled in a widget providing the business logic of object creation.

Action Preview

The create action is triggered when you click the Create Action icon or choose one selection from the dropdown menu.

Configuration

The create action needs to be bound to a property that resolves to the type code of the objects it is supposed to create. One of the examples is when it is used in the Collection Browser widget. You may want to trigger an action creating an object that is of the same type as the objects displayed in the list. For the Collection Browser widget, the corresponding type code is stored in the widget model and the path to it is pageable.typeCode. You need to bind the action to that property like adding the following lines:

widgetid.zul

<!-- ... -->

<action actionId="com.hybris.cockpitng.action.create" property="pageable.typeCode"/>

<!-- ... -->
You can change the default behavior for the Create Action using the following parameters:

Parameter

Type

Description

contextComponentName

java.lang.String

Optional. Can be used to set a custom component name for context (if you want to point to a particular instance of a widget).

createdTypeKey

java.lang.String

Specifies a key to perform a lookup for a type to create. Type is resolved against context passed to action, or as a fallback, against the context of the parent widget.

forbidSubtypesCreation

java.lang.Boolean

Prevents a user from selecting subtypes, for example: Product – Product Variant, or Category – VariantCategory.

By default, the creation of subtypes is enabled for a user.

initializeEntity

java.lang.Boolean

It serves to inform the application that a new entity has to be created. When the parameter targetComponent is set to editorArea, it is required to set this one as true.

targetComponent

java.lang.String

It is used for setting a target component to be opened after clicking the Create button. Possible values: configurableFlow or editorArea.

To see the example how to set these parameters, refer to the Setting Alternative Behavior for Create Action document.

Notifications

Notification source is the action code or a value of notificationSource parameter, which sets the source name. Create action sends the following notification:

Type Importance level References Description
CreateObject FAILURE com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectCreationException : exception that has occurred. Occurs whenever there is a problem with object creation.

For details regarding notifications, refer to Notification Area Widget.

Dependency

Not applicable.