Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unable to display a button on the pull request overview page using ScriptRunner

Tamir.Kucherov October 3, 2022

Hello,

 

I try to create a button on bitbucket pull request overview page using ScriptRunner, but for some reason it doesn’t appears.

This button should open additional custom form.

BitBucket.png

 

My actions are:

  1. Login to bitbucket admin page -> SCRIPTRUNNER -> Fragments
  2. Create Fragment -> Custom Web Item
  3. Fill all fields while specifying in section field: bitbucket.pull-request.toolbar.actions
  4. Click on Update
  5. Refresh existing pull request. The button is missing

 

Menu from step #2 [custom web item]:

WebItem.JPG

 

My environment:

Atlassian Bitbucket v7.17.10

ScriptRunner version: 6.55.1

Chrome Version 106.0.5249.91 (Official Build) (64-bit)

 

P.s: I also try to follow adaptavist documentation, but the pictures are missing: https://docs.adaptavist.com/sr4bib/6.55.1/features/script-fragments/web-item

 

Code for myTestForm.groovy file [just for the test]

import com.atlassian.bitbucket.repository.RefService

import com.atlassian.bitbucket.repository.Repository

import com.atlassian.bitbucket.repository.ResolveRefRequest

import com.atlassian.sal.api.component.ComponentLocator

import com.onresolve.scriptrunner.parameters.annotation.RepositoryPicker

import com.onresolve.scriptrunner.parameters.annotation.ShortTextInput

 import static com.atlassian.bitbucket.repository.StandardRefType.BRANCH

 

@RepositoryPicker(label = "Repository", description = "Enter the repository name")

Repository repository

 

@ShortTextInput(label = "Branch", description = "Enter the branch name")

String branchName

 

def refService = ComponentLocator.getComponent(RefService)

 

refService.resolveRef(new ResolveRefRequest.Builder(repository).with {

    type(BRANCH)

    refId("refs/heads/${branchName}")

}.build())

 

Can you assist please?

 

Thanks! Tamir

1 answer

0 votes
Yoni Segal July 24, 2023

@Tamir.Kucherov  did you ever figure this out?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events