How to sync security level in cloud instance

Originally asked by Uday Bhaskar on 18 July 2023 (original question)


We are trying to sync the security level in cloud instance by taking default assignee to set the particular security level group in cloud instance end.

Please find the attached error screenshot


Answer by Sonal Otwani on 17 June 2024

Hi,

Here is the solution using script:

if (!firstSync) {

def jiraUrl = "https://demo.atlassian.net/rest/api/3/issue/${issue.key}"
def user = "abc@demo.com"
def apiToken = "<token>"
def authString = "$user:$apiToken".bytes.encodeBase64().toString()

def securityId = "10002"  // Change this to your actual security ID

// Set up URL and connection
def url = new URL(jiraUrl)
def http = url.openConnection()
http.setRequestProperty("Authorization", "Basic $authString")
http.setRequestProperty("Content-Type", "application/json")
http.setDoOutput(true)
http.setRequestMethod('PUT')  // Change to PUT if needed

// Prepare JSON payload for the security level
def payload = groovy.json.JsonOutput.toJson([
    fields: [
        security:[
          id:"10003"
        ]
    ]
])
// Send the request
def outputStream = http.getOutputStream()
outputStream.write(payload.bytes)
outputStream.close()

// Get the response
def responseCode = http.getResponseCode()
//debug.error("Response Code: $responseCode")

if (responseCode != 204) {
    def inputStream = responseCode >= 400 ? http.getErrorStream() : http.getInputStream()
    def response = inputStream.text
    debug.error("Response: $response")
}
else
{
 //debug.error("done")
} 
}

Answer by Uday Bhaskar on 25 July 2023

Hi Sonal,

Please provide an update.

Regards,

Uday


Comments:

Sonal Otwani commented on 25 July 2023

Hi Uday Bhaskar
Sorry for not providing update till now. Can you please click “copy to clipboard” button below the error details and provide those copied information?

Thanks,

Sonal

Uday Bhaskar commented on 25 July 2023

Hi Sonal,

Please find the attached file.

Security level error.docx (old community)

Regards,

Uday Bhaskar

Sonal Otwani commented on 25 July 2023

Hi Uday Bhaskar ,

I think you provided wrong file. Because it contains different error than which you provided (old community)
And the main purpose for asking this is, we need Payload which will be at the end in copied data.

Can you please re-send the file again?

Thanks,

Sonal

Uday Bhaskar commented on 25 July 2023

Hi Sonal,

I have reproduced the same error, Please find the attached error file.

Security level.docx (old community)

Regards,

Uday Bhaskar

Sonal Otwani commented on 25 July 2023

Hi Uday Bhaskar ,

Unfortunately, I am not able to find what i wanted.

Can we schedule a small call to resolve this?

Kindly share your multiple available slots for this week with time zone.

Thanks,

Sonal

Uday Bhaskar commented on 26 July 2023

Hi Sonal,

I will be available from 3pm to 6.30pm IST today and tomorrow (2.30 pm to 6pm IST), Friday(2.30 pm to 6pm IST) . Schedule the call sometime between this based on your availability.

Regards,

Uday Bhaskar

Uday Bhaskar commented on 27 July 2023

Hi Sonal,

Can you please update on the above.

Regards,

Uday Bhaskar

Sonal Otwani commented on 27 July 2023

Hi Uday Bhaskar ,

Sorry for not providing you the update. We can do at 3:30 pm.

Thanks,

Sonal

Uday Bhaskar commented on 28 July 2023

Hi Sonal,

Please schedule at 3.30pm in IST timings.

Regards,

Uday Bhaskar

Sonal Otwani commented on 28 July 2023

I hope you received following meeting invite:
To join the video meeting, click this link: https://meet.google.com/wnp-kxki-tos
Otherwise, to join by phone, dial +1 413-341-4719 and enter this PIN: 214 051 240#
To view more phone numbers, click this link: https://tel.meet/wnp-kxki-tos?hs=5

Thanks,

Sonal

Sonal Otwani commented on 01 August 2023

HI Uday Bhaskar

I confirmed that Security level can not be set in Jira Cloud by Exalate Out of the Box. It is possible in Jira On-premise.

Let me know in case of any other concerns.

Thanks,

Sonal

Uday Bhaskar commented on 01 August 2023

Hi Sonal,

We have created dummy custom field with cloud security levels as dropdown in DC end . Is it possible to sync that custom field to security level in cloud end.

Regards,

Uday Bhaskar

Uday Bhaskar commented on 02 August 2023

Hi Sonal,

Please provide an update.

Regards,

Uday Bhaskar

Sonal Otwani commented on 02 August 2023

Hi Uday Bhaskar ,

But setting security level in Jira Cloud is not possible. Means Setting security level in Incoming sync script at Jira cloud is not possible by exalate.

Thanks,

Sonal

Answer by Uday Bhaskar on 18 July 2023

Hi Sonal,

We have created a security level (select list(single choice) field in Jira Data center side and trying to sync this field to cloud to set automatically security level for issue keys .

And also Please confirm how to set default security level in cloud end.

Outgoing

replica.securityLevel = issue.customFields"18736"

Incoming

issue.securityLevel = replica.securityLevel

Regards,

Uday Bhaskar


Answer by Sonal Otwani on 18 July 2023

Hi Uday Bhaskar ,

Can you please share the script which you used for setting security level?

Thanks,

Sonal