I have implemented automatic commenting on tickets after they are open more than 1 hour.
Hi @sai siva
You need to be more clear. How did you implement automatic commenting? If you share some code snippets, we can help you.
However, as of my understanding, you need to use CommentManager.getComments(issue) to get all comments and check whether the comment was already made.
if( (Durval >= 3) && (esTotalDurVal < 4)) {
issueInputParameters.setComment("Dear Manager the ticket is open more than 3 hours please respond. " +"\n"+ "\n"+
"Thanks and best regards" )
}
else if ( (Durval >= 4) && (esTotalDurVal < 5) ) {
issueInputParameters.setComment (" Dear Manager the ticket is open more than 4 hours please respond. " +"\n"+ "\n"+
}
else if ( (Durval >= 5 ) && (esTotalDurVal < 6)) {
issueInputParameters.setComment("Dear Manager the ticket is open more than 5 hours please respond. " +"\n"+ "\n"+
"Thanks and best regards" )
}
else {
}
Hi This is my automatic comments script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @sai siva
I think I got your point now.
If you want to check whether the automation already made the exact same comment before, you can do that as I mentioned before. Fetch all comments and match the exact string, then set the comment.
On the other hand, you can use a number custom field in order to track when did you comment on the issue. For instance, if Durval = 3 then you comment as well as set the customfield to 3. Next time you check that value accordingly.
if( (Durval >= 3) && (esTotalDurVal < 4) && (latestCommentValue == 3)) {
issueInputParameters.setComment (....)
// set number custom field value to 4
issue.setCustomFieldValue(4)
}
Please bear in mind that this is not the exact code, you need to set custom field values using appropriate parameters.
I hope it makes sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the suggestion , ill try this
any chance i can work without custom fields.
Fetch all comments and match the exact string, then set the comment.
( can i have any examples for gettign comments and matchng the string ?)
soi can check for a string in the comments and make sure no duplicate comments are made?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
Actually I wouldn't recommend that one as there are several special characters such as line feed, quote, space, end of line which might cause problems when doing exact match.
It is better to store it in a variable (here it is customfield)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try or do you have any update on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.