Create issue error - Specify the Priority (name) in the string format

Hi

did someone encounter this problem ? Apparently this is some new error:
Could not create an work item with type `Service Ticket` on project `XXX`: Unable to create request because of these errors : Field with id ‘priority’ named ‘Priority’ has these errors : Specify the Priority (name) in the string format.

What i have tried, and in the past it worked:

def priorityMapping = [

    // remote side priority <-> local side priority             

      "Critical" : "Critical",

      "Major" : "Major",

      "Minor" : "Minor",

      "Trivial" : "Trivial"

\]

def priorityName = priorityMapping[replica.priority?.name] ?: “Minor” // set default priority in case the proper urgency could not be found

issue.priority = nodeHelper.getPriority(priorityName)

OR:
issue.priority = nodeHelper.getPriority(replica.priority?.name) ?: nodeHelper.getPriority(“Minor”)

Thank you in advance !

Hi! Thanks for reaching out. Could you please clarify your question or provide more details about what you’re looking to achieve with Exalate? This will help me point you in the right direction or provide the most relevant information.

Hi
Priority is not getting synced

Hi @Bogdan

Jillani here and thank you for opening a community post.

May I know what instances you are using (for example Jira, Azure etc)

Regards,

Jillani

Hi
sorry for the missing infos :slight_smile:

We use Exalate Scripts with jira Cloud to cloud.

Thank you & BR

Thank you for the update.

The error suggests that the receiving system expects the Priority field to be set using a string value (the name of the priority), not an object or ID.

The nodeHelper.getPriority() function returns a Priority object, which works for some Jira configurations, but some systems (especially Jira Service Management or Azure DevOps) require the priority to be set as a string (the name of the priority).

Try setting the priority as a string directly:

   def priorityMapping = [
    "Critical" : "Critical",
    "Major" : "Major",
    "Minor" : "Minor",
    "Trivial" : "Trivial"
]
def priorityName = priorityMapping[replica.priority?.name] ?: "Minor"
issue.priority = priorityName
  • Use the string name of the priority, not the Priority object.
  • Double-check the field name and how your destination system expects the value (sometimes it’s issue.priority, sometimes a custom field).

Useful Article: Sync Issue Priority Fields in Jira Cloud | Exalate Doc

Please check and let me know the outcome.

Hi

Funny enough, it requires a string, and then it complains about it:

Error Detail Message:

Illegal argument type class java.lang.String for setPriority

com.exalate.api.exception.script.ScriptException: Illegal argument type class java.lang.String for setPriority at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:51) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:77) at com.exalate.replication.services.processor.CreateIssueProcessor.$anonfun$executeScriptRules$1(CreateIssueProcessor.scala:221) at scala.util.Try$.apply(Try.scala:210) at com.exalate.replication.services.processor.CreateIssueProcessor.executeScriptRules(CreateIssueProcessor.scala:213) at com.exalate.replication.services.processor.CreateIssueProcessor.$anonfun$createIssue$1(CreateIssueProcessor.scala:119) at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalArgumentException: Illegal argument type class java.lang.String for setPriority at

Hi again

I did use this time
def priorityMapping = [
“Critical” : “Critical”,
“Major” : “Major”,
“Minor” : “Minor”,
“Trivial” : “Trivial”
]
def priorityName = priorityMapping[replica.priority?.name] ?: “Minor”
issue.priority = nodeHelper.getPriority(priorityName)

Lets see.

BR

Hi @Bogdan

Appreciate the update. In light of your last comment, may I know if the error again appeared or not?

Hi

Apparently this time it went through.

No errors so far.

Thank you for your support !

BR

Hi @Bogdan

Glad to learn that the shared information was helpful and the error is no longer appearing. :slight_smile:

BR,
Jillani