How to change the issue Type of an issue in JIRA via email? - asp.net-mvc

I am working on an MVC application that is currently sending an email to JIRA and it is creating an issue. I am currently configuring all of the required fields and currently the issue being created has the issue Type set to bug as a default and also I think the priority set to minor.
I need to be able to change these two fields from the default as this application is used for clients that need to choose the correct issue and priority.
Currently I am using the TO, FROM, CC as the assignees, client and reporter. The summary and description are used by the subject and body respectively. This is why I don't know if it is actually possible to change these.
Can this actually be done, for example in the body "issueType" = "BUG", or "issueType":"Task"?
The application has the IssueType and Priority as dropdown list so could I append this to the body or maybe the subject of the email and send it. All code is working just need to know how/if I can set these two properties.
Update
I saw an example of this being used but I am unsure of how to implement this into an email form or if this can be done. And I am also using smtp gmail to send the information in my MVC application.
handler.params: project=XXOODD, issuetype=2
https://answers.atlassian.com/questions/39041/jira-creating-issues-and-comments-from-email

By default this cannot be done, but by using a couple of add-ons you can successfully get it to work:
https://marketplace.atlassian.com/plugins/com.metainf.jira.plugin.emailissue
https://marketplace.atlassian.com/plugins/com.javahollic.jira.jemh-ui

Related

Azure - App Insights - how to track the logged-in Username in Auth Id?

What is the best-supported approach for tracking logged-in Usernames/Ids in App Insights telemetry?
A User with Username "JonTester1" said some Pages he visited 4 hours ago were really slow. How can I see everything JonTester1 did in App Insights to trouble shoot/know which pages he's referring to?
Seems like User Id in App Insights is some Azure-generated anonymized thing like u7gbh that Azure ties to its own idea of the same user (thru cookie?). It doesn't know about our app's usernames at all.
I've also seen a separate field in App Insights called Auth Id (or user_AuthenticatedId in some spots), which looks to sometimes have the actual username e.g. "JonTester1" filled in - but not always... And while I don't see any mention of this field in the docs, it seems promising. How is our app's code/config supposed to be setting that Auth Id to make sure every App Insights log/telemetry has it set?
Relevant MS docs:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/usage-send-user-context
This looks to just copy one library Telemetry object's User Id into another... no mention of our custom, helpful Username/Id anyway... and most in-the-wild examples I see don't actually look like this, including MS docs own examples in the 3rd link below; they instead hardcode get a new TelemetryClient()
https://learn.microsoft.com/en-us/azure/azure-monitor/app/website-monitoring No mention of consistently tracking a custom Username/Id
https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#authenticated-users Shows some different helpful pieces, but still no full example. E.g. it says with only the setAuth... JS function call (still no full example of working client-side JS that tracks User) on the page, you don't need any server-side code for it to track custom User Id across both client-side and server-side telemetry sent to Azure... yet then it also shows explicit code to new up a TelemetryClient() server-side to track User Id (in the Global.asax.cs or where?)... so you do need both?
Similar SO questions, but don't connect the dots/show a full solution:
Azure Insights telemetry not showing Auth ID on all transactions
Application Insights - Tracking user and session across schemas
How is Application insight tracking the User_Id?
Display user ID in the metrics of application Insight
I'm hoping this question and answers can get this more ironed out; hopefully do a better job of documentation than the relevant MS docs...
The first link in your question lists the answer. What it does show you is how to write a custom telemetry initializer. Such an initializer lets you add or overwrite properties that will be send along any telemetry that is being send to App Insights.
Once you add it to the configuration, either in code or the config file (see the docs mentioned earlier in the answer) it will do its work without you needing to create special instances of TelemetryClient. That is why this text of you does not make sense to me:
[…] and most in-the-wild examples I see don't actually look like this, including MS docs own examples in the 3rd link below; they instead hardcode get a new TelemetryClient()
You can either overwrite the value of UserId or overwrite AuthenticatedUserId in your initializer. You can modify the code given in the docs like this:
if (requestTelemetry != null && !string.IsNullOrEmpty(requestTelemetry.Context.User.Id) &&
(string.IsNullOrEmpty(telemetry.Context.User.Id) || string.IsNullOrEmpty(telemetry.Context.Session.Id)))
{
// Set the user id on the Application Insights telemetry item.
telemetry.Context.User.AuthenticatedUserId = HttpContext.Current.User.Identity.Name;
}
You can then see the Auth Id and User Id by going to your AI resource -> Search and click an item. Make sure to press "Show All" first, otherwise the field is not displayed.
Auth Id in the screenshot below is set to the user id from the database in our example:
We access the server from azure functions as well so we set the user id server side as well since there is no client involved in such scenarios.
There is no harm in settting it in both places, javascript and server side via an initializer. That way you cover all scenario's.
You can also manually add user id to app insights by
appInsights.setAuthenticatedUserContext(userId);
See App Insights Authenticated users

How does User Custom Field Value work in Jira Notification scheme

I am new to Jira and I have issue when some of the users are not getting email notification when someone tags them in a comment of the story.
My suggestion is to create outlook group and then I can add that as group in Notification scheme.
Along with that I would like to know how User Custom field value and Group custom field value works.
Any information along these lines is appreciated.
Thanks
About notifications:
add your users to jira, and set emails
create your groups (or roles) depending on what make more sense.
Then add users to groups
go to Admin>issues>notifications schemes> : create your scheme
Set notifications to your scheme, adding people to each event
There is a notification called "issue commented" or something similar.
Click add. Select Group(or role), and set wich group should be notificated
About the mentions, it is automatic, but you have to ensure your users are in the jira users directory and not only in a MActive Directory or whatever (if i remember ok):
http://blogs.atlassian.com/2013/06/using-watchers-and-mentions-effectively/
Say you and a coworker both discover the same issue; obviously, only one of you should file it. In the description you can quickly use an #mention to loop your colleague in on the issue. When you submit the issue to JIRA, they will get one notification that the issue was filed. That way, they don’t file the issue thinking that you didn’t. The benefit of using an #mention over adding them as a watcher is that they only get notified once.
About this question :"Along with that I would like to know how User Custom field value and Group custom field value works."
They works really similar to usual users and groups. What's your problem with them exactly.
Regards,

Jira , How to check if a ticket has been created from email or manually

I am using a jira mail handler to automatically create tickets whenever email comes to a particular mail id. However many of the users who are sending mails are part of jira users and jira will create the issue with creator as their name. Later looking at the tickets is there any way to identify whether the ticket was created from email or the user manually created it. Thanks in advance
I think, it is not possible automatically. What about using a extra customfield? this way you can fill that new field, with the value you want: one for manually opened tickets, and another for email opened tickets. You can show or hide this field, and this would allow you to look for manually opened using jql (even it is not your first need :) )
For making it more visual, then you can use a bit of proggramatic magic and represent the values with icons or wahtever.
Let me know if it is not clear or if you need help for adding the new field or whatever.
Edit: the easiest way for doing this could be add to every issues opened by mail, at the begining of the summary something like "from mail:" and then the real summary. Anyway probably better if you customize the handler or create new one
Regards

Jira: Creating Issues and Comments from Email with no subject

I'm looking for a way to control the way the "Creating Issues and Comments from Email" works. At the moment since we are using the built in system any received email that has no subject cause the service to fail with the message "Issue must have a summary. The mail message has an empty or no subject.". Every time this happens we have to process the email manually.
Do you know of any way around this?
EDIT
The emails are being sent by customers, so I can't enforce all of them to send a subject.
The problem is that the mail creation service won't process the email once it has no subject.. so setting default value won't help. The only way i can think of is rewriting the mail service. Does anyone knows how could i do that? i I found the original source code here, but not sure how to build and deploy it.
Anyway can think of any other way?
Thanks!!
I assume that you just added some service to Jira in admin interface which automatically serializes emails.
If you want to fully customize the default behaviour, you can write your own simple jira plugin.
See the Atlassian pages:
https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project
https://developer.atlassian.com/display/JIRADEV/Component+Plugin+Module
Your atlassian-plugin.xml should include something like:
<component key="message-handler-factory" class="com.atlassian.jira.plugins.mail.internal.DefaultMessageHandlerFactory" public="true">
<interface>com.atlassian.jira.service.util.handler.MessageHandlerFactory</interface>
</component>
You can for example extend the CreateOrCommentHandler class.

Assigning Fogbugz cases programmatically

I want to write an application that assigns Fogbugz cases programmatically, how would I accomplish this? Is it possible to achieve this given any of the following scenarios:
The user enters text in my
application's input field and the
Fogbugz report is opened in the
browser where the "note" field is
populated with the text from the user
input
The fogbugz report is assigned to the
specified user in the application
without the browser even being opened
i.e. the report is stored directly in
the DB.
I'm planning to add default values to the other fields as well so I would assume the process would be the same for adding text to the "note" field.
You can do this with the Fogbugz API. See the heading "Editing Cases" for the specifics on how to edit a case (which includes creating a new one). It's a little complicated (or perhaps just oddly designed) but, as I remember, you basically have to call cmd=new if you want to create a new case, supply your text in the 's' parameter and set the ixPersonAssignedTo to the correct person. For an existing case, use cmd=edit.
This is possible both with a regular form posted to your Fogbugz installation and some server side code that calls the API.
You might want to write a plugin for FB and allow others to use it. (share it or sell it)

Resources