This script retrieves the Assets associated with a Freshservice ticket and adds their details into a Jira Cloud text field. In this example I’ve used Jira Cloud, but you can sync the Assets into a text field on all issue trackers
Freshservice Assets:
How FS assets would be displayed in JC Text field (Environment field):
Script Overview
Fetch Ticket Info Including Assets
The script calls the Freshservice API
def response = httpClient.get("/api/v2/tickets/${ticketId}?include=assets")
Freshservice returns a "ticket" object with an "assets" array inside.
Extract the Associated Assets
All associated assets are stored under:
ticket.assets
Each entry typically includes fields such as:
name,display_id,description,ci_type_id,created
Build a Text Block with StringBuilder
The script uses a StringBuilder to format the asset details cleanly for Jira.
Important:
Different Freshservice instances expose different asset fields depending on configuration, asset schema, and CI types.
To see your asset fields, call:
freshserviceURL/api/v2/tickets/${ticketId}?include=assets
Check the fields available under each asset object, and update the StringBuilder section to include the fields you want Jira to display.
Final Solution
Freshservice Outgoing sync
def response = httpClient.get("/api/v2/tickets/${entity.key}?include=assets")
def ticket = response.ticket
def assets = ticket.assets
//debug.error(assets.toString())
def sba = new StringBuilder()
if (assets && !assets.isEmpty()) {
sba.append("\n\n---\nAssociated Assets\n\n")
assets.each { asset ->
sba.append("• *Name:* ${asset.name ?: 'N/A'}\\n")
sba.append(" - *Description:* ${asset.description ?: 'N/A'}\\n\\n")
}
}
replica.assets = """
${replica.assets
?: ''}
${sba.toString().trim()}
""".stripIndent()
Jira Cloud Incoming sync
I have used the environment field, but you can use a text field of your choosing.
issue.environment = replica.assets
Version
This script is currently working on version 5.29

