Newer Version Available
GenAiFunction
Parent Type
File Suffix and Directory Location
GenAiFunction components have the suffix .genAiFunction and are stored in the genAiFunctions folder.
GenAiFunction components can contain folders for the input and output schemas. Here’s an example component, showing the schema folders.
See the Input Folder and Output Folder sections for more information.
Version
GenAiFunction components are available in API version 60.0 and later.
Special Access Rules
GenAiFunction is available only if Einstein Copilot is enabled in your org.
Fields
| Field Name | Description |
|---|---|
| description |
|
| invocationTarget |
|
| invocationTargetType |
|
| isConfirmationRequired |
|
| masterLabel |
|
Input Folder
The input folder contains a schema.json file with the action inputs. Here’s a sample input schema file.
1{
2 "required" : ["OwnerId", "Status"],
3 "properties" : {
4 "OwnerId" : {
5 "title" : "Owner Id",
6 "description" : "ID of the Salesforce record that owns the request.",
7 "lightning:type" : "lightning__textType",
8 "lightning:isPII" : false,
9 "copilotAction:isUserInput" : true
10 },
11 "Status" : {
12 "title" : "Request Status",
13 "description" : "The status of the contact request.",
14 "lightning:type" : "lightning__textType",
15 "lightning:isPII" : false,
16 "copilotAction:isUserInput" : true
17 }
18 },
19 "lightning:type" : "lightning__objectType"
20}This table describes the properties that you can specify in this JSON file.
Output Folder
The output folder contains a schema.json file with the action output. Here’s a sample output schema file.
1{
2 "properties" : {
3 "Id" : {
4 "title" : "Contact Request Id",
5 "description" : "ID of the Salesforce contact request record.",
6 "lightning:type" : "lightning__recordIdType",
7 "lightning:isPII" : false,
8 "copilotAction:isDisplayable" : true,
9 "copilotAction:isUsedByPlanner" : true
10 }
11 },
12 "lightning:type" : "lightning__objectType"
13}This table describes the properties that you can specify in this JSON file.
| Field Name | Description |
|---|---|
| properties |
|
|
{PROPERTY_NAME} (child of properties field) |
|
|
title (child of properties.PROPERTY_NAME field) |
|
|
description (child of properties.PROPERTY_NAME field) |
|
|
lightning:type (child of properties.PROPERTY_NAME field) |
|
|
lightning:isPII (child of properties.PROPERTY_NAME field) |
|
|
copilotAction:isDisplayable (child of properties.PROPERTY_NAME field) |
|
|
copilotAction:isUsedByPlanner (child of properties.PROPERTY_NAME field) |
|
| lightning:type |
|
Declarative Metadata Sample Definition
The following is an example of a GenAiFunction component.
1<?xml version="1.0" encoding="UTF-8"?>
2<GenAiFunction xmlns="http://soap.sforce.com/2006/04/metadata">
3 <description>get tracking information</description>
4 <invocationTarget>TrackShipment</invocationTarget>
5 <invocationTargetType>apex</invocationTargetType>
6 <isConfirmationRequired>false</isConfirmationRequired>
7 <masterLabel>get_tracking_info</masterLabel>
8</GenAiFunction>The following is an example package.xml that references the previous definition.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>*</members>
5 <name>GenAiFunction</name>
6 </types>
7 <version>60.0</version>
8</Package>Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.