I have read many articles on this already but I am still not able to make progress on this topic. We are using JIRA cloud.
From within SFDC I am making a REST API call into JIRA to create a ticket. I want to change to the Reporter name to the actual employee who created the request in SFDC for the ticket.
I am passing the employee EMAIL address from SFDC as a value of an attribute to JIRA. I have tried various attribute names but I have received mixed results. What attribute field do I need to pass in my script and in what format do I need to pass it to JIRA?
This is a snipper of the reporter code in SFDC that is part of the API call into JIRA:
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('name', TR.SE_Email__c);
gen.writeEndObject();
TR.SE_Email__c = this has the employee email address.
The email address from SFDC "TR.SE_Email__c" is the same email address for the employee in JIRA. The login into JIRA is that the employees use is their email ID.
Here are the attributes that I have tried in my script:
1. 'name' - Works perfect when I myself submit the JIRA ticket request from SFDC but when someone else who is not me tries to create a ticket from within SFDC it returns this error: {"errorMessages":[],"errors":{"reporter":"The reporter specified is not a user."}}. However the employee/user actually exist in JIRA.
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('name', TR.SE_Email__c);
gen.writeEndObject();
I tried:
name hardcoded with email address of zack@acme.com which is a valid user/email in JIRA or any other email address. It shows the reporter field as "anonymous"
user hardcoded with mario@acme.com which is a valid user email address in JIRA. The reporter field successfully shows my name
I can go into JIRA directly for the ticket that gets created and manually change the user to zack@acme.com and it takes the change no problem.
2. 'accountId' - When I returns error {"errorMessages":[],"errors":{"reporter":"Account ID mario@acme.com does not exist."}}. However this is my valid user email address that exist in JIRA.
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('accountId', TR.SE_Email__c);
gen.writeEndObject();
I have also tried passing the actual user accountId like such:
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('accountId', '557058%3Ae6c1467a-8985-4292-ae6c-8bac00822a33');
gen.writeEndObject();
but and I get this error: {"errorMessages":[],"errors":{"reporter":"Account ID 557058%3Ae6c1467a-8985-4292-ae6c-8bac00822a33 does not exist."}}
3. 'id' - {"errorMessages":[],"errors":{"reporter":"Account ID mario@acme.com does not exist."}} However this is a valid user and the email address exist in JIRA exactly as shown.
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('id', TR.SE_Email__c);
gen.writeEndObject();
I have also tried passing the actual user accountId like such:
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('Id', '557058%3Ae6c1467a-8985-4292-ae6c-8bac00822a33');
gen.writeEndObject();
and while I dont get an error and the ticket is created in JIRA the Reporter field shows anonymous.
4. 'username' - When using this attribute the ticket gets created in JIRA but JIRA shows Reporter field as anonymous.
// reporter id
gen.writeFieldName('reporter');
gen.writeStartObject();
gen.writeStringField('username', TR.SE_Email__c);
gen.writeEndObject();
I also tried:
username hardcoded with mpuras@netskope.com but again it shows up the Reporter field as "anonymous"
I am out of ideas here. Open to suggestions if someone could please advise how to get this working, what is the proper field that I can pass to JIRA so that the reporter is properly set and DOES NOT show Anonymous as the Reporter user.
Also, for the project permission I do have the user service account (user calling the rest service) that is used to authenticate SFDC to JIRA to create the ticket listed as having permission to modify reporter field. I also have the Reporter field in the create and edit screens.
Hi @Mario Puras ,
According to the documentation for the /rest/api/2/issue endpoint in order to set the reporter you should use the below syntax:
"reporter": { "id": "557058:d6b5955a-e193-41e1-b051-79cdb0755d68" },
However, before going any further with the code, can check:
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.