Compartilhar via


Configure actions

 

Applies To: Dynamics CRM 2013

You may need to create an action so that a developer will use it in code or you may need to edit an action that was previously defined. Like workflow processes, consider the following:

  • What actions should they perform?

  • Under what conditions should actions be performed?

Unlike workflow processes, you don’t need to set the following options:

  • Start When: Actions start when code calls the message generated for them.

  • Scope: Actions always run in the context of the calling user.

  • Run in the background: Actions are always real-time workflows.

An action also has something that workflow processes don’t have – input and output arguments. More information: Define process arguments

In This Topic

Create actions

Edit actions

Create actions

Important

If you’re creating an action that will be included as part of a solution that will be distributed, create it in the context of the solution. Go to Settings > Solutions and locate the unmanaged solution that this action will be part of. Then, in the menu bar, select New > Process. This will make sure that the customization prefix associated with the name of the action will be consistent with other solution components in the solution. After you create the action, you can’t change the prefix.

Like workflow processes, actions have the following properties in the Create Process dialog.

  • Process Name
    This property is used to generate a Unique Name by removing any spaces or special characters from the Process Name.

  • Category
    This property establishes that this is an action process. You can’t change this after you save the process.

  • Entity
    With actions processes, you can select an entity to provide context for the workflow just like other types of processes, but you also have the option to choose None (global). Use this if your action doesn’t require the context of a specific entity. You can’t change this after you save the process.

  • Type
    You can use this property to choose whether to build a new action from scratch or to start from an existing template.

Edit actions

You must deactivate processes before you can edit them.

You may edit an action process that was created as part of an unmanaged solution or included in a solution installed in your organization. If the solution is a managed solution, you may not be able to edit it. The solution publisher has the option to edit the managed properties so that the action installed with a managed solution can’t be edited.

When an action is saved a Unique Name is generated based on the Process Name. This unique name has the customization prefix added from the solution publisher. This is the name of the message that a developer will use in their code.

Important

After the action is activated and code is written to use a unique name, the unique name must not be changed without also changing the code that references it.

When editing an action you have the following options:

  • Process Name
    After the process is created and the unique name is generated from the process name, you can edit the process name. You may wish to apply a naming convention to make it easier to locate specific processes.

  • Unique Name
    When an action is saved, a unique name is generated based on the process name. This unique name has the customization prefix from the solution publisher added. This is the name of the message that a developer will use in their code. Don’t change this unique name if the process has been activated and code is in place expecting to call the action using this name.

  • In transaction
    Generally, processes that support transactions will “undo” (or rollback) the entire operation if any part of them fails. There are some exceptions to this. Some actions developers might do in code initiated by the action might not support transactions. For example, if the code perform actions in other systems that are beyond the scope of the transaction. Those can’t be rolled back by the action running in Microsoft Dynamics CRM. Some messages in the CRM platform don’t support transactions. But everything you can do just with the user interface of the action will support transactions. All the actions that are part of a real-time workflow are considered in transaction, but with actions you have the option to opt out of this.

    You should consult with the developer who will use this message to determine whether it must be in transaction or not. Generally, an action should be in transaction if the actions performed by the business process don’t make sense unless all of them are completed successfully. The classic example is transferring funds between two bank accounts. If you withdraw funds from one account you must deposit them in the other. If either fails, both must fail.

  • Activate As
    Like all processes, you can activate the process as a template and use it as an advanced starting point for processes that follow a similar pattern.

  • Define Process Arguments
    In this area, you will specify any data that the action expects to start and what data will be passed out of the action. More information: Define process arguments

  • Add Stages, Conditions and Actions
    Like other processes, you specify what actions to perform and when to perform them. More information: Add stages and steps

Define process arguments

When a developer uses a message they may begin with some data that they can pass into the message and use. For example, if you want to create a new case record, you may have the case title value that will be passed in as an argument. This would be an input argument.

When the message is finished the developer may need to pass some data that was changed or generated by the message to another operation in their code. These must be defined as an output argument.

Both input and output arguments must have a name, a type, and some information about whether the argument is always required. You can also provide a description.

The name of the message and the information about all the process arguments represent the “signature” for the message. After an action is activated and it is being used in code, the signature must not change. Changing this signature will cause any code that uses the message to fail. The only exception to this may be changing one of the parameters so that it is not always required.

Changing the order of the arguments by sorting them or moving them up or down doesn’t make a difference because the arguments are identified by name, not by the order. Changing the description will not break code using the message.

Action process argument types

The following table describes the action process argument types.

Type

Description

Boolean

A true or false value.

DateTime

A value that stores date and time information.

Decimal

A number value with decimal precision. Used when precision is extremely important.

Entity

A CRM record for the specified entity. When you select Entity, the drop-down is enabled and allows you to select the entity type.

EntityCollection

A collection of entity records.

EntityReference

An object that contains the name, id, and type of an entity record that uniquely identifies it. When you select EntityReference, the drop-down is enabled and allows you to select the entity type.

Float

A number value with decimal precision. Used when data comes from a measurement that isn’t absolutely precise.

Integer

A whole number.

Money

A value that stores data about an amount of money.

Picklist

A value that represents an option for an OptionSet attribute.

String

A text value.

Note

EntityCollection argument values can’t be set in the user interface for conditions or actions. These are provided for use by developers in custom code. More information: Create your own actions

Add stages and steps

Actions are a type of process very similar to real-time workflows. All the steps that can be used in real-time workflows can be used in actions. For information about the steps that can be used for both real-time workflows and actions, see 0b47dfd5-76db-464f-90c0-c64a0173dcdd#BKMK_WorkflowStagesAndSteps.

In addition to the steps that can be used for real-time workflows, actions also have the Assign Value step that is similar to the one used to set variables or input arguments in dialogs. In actions, these can be used only to set output arguments. You can use the form assistant to set output arguments to specific values or, more likely, to values from the record that the action is running against, records related to that record with a many-to-one relationships, records created in an earlier step, or values that are part of the process itself.

See Also

Actions
a987a803-4674-4eb0-87de-caefa003b1eb#BKMK_MonitorSyncWorkflows
Create and edit processes
Workflow processes
Dialogs
Business process flows
Monitor and manage processes
Create your own actions

© 2016 Microsoft Corporation. All rights reserved. Copyright