Script runner Behaviours problem

Tomasz Bryla February 1, 2019

Hi,

I just installed a tScript Runner and I have big problem. I'm not able to add a Behaviours (look on screenshot). I was cleared plugins cache and it's doesn't help. obraz.png

1 answer

1 accepted

1 vote
Answer accepted
Matthew Clark
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.
February 1, 2019

Hi Tomasz

Can you go to the Manage add-ons page, find Scriptrunner, click it to expand the Scriptrunner section and then expand the section that says "xxx of xxx modules enabled"

Then check to see if the " Behaviour admin assets (bh-admin) " module is enabled or disabled?

Tomasz Bryla February 4, 2019

Hi Matthew,

I have all modules enable.

Matthew Clark
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.
February 4, 2019

Hi Tomasz

Do you see any errors in the Browsers Developer Console tab when you try to load the behaviours page?

Can you tell me the Scriptrunner version you installed and if you upgraded, please tell me from which version you upgraded?

Did you manage to create any behaviours before this issue happened?

Tomasz Bryla February 5, 2019

Matthew,

I jus installed Script Runner, but I don't know full history of instalation this addon on this Jira instance. I checked and also can't add post-function, validators or conditions. I can only use Script Console, build-in scripts etc. When i load a behaviours page a have errors.

 

Data with key com.onresolve.jira.groovy.groovyrunner:directIdeaIntegration.idea-editor-data-provider has already been claimed

And

TypeError: $ is not a function
Matthew Clark
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.
February 6, 2019

Hi Tomasz

I have seen this before when a user had a customised HTML banner with JavaScript in it.

Do you have custom JavaScript within your HTML banner?

If you do, does removing it temporarily bring back the behaviours?

Tomasz Bryla February 6, 2019

Hi Matthew,

Yes I have custom JavaScript in HTML banner, but commented this script and doesn't help.

Matthew Clark
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.
February 6, 2019

Can you post the HTML banner with the JavaScript here?

If you still see the following error, even after commenting out the JavaScript it may still be trying to parse it when loading the behaviours.

TypeError: $ is not a function

You may also need to clear the browser cache to force it to get the new HTML code without the JavaScript in the header

Tomasz Bryla February 13, 2019

@Matthew Clark here is my JS. I cleared cache and trying on another web browser but still doesn't work.

/*
<script language="JavaScript">
<!--
 
jQuery.noConflict( );
var defaultRoleName = "role:10001";
var roleSelected = false;
 
function changeCommentLevel( )
{
    if ( roleSelected )
    {
        return;
    }//if
 
    if ( jQuery( '#comment' ).val() != "" )
    {
        // edition;
        roleSelected = true;
        return;
    }
 
    var commentLevelSelect = jQuery( '.security-level select#commentLevel option[value=\'' + defaultRoleName + '\']' );
    if ( commentLevelSelect )
    {
        var labelText = commentLevelSelect.first( ).text( );
        jQuery( "select#commentLevel" ).val( defaultRoleName );
        jQuery( "#commentLevel-multi-select a.drop span.icon" ).removeClass( "icon-unlocked" ).addClass( "icon-locked" );
        var htmlEscapedLabel = AJS.$( "<div/>" ).text( labelText ).html( );
        jQuery( ".security-level span.current-level" ).html( AJS.format( AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel ) );
        roleSelected = true;
    }
 
}
 
 
jQuery( '#comment' ).live( 'focus', changeCommentLevel );
//-->
</script>

 
<style>
.alertHeader
{display:none;}
 
</style>

*/

.

Matthew Clark
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.
February 13, 2019

Hi Tomasz

 

Can you confirm that you still see this error in the browser developer tools console log?

TypeError: $ is not a function
Tomasz Bryla February 14, 2019

Hi @Matthew Clark,

Yesy, i still get this error:

Uncaught TypeError: $ is not a function

This:

Error parsing header X-XSS-Protection: 1; mode=block, 1; mode=block: expected semicolon at character position 13. The default protections will be applied.

And this:

batch.js?locale=en-US&spectrum=true:34 Data with key com.onresolve.jira.groovy.groovyrunner:directIdeaIntegration.idea-editor-data-provider has already been claimed
Matthew Clark
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.
February 14, 2019

If you still see the first error, it would indicate the banner is still being loaded.

Please can you edit your JavaScript banner and remove the following line:

jQuery.noConflict( );

Then clear your browser cache and let me know if you can then see the behaviours interface correctly

Like Tomasz Bryla likes this
Tomasz Bryla February 14, 2019

Now it's working. Strange, why comment sign isn't recognized in banner?

HARI KRISHNA AKKAMALA March 22, 2019

Hi Matthew,

Same issue i'm facing.could you please help on this issue. find the attachments1.png2.png.

Problem:

1.When Script runner update 5.0.14 to 5.5.0 behaviors page not loading fully. 

2.when role back to old version behaviors page loaded fully.

3. we are upgrading our jira version 7.1.10 to 7.11.0 this time facing the issue. 

Thanks,

Hari

Matthew Clark
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.
March 22, 2019

Hi Hari

Open the browser developer tools after loading the behaviours page which fails to load fully. You will need to show me any errors you get in the console log.

When this page fails to load it is often due to some JavaScript issue which usually logs to the browsers console log area.

--

I have also seen this when upgrading from a reasonably old version such as 5.0.14 to the most recent. I have not reproduce this here but the solution was to disable and re-enable scriptrunner.

Regards

Matthew

Hari Krishna Akkamala
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2019

Hi Matthew,

Yes,I removed script runner logs and disable the add on after that install new version but problems is not solved.Please see the error logs below.

1.Error

Data with key com.onresolve.jira.groovy.groovyrunner:directIdeaIntegration.idea-editor-data-provider has already been claimed
e.claim @ batch.js?locale=en-US&spectrum=true:34
r @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
n @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4

2. Error

Uncaught TypeError: $ is not a function
at Module.<anonymous> (com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4)
at a (com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4)
at HTMLDocument.<anonymous> (com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4)
at j (batch.js?locale=en-US&spectrum=true:66)
at Object.fireWith (batch.js?locale=en-US&spectrum=true:67)
at Function.ready (batch.js?locale=en-US&spectrum=true:55)
at HTMLDocument.Q (batch.js?locale=en-US&spectrum=true:65)
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
a @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
(anonymous) @ com.onresolve.jira.groovy.groovyrunner:bh-admin.js:4
j @ batch.js?locale=en-US&spectrum=true:66
fireWith @ batch.js?locale=en-US&spectrum=true:67
ready @ batch.js?locale=en-US&spectrum=true:55
Q @ batch.js?locale=en-US&spectrum=true:65

Matthew Clark
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.
March 26, 2019

You have the same error as the Original Poster.

Uncaught TypeError: $ is not a function

Can you check to see if you are using custom JavaScript within your page?

e.g. You may have custom JavaScript used to set a custom Banner

HARI KRISHNA AKKAMALA March 28, 2019

Hi Matthew,

Thanks you,it's working fine.But what i'm put code in Banner that is most important us.could you please provide the solution.

Matthew Clark
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.
March 29, 2019

I would need to see the Javascript code to determine what part is causing the problem.

For example, the following line can cause this problem:

jQuery.noConflict( );

The reason for this is explained here.

HARI KRISHNA AKKAMALA March 29, 2019

see my code below

 

<script language="JavaScript">
<!--
jQuery.noConflict();
var defaultGroupName = "group:eMeter-ops-users";
var customRoleSelected = false;

function changeCommentLevel()
{
if (customRoleSelected) return;

var commentLevelSelect = jQuery('.security-level select#commentLevel option[value=\'' + defaultGroupName + '\']');
if (commentLevelSelect)
{ var labelText = commentLevelSelect.first().text(); jQuery("select#commentLevel").val(defaultGroupName); jQuery("#commentLevel-multi-select a.drop span.icon").removeClass("icon-unlocked").addClass("icon-locked"); var htmlEscapedLabel = AJS.$("<div/>").text(labelText).html(); jQuery(".security-level span.current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel)); }

}

jQuery('#comment').live('focus', changeCommentLevel);
jQuery('#commentLevel-suggestions').live('click', function()
{ customRoleSelected = true; }

);
//-->
</script>

<style>
.alertHeader
{display:none;}

</style>

Matthew Clark
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.
March 29, 2019

You also have

 jQuery.noConflict();

Please remove that line, do not just comment it out.

Then clear your browser cache and try again.

HARI KRISHNA AKKAMALA March 29, 2019

i don't have functional knowledge could you please modified my code based on your suggestion copy the comment. 

Matthew Clark
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.
March 29, 2019

You just need to remove the one line between the <script> html tags. Don't change the code outside the script tags.

I have not tested it here so best try it on a test box first if you can:

<script language="JavaScript">

var defaultGroupName = "group:eMeter-ops-users";
var customRoleSelected = false;

function changeCommentLevel()
{
if (customRoleSelected) return;

var commentLevelSelect = jQuery('.security-level select#commentLevel option[value=\'' + defaultGroupName + '\']');
if (commentLevelSelect) {
var labelText = commentLevelSelect.first().text();
jQuery("select#commentLevel").val(defaultGroupName);
jQuery("#commentLevel-multi-select a.drop span.icon").removeClass("icon-unlocked").addClass("icon-locked");
var htmlEscapedLabel = AJS.$("<div/>").text(labelText).html();
jQuery(".security-level span.current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel));
}

}

jQuery('#comment').live('focus', changeCommentLevel);
jQuery('#commentLevel-suggestions').live('click', function()
{ customRoleSelected = true; }

);
</script>
HARI KRISHNA AKKAMALA April 1, 2019

Could you please advise how this line(which we are commenting) is affecting the behaviour plugin that too only in JIRA 7.11 version and not on the current version? We need a root cause and solution without breaking our existing scripts in place.

Suggest an answer

Log in or Sign up to answer