You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We’re using : ZendeskApi_v2_Net35 (with VB.Net) - Yes I know, it's a legacy system
Test Case :
Dim updateTicket As Ticket = New Ticket()
updateTicket.Id = ticketID
updateTicket .RequesterId = ticket.RequesterId
---populate a several fields----
Dim newComment As Comment = New Comment()
startComment = String.Format(results.SelectToken("Comment").ToString(), Common.GetFullNameFromUserName(HttpContext.Current.User.Identity.Name).ToString())
newComment = NewTicketComment(startComment, txtDetailComment.Text, False) 'Note the False on public param
updateTicket .Comment = newComment
api.Tickets.UpdateTicket(updateTicket )
Ticket is updated with new comment however it's showing as public and email sent to customer, instead of false.
The code in this part of my applications has been working okay and only stopped after I moved from the ZendeskApi_v2-2.0.0 to the newer 3.5 and other than the authentication, no other updates were needed.
I found the Issue and a possible work-around, however it would still be a bug and not sure what issues if any the workaround will cause.
When debugging the Core.cs I can confirm the c# Ticket.Comment.Public is set to false. I had a look at what the serialized JSON was and cannot see the false property serialized.
?System.Text.Encoding.Default.GetString(data); "{\"ticket\":{\"requester_id\":358227191,\"custom_fields\":[{\"id\":22142521},{\"id\":22142531},{\"id\":22391566,\"value\":\"task_to_be_completed_pending_ob_order_entry\"},{\"id\":23359766,\"value\":\"\"},{\"id\":24459363,\"value\":\"received_via_orders\"}],\"comment\":{\"body\":\"No macro selected by Michael Anderson\\test1\"},\"id\":568085}}"
I then modified DefaultValueHandling from IgnoreAndPopulate to just Populate in the json_settings (line 51 ) . Compile, copied to project and debugged. I then got public: false
"{\"ticket\":{\"requester_id\":358227191,\"custom_fields\":[{\"id\":22142521},{\"id\":22142531},{\"id\":22391566,\"value\":\"task_to_be_completed_pending_ob_order_entry\"},{\"id\":23359766,\"value\":\"\"},{\"id\":24459363,\"value\":\"received_via_orders\"}],\"comment\":{\"public\":false,\"body\":\"No macro selected by Michael Anderson\\test2\"},\"id\":568085}}"
I couldn't find any unit tests for ticket comment public : false.
So I think the public false is set as default and is being serialized and passed to Zendesk. Not sure where / how to fix that, I can’t find that code in the source?
I did see this Models.AccountsAndActivities, but don’t think it has something to do with it?:
[JsonProperty("comments_public_by_default")]
public bool CommentsPublicByDefault { get; set; }
The text was updated successfully, but these errors were encountered:
manderson01
changed the title
Comments.Public = false not does not create comment as private
Comments.Public = false creates comment as public
Aug 8, 2016
Okay so now I understand a little bit more about this. To reduce load from client to server they have a feature to tell the client what the default values are for various keys of the JSON object so they do not need to be set. While this works okay for some. But for me (us) this is a major issue with regards to Boolean properties. The reason I could not find any json DefaultValue notations in the code base is because there is none. With DefaultValueHandling booleans are automatically set to ignore all values if it is set to false.
Since the Zendesk models do not have defaults set on the boolean properties then all false's will not be serialized and sent to zendesk server.
Not sure what the solution would be across the board on Default value handling, the lease intrusive is to decorate all boolean properties with a Include which means that if you set it to false it will send false and if you set it to true it will include true. Thoughts?
We’re using : ZendeskApi_v2_Net35 (with VB.Net) - Yes I know, it's a legacy system
Test Case :
Ticket is updated with new comment however it's showing as public and email sent to customer, instead of false.
The code in this part of my applications has been working okay and only stopped after I moved from the ZendeskApi_v2-2.0.0 to the newer 3.5 and other than the authentication, no other updates were needed.
I found the Issue and a possible work-around, however it would still be a bug and not sure what issues if any the workaround will cause.
When debugging the Core.cs I can confirm the c# Ticket.Comment.Public is set to false. I had a look at what the serialized JSON was and cannot see the false property serialized.
?System.Text.Encoding.Default.GetString(data);
"{\"ticket\":{\"requester_id\":358227191,\"custom_fields\":[{\"id\":22142521},{\"id\":22142531},{\"id\":22391566,\"value\":\"task_to_be_completed_pending_ob_order_entry\"},{\"id\":23359766,\"value\":\"\"},{\"id\":24459363,\"value\":\"received_via_orders\"}],\"comment\":{\"body\":\"No macro selected by Michael Anderson\\test1\"},\"id\":568085}}"
I then modified DefaultValueHandling from IgnoreAndPopulate to just Populate in the json_settings (line 51 ) . Compile, copied to project and debugged. I then got public: false
"{\"ticket\":{\"requester_id\":358227191,\"custom_fields\":[{\"id\":22142521},{\"id\":22142531},{\"id\":22391566,\"value\":\"task_to_be_completed_pending_ob_order_entry\"},{\"id\":23359766,\"value\":\"\"},{\"id\":24459363,\"value\":\"received_via_orders\"}],\"comment\":{\"public\":false,\"body\":\"No macro selected by Michael Anderson\\test2\"},\"id\":568085}}"
I couldn't find any unit tests for ticket comment public : false.
So I think the public false is set as default and is being serialized and passed to Zendesk. Not sure where / how to fix that, I can’t find that code in the source?
I did see this Models.AccountsAndActivities, but don’t think it has something to do with it?:
The text was updated successfully, but these errors were encountered: