lightning__AgentforceInput Target

Enables a component to be used in agent actions. Use this target to configure your component to accept input data from a user in any agent action.

Syntax 

1<?xml version="1.0" encoding="UTF-8"?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3   <apiVersion>64.0</apiVersion>
4   <isExposed>true</isExposed>
5   <targets>
6       <target>lightning__AgentforceInput</target>
7   </targets>
8   <targetConfigs>
9       <targetConfig targets="lightning__AgentforceInput">
10           <targetType name="lightning__customType"></targetType>
11           <property name="myString" type="lightning__textType"></property>
12           <property name="myBoolean" type="lightning__booleanType"></property>
13       </targetConfig>
14   </targetConfigs>
15</LightningComponentBundle>

targetConfigs (Optional) 

Configures the component for different targets and defines component properties. For agent actions, lightning__AgentforceInput and lightning__AgentforceOutput are supported targets. The targetConfigs tag contains at least one targetConfig tag.

targetConfig 

Configures a component for action input with this attribute.

AttributeDescriptionRequired
targetsSpecify one or more targets in the targets attribute, such as <targetConfig targets="lightning__AgentforceInput"> or <targetConfig targets="lightning__AgentforceInput,lightning__AgentforceOutput">.Yes

targetType (Optional) 

Specifies the data type that an agent action input expects from the component. To create a component that takes in one type of data and expects to return a different type of data, include both sourceType and targetType. For example, a component can let you select a single record from a set of records. The lightning__AgentforceInput target can have both sourceType and targetType, or up to one targetType tag.

AttributeDescriptionRequired
nameName of the Lightning type that the agent action input expects from the component. This can be a standard Lightning type or a custom Lightning type. When you specify a custom Lightning type, you restrict the component to that type. This restriction means the component can only be used with that specific custom Lightning type and can’t be reused with any other. To use this component with a different custom Lightning type, create another <targetConfig> entry and specify the new type in its targetType attribute.

Note

Yes
itemTypeNameName of the Lightning type that the agent action input expects from the component. This can be a standard Lightning type or a custom Lightning type. This attribute can only exist when the name attribute is a list or a similar type.No

sourceType (Optional) 

Specifies the data type that the agent action input provides to the component.

AttributeDescriptionRequired
nameName of the Lightning type that the agent action input provides to the component. This can be a standard Lightning type or a custom Lightning type. When you specify a custom Lightning type, you restrict the component to that type. This restriction means the component can only be used with that specific custom Lightning type and can’t be reused with any other. To use this component with a different custom Lightning type, create another <targetConfig> entry and specify the new type in its targetType attribute.

Note

Yes
itemTypeNameName of the Lightning type that the agent action input provides to the component. This can be a standard Lightning type or a custom Lightning type. This attribute can only exist when the name attribute is a list or a similar type.No

property 

Specifies a public property of a component. The component author defines the property in the component’s JavaScript class by using the @api decorator. See the Usage section.

Use the property tag with these attributes.

AttributeTypeDescriptionRequired
nameStringThe property name. The component’s JavaScript class must have an @api property with the same name as the property name value.Yes
typeStringThe property’s data type. Make sure that this value matches the type assigned to the property in the component’s JavaScript module. If the types don’t match, the value in the configuration file takes precedence. Supports standard Lightning types and custom Lightning types.Yes

Usage 

To expose a component property in an agent action, define the property in the component’s JavaScript class using the @api decorator.

1import { LightningElement, api } from "lwc";
2export default class MyComponent extends LightningElement {
3  @api myString;
4  @api myBoolean;
5}

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.