Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Syncing Priority Field in Freshservice Integration via JSM Automation

Mahipal Singh January 9, 2025

Hello Team,

I am working on integrating Freshservice with Jira Service Management (JSM) and facing an issue with syncing the priority field. In JSM, I have set up an automation rule as follows:

  • Event: When an issue is created, an action is triggered to use a lookup table, where the keys are "Urgent," "High," "Medium," and "Low," corresponding to numeric values 4, 3, 2, and 1, respectively.

  • Action: The next step is a web request to create a ticket in Freshservice. In the custom data for the web request, I am trying to pass the priority value using this syntax:

"priority": "{{priorities.get(issue.priority.name)}}"

 

However, when I validate the web request, I am receiving the following error for the priority field:

"field": "priority", "message": "It should be one of these values: '1, 2, 3, 4'", "code": "invalid_value"

 

It seems like the value passed for the priority field isn't matching the expected values (1, 2, 3, 4). Could anyone assist me in resolving this error and ensure that the priority value is properly passed to Freshservice?

Thank you in advance for your help.

1 answer

1 accepted

3 votes
Answer accepted
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025

Hi and welcome to the community!

If I understand your question correctly, this one should be posted in the Freshdesk community since you are getting the error from their API.

Jeroen

Mahipal Singh January 9, 2025

Hi Jeroen,

Thanks for your response! It’s possible that this could be an error, so I’ve raised it with the Freshservice community for further investigation.

However, I’ve noticed that the value being generated from the syntax is being treated as text, even though I’m trying to pass a numeric value. The issue is that when I manually set a value like 2, it works perfectly fine. So, I suspect that the problem lies with how the value is being generated from the syntax.

Can you please guide me on how I can modify the syntax to ensure that it generates a numeric value instead of a text string? Any advice on how to pass the value as a number would be greatly appreciated.

Thanks again for your help!

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

Hi,

Can you try:

"priority": "{{priorities.get(issue.priority.name).asNumber}}"

Jeroen

Mahipal Singh January 10, 2025

Thanks Jeroen,

I am still facing the same error.

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

I assume you are doing a webrequest from an automation rule? If so, would tou mind sharing the body of your request?

Also try omitting the quotes :-) 

"priority": {{priorities.get(issue.priority.name).asNumber}}

Jeroen

 

Mahipal Singh January 10, 2025

Correct, I am making a web request and have tried omitting the quotes, but I am still facing the same issue. Below is the body of the request.

{
"subject": "{{issue.summary}}",
"description": "{{issue.description}}",
"category": "{{issue.customfield_10476}}",
"sub_category": "{{issue.Request_Type.requestType.name}}",
"department_id": 55000429234,
"priority": "{{priorities.get(issue.priority.name).asNumber}}"
"status": 2,
"source": 3,
"custom_fields": {
"raised_by": "CF Test 1",
"raised_by_analyst": "Store",
"jira_id": "{{issue.key}}"
},

"email": "{{issue.reporter.emailAddress}}"

}

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

I still see this line:

"priority": "{{priorities.get(issue.priority.name).asNumber}}"

Replace is by:

"priority": {{priorities.get(issue.priority.name).asNumber}}

Without quoting the numeric value.

 

Mahipal Singh January 10, 2025

Jeroen,

I have try both option and face same error

 

Mahipal Singh January 10, 2025

On first one: error which i have faced is value should 1,2,3, and 4.

and On second one: Invalid Json

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

Ok, then the last thing to check on Atlassian side is whether the expressions returns what you think it does. Put in a Log action and write both values to the log (first and second) and validate if it is correct (you can find the log in the audit log of the rule).

Jeroen

Mahipal Singh January 10, 2025

Value: "{{priorities.get(issue.priority.name).asNumber}}"

Issue created
01/10/2025, 15:18:41

Create lookup table
01/10/2025, 15:18:42
Send web request
01/10/2025, 15:18:42

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"description":"Validation failed","errors":[{"field":"priority","message":"It should be one of these values: '1,2,3,4'","code":"invalid_value"}]}
Log action
01/10/2025, 15:18:42

Log
"priority": ""

Value : {{priorities.get(issue.priority.name).asNumber}}

Issue created
01/10/2025, 15:20:50

Create lookup table
01/10/2025, 15:20:51
Send web request
01/10/2025, 15:20:51

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"code":"invalid_json","message":"Request body has invalid json format"}
Log action
01/10/2025, 15:20:51

Log
"priority":

Value: "{{priorities.get(issue.priority.name)}}"

Issue created
01/10/2025, 15:22:08

Create lookup table
01/10/2025, 15:22:09
Send web request
01/10/2025, 15:22:09

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"description":"Validation failed","errors":[{"field":"priority","message":"It should be one of these values: '1,2,3,4'","code":"invalid_value"}]}
Log action
01/10/2025, 15:22:09

Log
"priority": ""

Value: {{priorities.get(issue.priority.name)}}

Issue created
01/10/2025, 15:25:12

Create lookup table
01/10/2025, 15:25:13
Send web request
01/10/2025, 15:25:13

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"code":"invalid_json","message":"Request body has invalid json format"}
Log action
01/10/2025, 15:25:13

Log
"priority":

Mahipal Singh January 10, 2025

Jeroen, i have try four value and attached their logs.

Can you please check and let me know if i have done correctly.

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

It looks like your lookup isn't working, there is no value logged to the rule audit log.

Check issue.priority.name in the same way, check every step where you expect a value via the log action until you find where something does not have a value where it should have.

Jeroen

Mahipal Singh January 10, 2025

Also, i have try direct smart value in JSM

Value: "priority": "{{issue.priority}}"


Issue created
01/10/2025, 15:29:02

Create lookup table
01/10/2025, 15:29:03
Send web request
01/10/2025, 15:29:03

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"description":"Validation failed","errors":[{"field":"priority","message":"The value provided is of type String.It should be one of these values: '1,2,3,4'","code":"datatype_mismatch"}]}
Log action
01/10/2025, 15:29:03

Log
"priority": "3"

As you can see the value generating is as string

Mahipal Singh January 10, 2025

Value: "priority": "{{issue.priority.name}}"


Issue created
01/10/2025, 16:27:19

Create lookup table
01/10/2025, 16:27:20
Send web request
01/10/2025, 16:27:20

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"description":"Validation failed","errors":[{"field":"priority","message":"It should be one of these values: '1,2,3,4'","code":"invalid_value"}]}
Log action
01/10/2025, 16:27:20

Log
"priority": "2 High"

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

There you go, it returns "2 High" instead of "High". Your lookup table should reflect that.

Mahipal Singh January 10, 2025

Value:  "{{priorities.get(issue.priority.name)}}"

Issue created
01/10/2025, 16:35:47

Create lookup table
01/10/2025, 16:35:48
Send web request
01/10/2025, 16:35:48

Unable to publish the web request - received HTTP status response:
400
Error found in the HTTP body response:
{"description":"Validation failed","errors":[{"field":"priority","message":"The value provided is of type String.It should be one of these values: '1,2,3,4'","code":"datatype_mismatch"}]}
Log action
01/10/2025, 16:35:48

Log
"priority": "3"

Mahipal Singh January 10, 2025

I tried this without quotation marks, and this time it worked. Thank you so much for your help. I really appreciate it!"

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2025

Ok, good!

Kindly accept the answer so it is marked resolved.

Jeroen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events