Reindexing problem with a JJupin customfield

Hello everyone

In our JIRA instance, we have a customfield (JJupin SIL) to return the last comment on an Issue, if the connected user have the right on that issue

On our last reindex, we had a lot of errors in our log:

2015-12-16 22:37:53,626 IssueIndexer:thread-1 ERROR plboucher 1357x3310769x1 1ajxm15 10.145.40.186,127.0.0.1 /secure/admin/IndexReIndex.jspa [keplerrominfo.sil.lang.SILUtils] [SIL Error on line: 4, column: 31] No user logged in.
2015-12-16 22:37:53,628 IssueIndexer:thread-1 ERROR plboucher 1357x3310769x1 1ajxm15 10.145.40.186,127.0.0.1 /secure/admin/IndexReIndex.jspa [jira.commons.silrunner.UnifiedSilRunner] Exception while executing SIL program >>SilScript custom field Default Configuration for Dernier commentaire<<

 

This is the code in my LastComment scripted field

 

JComment cmt = getLastComment(key);

if(!isNull(cmt)){
if(userHasAccessToComment(currentUser(), cmt["id"])){
return userFullName(cmt["author"]) + ": " + cmt["text"];
}
}
return "";

==================================================

 

I think that currentUser is blank when we launch the reindex process, is there a way to modify my code to make my customfield work also on the reindex process

I'm thinking about validate if currentUser is not null, but I don't find that very clean


Please help!

 

Thanks

1 answer

Hi,

The error occurs exactly how you supposed. In order to get rid of that message from the log, you should check if there is any user logged in: https://confluence.kepler-rominfo.com/display/SIL30/isAnyUserAuthenticated


Hope this helps,
Alexandra 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,321 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot