REST API Populate custom fields with data

In our workplace, we use SharePoint and JIRA as issue trackers. In SharePoint, we have a list called "Work Requests," which store issue information in SharePoint list items. Before, we have had to manually create JIRA stories from these Work Requests, but I have created a c# program that will automtically take this SharePoint data and create JIRA tasks. This is what my program is right now with my urls replaced with default values: 

using Atlassian.Jira;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;

namespace ConsoleApplication3
public class Jira_SP_API
public static void Main(string[] args)
Jira jira = Jira.CreateRestClient("JIRA url", "username", "password");

var context = new SharePoint.ITDataContext(
new Uri("SharePoint url"));
context.Credentials = System.Net.CredentialCache.DefaultCredentials;

var workrequests = from request in context.WorkRequests
where request.Id > 240
where request.RequestStatusValue != null
orderby request.Id
select new

foreach (var request in workrequests)
var issue = jira.CreateIssue("TEST");
issue.Type = "Task";
/*issue["customfield_10044"] = request.Id;*/
issue.Priority = request.PriorityValue;
issue.Summary = request.Title;
issue["customfield_10045"] = request.WorkRequestFormReadOnly;
issue["customfield_10050"] = request.FunctionalArea;
issue["customfield_10047"] = request.Title;
issue["customfield_10048"] = request.Name;
issue["customfield_10049"] = request.FirstName + ' ' + request.LastName;
issue["customfield_10046"] = null;
issue["customfield_10051"] = null;
issue["customfield_10052"] = null;

catch (Exception) { }


Console.WriteLine(request.FirstName + ' ' + request.LastName);



Basically my issue is that my program will create tasks when I don't have the custom fields in my foreach statement, but as soon as I put them in, my program will no longer create tasks. Is my formatting wrong? Or are the custom fields not supposed to work this way? Thanks in advance.

2 answers

Tried this:

issue.CustomFields.AddById("customfield_10045", request.WorkRequestFormReadOnly); //Link to Work Request
issue.CustomFields.AddById("customfield_10050", request.FunctionalArea); //Functional Area
issue.CustomFields.AddById("customfield_10047", request.Title); //Title
issue.CustomFields.AddById("customfield_10048", request.Name); //Requestor
issue.CustomFields.AddById("customfield_10049", request.FirstName + ' ' + request.LastName); //Approver


Still doesn't create the issue in JIRA. But this creates an issue when I remove the custom fields:

var issue = jira.CreateIssue("TEST");
issue.Type = "Story";

issue.Priority = request.PriorityValue;
issue.Summary = request.Title;



Am looking for similar kind of solution. would love to hear if you were able to integrate between sharepoint and jira ? if so do you mind sharing how you implemented it. 


0 votes
Warren Levy Community Champion Jan 11, 2018

Hi guys

This is what the JSON looks like when I create an issue with a custom field :

 "customfield_11100": {
"value": "Non Project"

 I hope this helps you

Hey Warren,

So you create your JSON from sharepoint and trying to create the issue in Jira ? Just trying to understand on the integration of sharepoint and jira

Warren Levy Community Champion Jan 11, 2018

No, I don't work with SharePoint. I was mainly answering the question about creating an issue with a custom field. 

In theory you should be able "get" Jira data into SharePoint and also create Jira issues from SharePoint, as long as you're able to work with the API (which should be possible). In fact my company is considering a project of doing exactly this, but the SharePoint developers will be involved, not me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

466 views 8 27
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you