Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Custom fields

api

I am having difficulty trying to add custom field data at the same time as creating an issue. I have seen the other couple of threads on this, and tried to use the same suggestions & code but to no avail

Attempt 1:
Trying to add the custom field data to the IssueEN data array for creation as part of data.IssueID = msmProxyManager.IssuesService.CreateIssue(data).IssueID;

// Custom field info
CustomFieldDataEN[] Cfield1 = new CustomFieldDataEN[2];
Cfield1[0] = new CustomFieldDataEN();
Cfield1[0].CustomFieldID = 2; // Make sure this is a vaild custom field id.
Cfield1[0].CustomFieldData = vHeatCallID;
data.IssueCustomFieldData = Cfield1;

Attempt 2:
Trying to add the custom field data separately from the issue creation. This attempt returns the following error "Exception has been thrown by the target of an invocation"

// Custom field info
CustomFieldDataEN Cfield0 = new CustomFieldDataEN();
Cfield0 = new CustomFieldDataEN();
Cfield0.CustomFieldID = 2; // Make sure this is a vaild custom field id.
Cfield0.CustomFieldData = vHeatCallID;
Cfield0.IssueID = data.IssueID;

CustomFieldDataEN cData = new CustomFieldDataEN();
m
smProxyManager.CustomFieldsService.SaveCustomFieldData(Cfield0);

Any help appreciated. The extension ashx has all verbs checked and am not using windows authentication.

martin
· 1
martin
Replies (3)
helpful
0
not helpful

Attempt 1 will not work at the moment. It will in 3.6.

Attempt 2, please set the UserID on the custom field data.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Thanks for that - still got the error so tried adding other fields - found that you also need to add ProjectID. Here is the working code for anyone else who stumbles across this.

(Thanks for the v.fast response Mark!)

CustomFieldDataEN Cfield0 = new CustomFieldDataEN();
Cfield0 = new CustomFieldDataEN();
Cfield0.CustomFieldID = 2; // Make sure this is a valid custom field id.
Cfield0.CustomFieldData = "Field data";
Cfield0.IssueID = data.IssueID;
Cfield0.UserID = 2;
Cfield0.ProjectID = 3;
               
CustomFieldDataEN cData = new CustomFieldDataEN();
m_smProxyManager.CustomFieldsService.SaveCustomFieldData(Cfield0);



martin
· 1
martin
helpful
0
not helpful

Thank you for the update. Glad all is working now.


Mark Wing
· 9108
Mark Wing