Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script to automatically Create Customer Product entitlement from Portal request

Céline - Maestrel
Contributor
March 20, 2025

Dear community,

I am rather new to JSM and would appreciate any feedback regarding what I am trying to achieve.

Our external customers will fill in a support request from our portal. In this support request, I can add fields for them to select the product they are using and provide a "Purchase code" (licence number) for this product.

Currently, I can manually check their licence (on an external script I have), take note of their support end date. And then manually add the product to the customer in JSM and enter the end date as Product entitlement field value.

I am looking for a way to automate this process.

Therefore, I need to run some code to be able to do the following upon Request submission:
- check with an external API (Envato MarketPlace) their support entitlement and retrieve the support entitlement end date.
- then Create Customer Product with Jira API, so the customer has a product with entitlement information added

Can I use ScriptRunner for Jira Cloud for this purpose?

Do you think of another way to do so?

Anyone having experience with similar needs?

Thank you in advance!

Celine

2 answers

1 accepted

3 votes
Answer accepted
Marc - Devoteam
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 20, 2025

Hi @Céline - Maestrel 

You could even use Jira automation to make API call to external systems an het the information.

issue-data-automation-format-payload-for-send-web-request 

@Philipp Sendek I definitely agree with you, I just see the the user is running on a standard tier, using Assets will require an update to the premium tier

Céline - Maestrel
Contributor
March 20, 2025

Hi Marc,

Thank you very much. I may consider upgrading to Premium, if I see that I need to. This is not a limitation, as such. ;-)

I will check the link provided. I think it will actually be feasible to use it to call the 3rd party API.

If I have any doubt regarding the automation rule for this question, should I post it here? Or on the Atlassian Automation forum? Sorry for being new to this.

Like # people like this
Marc - Devoteam
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 20, 2025

Hi @Céline - Maestrel 

Yes post the rule here then, infroation to give is:

1. what type of project is this (e.g., company-managed, team-managed, etc.), 

2. images that show your complete rule.

3. images showing the details of any relevant actions/conditions/branches.

4. images showing the Audit Log details for the rule execution.

5. Explain where the issue is.

Like Céline - Maestrel likes this
Céline - Maestrel
Contributor
March 21, 2025

Hi,

Thank you, again.

I have added 2 custom fields to the Request Types for the "Licence number" and the "End support date".

I have then used the Automation rule, with "Send Web Request" action to be able to check the "Licence number" against the 3rd party API. Then, I update the field "End support date" so it is displayed in the issue view.

It is not exactly what I was after, as I would prefer to add a Product to the Customer, and enter Product entitlement, as I can do manually (https://support.atlassian.com/jira-service-management-cloud/docs/show-product-entitlement-details-on-issues/).

However, I have checked Jira Service Management Cloud REST API, but the "Customer" endpoint is currently limited to "Create" customer. And I could not find any reference to Products, and Product entitlement associated to a Customer.

I suppose it is not available? Or did I overlook the API reference?

Thank you for pointing me to the right direction. Automation is great!

Céline - Maestrel
Contributor
April 2, 2025

Hi,

Coming back to this question, the API documentation has been updated and there are now endpoints for Products and Entitlement. Exactly what I was after!

3 votes
Philipp Sendek
Community Champion
March 20, 2025

Hi @Céline - Maestrel ,

Yes, what you're asking is absolutely possible now, but having received these requests in the past and knowing what came out of it in the end, you might want to think this a little bigger. :-)

I've had a customer that had exactly the same demand, but instead of pushing those information on demand to Jira and moving data around with scripts, they basically moved their whole customer, product and contract data to Jira Assets. Once they did that, they could use all kinds of automations and native features to present the customer with their contracts, support entitlements, product numbers, etc. right in the request while they wrote it (not only after it was submitted). This might be too much for you now, but depending on the effort and how big the footprint of Jira already is in your company, this could be the right moment to plan ahead.

Depending on your vision and desire for the years to come, it could be the better choice to either move those data to Jira entirely or sync the data to Jira Assets and work with the data within Jira instead of building bridges to pull data via scripts on demand.

I hope this answered your question and also gave a bit of inspiration for your project. :-)

Greetings
Philipp

Céline - Maestrel
Contributor
March 20, 2025

Hi Philipp,

Thank you very much.

I have 2 different sources of sales, and therefore 2 sources of licences entitlement checks. One is managed directly by us, so I was reading actually about Jira Assets, before posting here.

However, the other source is a 3rd party marketplace. I have access to the Purchase code (licence) only if/when the customer provides it when submitting a support request. And it is at this time that I would need to call the 3rd party API to be able to retrieve the information about the support entitlement and display it in the ticket. (I can then inform the customer that he needs to renew technical support if it has expired.)

Hence, I believe this part is not manageable via Assets, since I don't have a list of the licences sold on the 3rd party marketplace. Am I right in my understanding?

Best regards,

Celine

Philipp Sendek
Community Champion
March 21, 2025

Thank you for providing more background around your project. Yes, in that case it makes sense to work with the punctual connection as you've proposed initially.

I second @Marc - Devoteam 's suggestion and would try to use Jira Automation at first and only move over to Script Runner when the business logic becomes too complex to handle in an Automation.

Feel free to post your Automation or question around it here and we'll see that we help you out. :-)

 

Greetings
Philipp

Like Céline - Maestrel likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events