# Refresh Issue using Event Lister Scriptrunner

**URL:** <https://community.developer.atlassian.com/t/refresh-issue-using-event-lister-scriptrunner/74272>\
**Category:** Jira Development\
**Tags:** scriptrunner\
**Created:** [October 30, 2023, 8:36pm UTC](https://community.developer.atlassian.com/t/refresh-issue-using-event-lister-scriptrunner/74272 "2023-10-30T20:36:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillBallestero](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@WillBallestero](https://community.developer.atlassian.com/u/WillBallestero)\
**Post date:** [October 30, 2023, 8:36pm UTC](https://community.developer.atlassian.com/t/refresh-issue-using-event-lister-scriptrunner/74272/1 "2023-10-30T20:36:10Z")

</div>

Hello, I need to refresh the issue without closing the window in order to update in “real time” the changes i´m using the method **AP.jira.refreshIssuePage();** and this is my code:

```plaintext
// these 4 values will be installation dependent
def input1CfId = 'customfield_10048' // Cantidad disponible
def input2CfId = 'customfield_10034' // Costo Unitario
def outputCfId = 'customfield_10050' // Valor Total de inventario
def projectKey = "BP"

if (issue == null || issue.fields.project.key != projectKey) { 
    logger.info("Wrong Project ${issue.fields.project.key}")
    return
}

def input1 = issue.fields[input1CfId] as Double 
def input2 = issue.fields[input2CfId] as Double

if (input1 == null || input2 == null) { 
    logger.info("Calculation using ${input1} and ${input2} was not possible")
    return
}

def output = input1 * input2

AP.jira.refreshIssuePage();

if (output == (issue.fields[outputCfId] as Double)) { 
    logger.info("already been updated")
    return
}

put("/rest/api/2/issue/${issue.key}") 
    .header("Content-Type", "application/json")
    .body([
        fields:[
                (outputCfId): output
        ]
    ])
    .asString()

```

Scriptrunner interface give me this:  
[Static type checking] - The variable [AP] is undeclared @ line 23, column 1  
[Static type checking] - No such property: jira for class: java.lang.Object @ line 23, columna 3.

Could someone help me?

---

<div class="post-metadata">

**Author:** ![PaoloCampanelli](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/paolocampanelli/32/45716_2.png) [@PaoloCampanelli](https://community.developer.atlassian.com/u/PaoloCampanelli)\
**Post date:** [October 31, 2023, 7:47am UTC](https://community.developer.atlassian.com/t/refresh-issue-using-event-lister-scriptrunner/74272/2 "2023-10-31T07:47:18Z")

</div>

`AP.jira.refreshIssuePage();` is Javascript code, not Groovy.  
The script that you posted runs on the server, not in the browser: in that context there is no browser at all (what if you’re running a transition/updating an issue using the REST API?) so you can’t really do that.

I don’t know if Scriptrunner has a custom way to send messages to the browser, you should probably ask their team, but there is no _general_ way to trigger a page refresh from the backend.
