getAgentByEmail

    Using getAgentByEmail in Freshdesk (v5.25.1+)

    • Duplicate Emails: If multiple users share the same email address in an instance, getAgentByEmail retrieves only the first user created with that email.
    • Team Access Required: Ensure the user is part of the team with access to the Freshdesk project; otherwise, the method will not function correctly.

    Method Overview

    • Helper: nodeHelper
    • Signature:
      getAgentByEmail(String email)

    • Available Since: v5.25.1

    Description

    This method searches for an agent using the specified email address.

    Behavior

    • Returns null if:

      • The email is not found, or

      • The email is blank or invalid

    • Returns a BasicHubUser if:

      • A valid agent is found

    Validation

    • Checks if the input string is empty or not in a valid email format

    Returned Object: BasicHubUser

    Includes the following fields:

    • key

    • username

    • displayName

    • email

    Using Agent Information in External Systems (e.g., Jira)

    When syncing agent data from Freshdesk to Jira, it becomes available in Jira to support:

    • Workflow automation

    • Issue tracking

    • Reporting

    • Organizational collaboration

    Jira administrators can use this synced data to optimize existing workflows or build new ones.

    Script Usage Instructions

    Outgoing Script (Freshdesk → Jira)

    This sends the assignee from Freshdesk to the destination system:

    replica.assignee = entity.assignee;

    Incoming Script (Jira → Freshdesk)

    This assigns an agent based on their email address:

    entity.assignee = nodeHelper.getAgentByEmail("xyz@exalate.com");

    Replace "xyz@exalate.com" with the actual agent email.

    Mandatory Script Requirement

    Including this method in your script is mandatory to:

    • Correctly retrieve the agent using their email

    • Successfully assign the agent in the destination system (e.g., Jira)

    Error Handling

    If an invalid or missing email is provided, the sync will fail.

    Condition
    Error Message
    Email is empty or blank
    "Email address must not be empty or blank"
    Invalid email format
    "Invalid email format: abc@"