Missing invocation target for Agentforce action
Why is this an issue?
Agentforce actions must have a valid invocation target to function. Actions can target:
Apex classes (for complex logic)
Flows (for declarative automation)
An action without a proper invocation target will fail when the agent attempts to use it.
Examples
Example of incorrect configuration:
<!-- Action without invocation target -->
<GenAiFunction>
<description>Get customer details</description>
<masterLabel>Get Customer</masterLabel>
<!-- Wrong invocation target (either MetadataListerWrongName doesn't exist or doesn't contain any @InvocableMethod annotated method -->
<invocationTarget>MetadataListerWrongName</invocationTarget>
<invocationTargetType>apex</invocationTargetType>
</GenAiFunction>
Example of correct configuration:
<!-- Action with Apex invocation -->
<GenAiFunction>
<description>Get customer details</description>
<masterLabel>Get Customer</masterLabel>
<!-- CustomerService exists and contains a @InvocableMethod annotated method -->
<invocationTarget>CustomerService</invocationTarget>
<invocationTargetType>apex</invocationTargetType>
</GenAiFunction>
<!-- Action with Flow invocation -->
<GenAiFunction>
<description>Update customer preferences</description>
<masterLabel>Update Preferences</masterLabel>
<!-- Customer_Update_Preferences exists and is an AutoLaunchedFlow flow -->
<invocationTarget>Customer_Update_Preferences</invocationTarget>
<invocationTargetType>flow</invocationTargetType>
</GenAiFunction>
public with sharing class CustomerService {
@InvocableMethod(label='Get Customer' description='Get customer details')
public static List<Customer> getCustomerDetails() {
// not relevant
}
}
How can I fix violations?
Verify the target exists: Ensure the referenced Apex class or flow is deployed in the project and that the name in
invocationTargetmatches exactly.For Apex targets: Ensure the referenced Apex class has an
@InvocableMethodannotated method.For Flow targets: Ensure the referenced flow is an autolaunched flow (
<processType>AutoLaunchedFlow</processType>).
Resources
