Change the web-item label dynamically in jira cloud

All,

I have a configuration file to set the label name for the web-item.
How can I change the web-item label dynamically in Jira cloud.?

Please let us know if any API or call back function?

Thanks,
Kiran M

You want Connect dynamic modules

Thanks for the replay.

I am looking web-item name i.e “Test link”. I have requirement to change the name dynamically. below is my descriptor.

“webItems”: [
{
“location”: “operations-operations”,
“weight”: 200,
“styleClasses”: [
“webitem”,
“system-present-webitem”
],
“context”: “addon”,
“target”: {
“type”: “dialogmodule”,
“options”: {
“key”: “dialog-module-key”
}
},
“tooltip”: {
“value”: “My Test link”
},

        "name": { 
          "value": "Test link"
        },
        "key": "my-test-modules"
  
        }
    ]  

Thanks.
KIran. M

Yeah you can’t do that through the descriptor. You’ll need to use the dynamic module rest call to create your entry. You could potentially set a property that could be used with a condition to turn off the default entry in your descriptor and then use that same property in a negate condition to enable the new one.

Thank you. I will verify and let you know.

Hi @danielwester ,

I have added web-item using dynamic module REST API but it’s not showing in the operation menu.
please refer below code for details:

let bodyData = { "webItems": [ { "location": "operations-operations", "weight": 200, "styleClasses": [ "webitem", "system-present-webitem" ], "url": "/my-web-item", "context": "addon", "target": { "type": "page" }, "tooltip": { "value": "Example tooltip" }, "icon": { "width": 16, "height": 16, "url": "/maps/icon.png" }, "name": { "value": "Dynamic Web Item" }, "key": "web-item-example" } ] };
AP.request({
url: ‘/rest/atlassian-connect/1/app/module/dynamic’,
type: ‘POST’,
body: bodyData,
success: function(response){
console.log(response); //returning “”
AP.request({
url: ‘/rest/atlassian-connect/1/app/module/dynamic’,
type: ‘GET’,
success: function(response){
console.log(response); //getting empty json object i.e {}
},
error: function(xhr, statusText, errorThrown){
console.log(arguments);
}
});
},
error: function(xhr, statusText, errorThrown){
console.log(arguments);
}
});
}

Please let me know if i missed anything or help me on above ?

Thanks & Regards,
Ashok Chelimilla

What’s the response code? Since you’re using ap.request you are adding it as a user user and not the app user.

You might need to switch to having to make the call from the backend with the app user. I would imagine that the response code would tell you.

please refer below POST and GET request details below:

POST call response details:
response: “”
status:200

GET call response details are:
response:"{}"
status:200

@danielwester,

We got the issue. The Issue is with json input data. It working fine.
Thanks.