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.




Using API - Unable to save date value?

custom-fields
api

We have upgraded a project from 3.7 to 4.0. Now, values in custom date fields are not displaying.

Additionally, when trying to save a custom date value through the API (.NET), the values are not saving.

Any ideas?

mmatos
· 1
mmatos
Replies (10)
helpful
0
not helpful

Did you get the upgrade screen when logging in to Gemini as Administrator? If so, did it run without any warnings?


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Good Morning! I did not perform the upgrade myself, so I cannot speak to that. Is there a way to perform the change after the fact?


mmatos
· 1
mmatos
helpful
0
not helpful

Yes, navigate to: http://your gemini url/admin/upgrade/upgrade.aspx


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Thanks Mark. I will look in to that.

What about when trying to save a date value using the API? We are still using the 3.7 libraries. Do we need to change in order to be able to save dates into custom fields?


mmatos
· 1
mmatos
helpful
0
not helpful

Yes, we have made changes to the custom field data entity. Now it has a field for each type.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Hello,

We are still struggling to get this to work.

We are setting the DateData field, but the value is not being saved in to the database.

Can you please post a working .NET snipping of creating an issue and populating a custom date field with a date value?

Thank you.


mmatos
· 1
mmatos
helpful
0
not helpful

There you go, this assumes issue id 527 exists and the custom field at the 8th index is the date one:

ServiceManager sm = new ServiceManager("http://localhost/gemini", "manager", "manager", "", false);
            IssueEN i527 = sm.IssuesService.GetIssue(527);
            CustomFieldDataEN date = i527.IssueCustomFieldData[8];
            date.DateData = DateTime.Now;
            sm.CustomFieldsService.SaveCustomFieldData(date);

Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Can I assume from this that the old method of assigning the custom data fields to the issue object (issue.CustomFieldData = [an array of CustomFieldDataEN]) no longer works?


mmatos
· 1
mmatos
helpful
0
not helpful

Also, is it possible to save multiple with one call? In the past we would create an array of CustomFieldDataEN and assign it to the issue, thereby saving several custom data fields simultaneously. Some of our projects have up to 10 custom data fields and making a call for each one seems wasteful.


mmatos
· 1
mmatos
helpful
0
not helpful

It will work on issue creation. Share your current code as nothing as changed in that respect.


Saar Cohen
· 5000
Saar Cohen