SIL Script - How to add selected CHECKBOX Values as a Issue Comment ?

Sami Ahmed Shaik August 13, 2020

Hello there,

We are trying to achieve the following scenario using SIL Script.

Scenario:

Adding a CHECKBOX selected values as a comment automatically after the transition.

Custom field type : Checkbox

Checkbox Values:

  • For Study
  • For Action
  • For Reply

 

Consider user selects "For Study" & "For Reply" as checkbox values.

 

Expected Comment After Transition:

This issue is updated with the following needed actions

For Study

For Reply

 

 

Kindly help us to achieve the above scenario. Thank you so much.

 

Regards,

Sami Ahmed Shaik.

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2020

Hello @Sami Ahmed Shaik ,

You can create a listener for the Update Issue event with a code like this:

JFieldChange [] changes = lastIssueChanges(key);
for(number i = 0; i < size(changes); i++) {
if (changes[i].field == "customfield_XXXXXX") {
addComment(key, currentUser(), replace(key.customfield_XXXXXX, "|", "\n"));
break;
};
}

Please, replace XXXXXX with your custom field id in two places.

Sami Ahmed Shaik August 13, 2020

@Alexey Matveev 

Thanks for the quick response, I tried with provided script but it's not working.

Is there a way we could use the script in the POST Function instead of listeners ?

 

Using of listeners or live fields is impacting the performance of our instance, so we would like to avoid listeners & live fields.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2020

@Sami Ahmed Shaik ,

1. remove the Checkbox field from the Edit screen (changes in the Edit screen can be caught only be a listener)

2. Create a screen with the Checkbox field in it.

3. Create a transition with this screen.

4. Add a post function to this transition as the last but one (before triggering event) with the code I pasted above.

Sami Ahmed Shaik August 13, 2020

@Alexey Matveev 

As you suggested, I did try with the following code but it's not working

JFieldChange [] changes = lastIssueChanges(key);
for(number i = 0; i < size(changes); i++) {
if (changes[i].field == "customfield_13914") {
addComment(key, currentUser(), replace(key.customfield_13914, "|", "\n"));
break;
};
}
Sami Ahmed Shaik September 6, 2020

@Alexey Matveev 

How can I fix the code ? Could you please help me in achieving this scenario?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2020

@Sami Ahmed Shaik 

You code looks correct to me. You need to debug it. Add a logPrint("ERROR", "your message") ; to your code and have a look what messages you have. You should make sure that your code has been executed. Also look for errors in the atlassian-jira.log file

Sami Ahmed Shaik September 7, 2020

@Alexey Matveev 

Thanks for the response. We are getting the following error while executing the script.

 

2020-09-07 12:10:23,480+0300 pool-11730-thread-1 ERROR e10325 935x147641x1 16pqoy2 10.56.7.22 /rest/keplerrominfo/commons/latest/gadget/programs/jjupin-sil-runner/8/run [c.k.s.lang.routines.LogPrintRoutine] Error Message for SIL Script

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 7, 2020

@Sami Ahmed Shaik 

Could you paste the error? I believe the message is not complete.

Sami Ahmed Shaik September 7, 2020

@Alexey Matveev 

 

We found the following single line error in the Atlassian logs

 

Atlassian Logs

2020-09-07 12:19:22,173+0300 http-nio-8081-exec-7 ERROR e10325 739x205098x1 cnruhp 10.56.7.22 /secure/CommentAssignIssue.jspa [c.k.s.lang.routines.LogPrintRoutine] Error Message for SIL Script

 

SIL Script Console: When trying to DEBUG the script

2020-09-07 12:22:16,504+0300 pool-11730-thread-3 ERROR e10325 950x168686x1 14u1oic 10.56.7.22 /rest/keplerrominfo/refapp/latest/async-script/checkScript [c.k.s.lang.routines.LogPrintRoutine] Error Message for SIL Script

Sami Ahmed Shaik September 7, 2020

@Alexey Matveev 

is this something related to COMMENT PERMISSION ?

Sami Ahmed Shaik September 9, 2020

@Alexey Matveev 

how can we resolve this scenario ? any suggestions please ?

Sami Ahmed Shaik September 10, 2020

@Alexey Matveev 

 

any update how to fix this issue ?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2020

@Sami Ahmed Shaik ,

Please create a support ticket with Cprime:

https://jira.cprime.io/servicedesk/customer/portal/2

Sami Ahmed Shaik September 10, 2020

@Alexey Matveev 

 

I have already raised the cPrime support ticket since last 4 days ago, since then no proper solution from support team.

cPrime Support Ticket # CADS-7083

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.5
TAGS
AUG Leaders

Atlassian Community Events