Forums

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

Not able to post data to custom fields using rest api as server responds with status 400(BadRequest)

Chunchu Siva Naga Raju
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2021

We have a form where the data from individual fields is stored in corresponding custom fields.

This worked perfectly when we delivered to the client. But It's not working after a month. 

We created new custom fields and shared them to relevant screens. But server responds with bad request when we try to create an issue using custom fields and rest api. 

However, we're able to create the request from service desk portal.

Moreover, We're able to create a request in the project with fields like "Summary" : "something", "Description": "Elaboration". 

So, we see nothing wrong with the api. 

We've checked and double checked to ensure that custom fields are shared to proper screens. 

Yet, we're not able to figure out why the code that ran perfectly a month ago has issues now...

If there're any internal changes we're not aware of, please feel free to let us know.

I tried to be as elaborate as possible. But if you need more information to understand the issue, feel free to shoot a question.

Thanks in advance.

Here's the code snippet:

app.post('/submitproject'isAuthorised, (req,res=> {  

  const reqBody = req.body;  const reqFields = reqBody.requestFieldValues;  

const bodyData = `{    "requestParticipants": [      "${reqBody.requestParticipants}"    ],   

 "serviceDeskId": "${config.get("jiracred.servicedesk.serviceDeskId")}",    

"requestTypeId": "${config.get("jiracred.servicedesk.requestTypeId")}",    

"requestFieldValues": {      

"customfield_11141": "${reqFields.name}",      

"customfield_11140": "${reqFields.owner}",     

 "customfield_11142": "${reqFields.submitter}",     

 "customfield_11144": "${reqFields.businessNeeds}",      

"customfield_11145": "${reqFields.behalfOf}",     

 "customfield_11146": "${reqFields.objectives}",      

"customfield_11167": "${reqFields.category}",     

 "customfield_11147": "${reqFields.release}",      

"customfield_11148": "${reqFields.softwareReplaced}",      

"customfield_11221": "${reqFields.businessContact}",      

"customfield_11150": "${reqFields.projectLength}",      

"customfield_11165": "${new Date()}",      

"customfield_11151": "${reqFields.projStartDate}",      

"customfield_11152": "${reqFields.projEndDate}",     

 "customfield_11153": "${reqFields.stakeholders}",      

"customfield_11154": "${reqFields.businessBenefits}",      

"customfield_11155": "${reqFields.risks}",      

"customfield_11156": "${reqFields.inScope}",      

"customfield_11157": "${reqFields.outOfScope}",     

 "customfield_11158": { "value" : "${formatText(        reqFields.revenueImpact      )}" },
...


0 answers

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