The Exalate team will be on holiday for the coming days - returning Jan 4 Enjoy & stay safe
Hallo,
with Serhiy Onyshchenko we(he) write a chunk of code that permit to generate a comment with drived visibility from salesforce to Jira.
Here’s the code
//COMMENT INTERNAL/EXTERNAL
store(entity) replica.addedComments.collect{ comment-> def visibility = comment.internal?"InternalUsers":"AllUsers" def commentid = httpClient.http( "POST", "/services/data/v54.0/chatter/feed-elements", //"{\"Comments\":\"[${comment.author.displayName}] commented: ${nodeHelper.stripHtml(comment.body)}\"}", //"""{"subjectId":"${entity.id}", "body":{ "messageSegments":[{"type":"Text", "text":"${comment.body}"}] }, "feedElementType":"FeedItem", "visibility":"AllUsers"}""", groovy.json.JsonOutput.toJson(["subjectId":entity.id,"body":["messageSegments":[["type":"Text","text":comment.body]]], "feedElementType":"FeedItem", "visibility":visibility]), null, ["Content-Type":["application/json"]]) { req, res2->res2.body.id } def trace = new com.exalate.basic.domain.BasicNonPersistentTrace() .setType(com.exalate.api.domain.twintrace.TraceType.COMMENT) .setToSynchronize(true) .setLocalId(commentid as String) .setRemoteId(comment.remoteId as String) .setAction(com.exalate.api.domain.twintrace.TraceAction.NONE) traces.add(trace)
}
return new scala.Tuple2(issueKey, scala.collection.JavaConverters.asScalaBuffer(traces))
It works very well, but after the last exalate update this code generate an error.
java.lang.NullPointerException
How can we fix?
Hello, Andrea Mura
Might I ask you to try replacing
store(entity)
with
if (firstSync) { binding.variables.put("connection", nodeHelper.connection) store(entity) }
And let me know if this helped?Regards, Serhiy.
Ho Serhiy,
with this cose it gives me an error
No such property: connection for class: services.node.hubobjects.NodeHelperI resolve with: move "store(entity)" in the first sync section
Hallo,
with Serhiy Onyshchenko we(he) write a chunk of code that permit to generate a comment with drived visibility from salesforce to Jira.
Here’s the code
//COMMENT INTERNAL/EXTERNAL
store(entity)
replica.addedComments.collect{
comment->
def visibility = comment.internal?"InternalUsers":"AllUsers"
def commentid = httpClient.http(
"POST",
"/services/data/v54.0/chatter/feed-elements",
//"{\"Comments\":\"[${comment.author.displayName}] commented: ${nodeHelper.stripHtml(comment.body)}\"}",
//"""{"subjectId":"${entity.id}", "body":{ "messageSegments":[{"type":"Text", "text":"${comment.body}"}] }, "feedElementType":"FeedItem", "visibility":"AllUsers"}""",
groovy.json.JsonOutput.toJson(["subjectId":entity.id,"body":["messageSegments":[["type":"Text","text":comment.body]]],
"feedElementType":"FeedItem", "visibility":visibility]),
null,
["Content-Type":["application/json"]])
{
req, res2->res2.body.id
}
def trace = new com.exalate.basic.domain.BasicNonPersistentTrace()
.setType(com.exalate.api.domain.twintrace.TraceType.COMMENT)
.setToSynchronize(true)
.setLocalId(commentid as String)
.setRemoteId(comment.remoteId as String)
.setAction(com.exalate.api.domain.twintrace.TraceAction.NONE)
traces.add(trace)
}
return new scala.Tuple2(issueKey, scala.collection.JavaConverters.asScalaBuffer(traces))
It works very well, but after the last exalate update this code generate an error.
Error Detail Message:
java.lang.NullPointerException
How can we fix?
Hello, Andrea Mura
Might I ask you to try replacing
with
And let me know if this helped?
Regards, Serhiy.
Ho Serhiy,
with this cose it gives me an error
Error Detail Message:
No such property: connection for class: services.node.hubobjects.NodeHelper
I resolve with: move "store(entity)" in the first sync section