Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

From DC to Cloud JMCF

Marc Jason Mutuc
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 18, 2024

I'm working on migrating some fields from DC to Cloud. One of the fields has this script for Calculated (scripted) Number Field.

issue.get("customfield_21408")==null ? null : (issue.get("customfield_21408").getTime() - issue.get("created").getTime()) / 1000 / 60

Can someone teach me the api equivalent of it? I tried looking into the documentations but couldn't really see a good guide.

1 answer

0 votes
Reshma Begum {Appfire}
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 18, 2024 edited

Hi @Marc Jason Mutuc ,

Thanks for reaching out!

Please use the below script in a JCMF scripted field to get a difference of two datetime fields. 

 


const createdAt = await api.issue.getField(issue, "created")

console.log(createdAt)

const resolvedAt = await api.issue.getField(issue, "resolutiondate")

console.log(resolvedAt)


console.log(resolvedAt - createdAt)

if(resolvedAt != null)

{

return (new Date(resolvedAt).getTime() - new Date(createdAt).getTime())/1000/60

}

Please change the fields in the script above as per your requirement. 

BTW I am from Appfire, a vendor of JMCF app.

Hope this helps!

Thanks

Reshma

Marc Jason Mutuc
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 18, 2024

Thanks Reshma! I'll try it out. Is there any documentation for this? I will be using it more and would like to be able to do it on my own.

This one doesn't show a lot

https://appfire.atlassian.net/wiki/spaces/JMCFC/pages/731676729/Scripted+Field

Very different to the documentation for DC. I am hoping you can provide me some links.

Marc Jason Mutuc
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 18, 2024

For example, how to I get custom field values in cloud?

Reshma Begum {Appfire}
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 18, 2024

Hi @Marc Jason Mutuc ,

You can get the custom field values through the custom field ID, as shown below:

 

const createdAt = await api.issue.getField(issue, "created")

console.log(createdAt)


const resolvedAt = await api.issue.getField(issue, "customfield_10078")

console.log(resolvedAt)

if(resolvedAt != null)

{

return (new Date(resolvedAt).getTime() - new Date(createdAt).getTime())/1000/60

}

As we have released scripted fields in the JMCF cloud app quite recently, we are still working on improving our documentation. 

Thank you for trying out scripted fields!

Thanks,

Reshma

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events