SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Apex

Apex static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your APEX code

  • All rules 97
  • Vulnerability2
  • Bug26
  • Security Hotspot3
  • Code Smell66
Filtered: 1 rule found
flow
    Impact
      Clean code attribute
        1. Apex classes should contain at most one "@InvocableMethod" annotation

           Bug

        Apex classes should contain at most one "@InvocableMethod" annotation

        intentionality - logical
        reliability
        maintainability
        Bug
        • salesforce
        • flow

        This is an issue when an Apex class contains more than one method annotated with @InvocableMethod.

        Why is this an issue?

        How can I fix it?

        More Info

        The Salesforce platform only supports one invocable method per Apex class. When a Flow calls an Apex action, it needs to know exactly which method to invoke.

        If multiple methods in the same class have the @InvocableMethod annotation, Salesforce cannot determine which method should be called. This creates ambiguity that the platform resolves by throwing a runtime error.

        The @InvocableMethod annotation is specifically designed to expose Apex methods to declarative automation tools like Flow Builder. Each class acts as a single callable unit from the Flow perspective, so having multiple entry points violates this design principle.

        This limitation is enforced at the platform level and cannot be overridden through configuration or workarounds.

        What is the potential impact?

        When a Flow attempts to call an Apex action from a class with multiple @InvocableMethod annotations, it will fail at runtime with an error. This can cause:

        • Flow execution failures that interrupt business processes
        • User-facing errors in screen flows
        • Failed automated processes that may leave data in an inconsistent state
        • Difficulty troubleshooting since the error occurs at runtime rather than compile time
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories

        © 2025 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use