I want to send the JIRA Priority on a Ticket to Salesforce Cases

I am having issues with the exalate script, I keep getting the error

Unexpected error occurred. The customfield JiraPriority was assigned to value=P1 class=java.lang.String, but it should have been set to a custom field object

The goal is to take the JIRA Priority (po, p1 etc) and surface it in a text field on the Salesforce Case

incoming script sales force

entity.Jira_Eng_Priority__c = replica.customFields.“Jira_Eng_Priority__c”.value.value

outgoing script JIRA
replica.customFields.“Jira_Eng_Priority__c” = issue.priority

this script combo has worked for my custom pick list fields from JIRA >>> SFDC but not for default fields

Hi @Jacob_Kalaj,

It looks like the Salesforce field entity.Jira_Eng_Priority__c expects an object rather than a string. In that case, you’ll need to assign the entire replica.customFields."Jira_Eng_Priority__c" object instead of just its value.

Could you try the following in the Salesforce Incoming script:

entity.Jira_Eng_Priority__c = replica.customFields.“Jira_Eng_Priority__c”

Or

entity.Jira_Eng_Priority__c = replica.customFields.“Jira_Eng_Priority__c”.name

Let me know if this resolves the issue!

I get this error Unexpected error occurred. The customfield Jira_Eng_Priority__c was assigned to value=com.exalate.basic.domain.hubobject.v1.BasicHubPriority@fef class=com.exalate.basic.domain.hubobject.v1.BasicHubPriority, but it should have been set to a custom field object

and with entity.Jira_Eng_Priority__c = replica.customFields.“Jira_Eng_Priority__c”.name

I get this error Unexpected error occurred. The customfield Jira_Eng_Priority__c was assigned to value=com.exalate.basic.domain.hubobject.v1.BasicHubPriority@fef class=com.exalate.basic.domain.hubobject.v1.BasicHubPriority, but it should have been set to a custom field object

Could you share the payload of the Jira replica? Where it shows replica.customFields.“Jira_Eng_Priority__c”?

As you said, you are taking across a system field (not a custom field) from Jira. So, I would keep the Jira outgoing simple i.e.
replica.priority = issue.priority
This line is usually part of the default scripts anyway.

Now if you look at the replica payload arriving in SF, you should be able to visually inspect the the priority data structure, and the attribtue you want from there is name. So, SF incoming would look like:
entity.Jira_Eng_Priority__c = replica.priority?.name

The ? (aka safe navigation operator) is not needed, but is useful to have.

Hope it helps!

Thanks
Majid

1 Like

so here is what ended up working thus far, but I might add the ? to see if it helps , same thinking I ended up having @Majid ! This is working for Status, Key and for Priority from JIRA Standard Fields >>> SFDC Custom Fields @Javier

JIRA Outgoing
replica.priority = issue.priority
replica.status = issue.status
replica.key = issue.key

SFDC Incoming
entity.Jira_Eng_Priority__c = replica.priority.name
entity.Jira_ID__c = replica.key
entity.Jira_Status__c =replica.status.name

I wanted the Key to reflect in a SFDC field so that I can hide the exalate widget from non admins, then created another SFDC that Formulates the ID and adds it to the Atlassian URL our teams can still link to the JIRA ticket so far everything is working

1 Like

Ye, that looks perfect actually! Glad that it worked! The piece that you were getting wrong was trying to push the system priority into a custom field replica object.

So the ? is always good as it protects you in case the other side send nulls.

Please mark the answer as accepted, but let us know if you run into any other issues please.

Thanks
Majid

thank you guys again, appreciate the Exalate team as always. will be leaving reviews for you both!

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.