I often use two gmail labels label1 and label2, and according to my personal mail management rules, I often change messages categories from label1 to label2.
As I do this often, I thought I should try to automatize this process a bit by adding custom gmail command.
Here are the specifications of my mini-feature :
1) When a message (according to gmail api, a "thread") labelled label1 is selected in gmail, a button "CHANGE LABEL1 TO LABEL2" should be displayed in my gmail interface
2) When I click this button, selected message's label1 should be removed, while a label2 label would be added
That's it for the features.
Technically, here is what I think is needed :
a) A way to get and set the labels attached to a given message thread (identified by an id)
b) A way to display a button conditionally
c) A way to trigger a script when the button is clicked
d) A way to detect the id of selected message thread
Here are the technical solutions I think are available for each part :
a) ...is possible via a Google Apps Script, using GmailThread::addLabel and GmailThread::removeLabel
b) ...seems possible via a contextual gadget
c) ...is my first concern, since clicking on the button from b) should launch the script from a)
Also, the call to the a) script should pass the message thread id as a parameter.
d) ...is my second concern, maybe is it also possible via a contextual gadget, since those can parse the contents of a message ?
Does it seem possible to implement this mini-feature given the actual technology provided by google for scripting ?
More precisely, is it possible to make Gmail Gadgets and Gmail Apps Scripts interact ?
Or are there some alternatives to implement it ?
Additional information : I tried to investigate other technologies provided by Google to customize its product, but it seems that Gmail Labs API is not open to the public. Also, I don't think I could use a Gmail Sidebar Gadget since they do not seem to be able to know which message is currently selected in the gmail interface.
I don't know if you can use a contextual gadget this way but you may write a simple script (time triggered) who search for threads with a third label (or one of the stars) used by you as an indicator of your will to toggle labels...
The script search the threads you mark and toggle labels (than remove the mark) ...
Pretty easy ...
I do something similar at the moment using a contextual gadget. The only way I know to change the labels is via IMAP. My gadget passes the details of the email to my server which uses IMAP to connect to email message and change its label. Although this seems a long winded way of doing this I think it is your only option.
Related
I am trying to use Google Analytics to retrieve metrics from an API.
The thing is, I am not sure to understand how the whole analytics tracking works. I tried to understand how to implement custom metrics and dimensions from this : https://developers.google.com/analytics/devguides/collection/analyticsjs/events but I am still not very sure on how to proceed.
Let us say for instance that I want to send a custom event to Analytics when a client clicks on a button to create a PDF.
Should I write something like :
ga('send', {
hitType: 'event',
eventCategory: 'Project',
eventAction: 'pdf_export',
eventLabel: 'StartOfProject'
});
And put it in the handler of the endpoint route corresponding to the page launched when the button is clicked?
Or do I have to create an event with EventEmitter? I must confess I am quite lost here...
[EDIT] Victor Leontyev showed a very easy way to of it (thank you!), however it was here a rather simple use case. I was also wondering :
If I want to send a custom metric (a ratio...), should I put it in the optional eventValue?
If I want to have the number of PDF (to keep with the same example) per day, how can I do? It would mean I guess that I should launch an event every 24H on a precise hour, and have kept somewhere (in a DB?) the data for the day so I can send it? Can this easily be done?
The other kind of metrics I need would be periods between two actions, lie let us say between the click on the 'Create a new PDF' button and a 'Print the PDF' one. Can it be done with launching a tier on the first button press, then stopping it and the second one and sending the time as the eventValue ? Or is it more complicated?
I warmly thank you once again for any lead/form of hep and support!
Have a nice day,
-- smgr
If you have a button, where users can download your PDF. For example:
Download PDF
And if you want to send event to GA with this data:
eventCategory: 'Project'
eventAction: 'pdf_export'
eventLabel: 'StartOfProject'
All that you need is to change HTML of your button into:
Download PDF
Then you will be able to see how many users click to your Download PDF button in GA (Behavior -> Events or Realtime -> Events)
I've created my own solution with a custom entity of type activity. I'd like to show a message whenever a new instance of it is created using an existing contact but not allow the user to create one, if only attempting to do that without going via contact.
Basically, my aim is that it won't be impossible to just create that activity (the form will be hidden directly at any attempt except for one way only). The user will have to go to contacts (or leads etc.) and in there add and create an instance of the custom activity entity. That way, I can assure that the field "regarding" will be filled out already.
I'm guessing that I need to detect somehow that the opening of the form is a creation attempt. How can I do that?
Also, as it is now, the user can't create a contact-less activity of the custom type because it doesn't appear on the menu with other activities. I must have disabled it somehow but I have no idea how. Anybody who has one?
You could do this a bunch of ways but the easiest would probably be to:
Make the regarding field read only.
Make the regarding field mandatory.
That way if a user opens a create new form they wont be able to set the regarding and because its mandatory they wont be able to save the record. When they open via an existing contact the regarding field will be mapped automatically. That said in this case just making it mandatory my be enough.
(As a side JavaScript can be used to identify the current form state, but I'm not sure how useful that is here).
In terms of where custom activities appear, by default mine show in a number of locations, for example:
CRM > Workplace > Activities > Ribbon > Other Activities > XXX.
CRM > Workplace > Activities > View Selector > XXX.
They don't show under the left hand navigation of the workplace because they are grouped under 'Activities'. I'm pretty sure these are all the default settings.
You can exercise greater control by editing the sitemap, where you can put pretty much anything, anywhere.
In addition to Mr Wood, I'd like to show you some code. It works as supposed to but I'm not sure if it's optimal.
var foo = function () {
var whatIsGoingOn = Xrm.Page.ui.getFormType();
if (whatIsGoingOn === 1)
alert("Let there be an entity!");
else
alert("Not a creation...");
}
The other states' (deletion, update etc.) numeric values are listed here.
Answering the second part of your question:
When you create a custom activity you can choose whether to have it appear in 'normal' Activity menus or not by checking the box at the top right of the entity form. This is a once-only choice as far as I know and can't be changed later.
For your setup, I would suggest NOT checking this box, so it does not appear in the activity menus to avoid users even being tempted to do it that way.
Instead, add an explicit relationship to the activity N:1 to Contact, and another N:1 to Lead. Use this relationship to add your activity to the left navigation of Contact and Lead forms, or add a grid for them (depends on how you want to use this and if you need to filter the view to something other than the default "Associated View").
When a user navigates to this section they will see if any previous activities of this type exist, and be able to add a new one. BUT this means that the child record is a child via this relationship, not using "regarding", so use a script on the form for the activity so that if Contact is filled in, it is copied to Regarding, and if Lead is filled in then that is copied. If neither, then use an alert or other means to warn the use that something is wrong (see comment earlier). If you want Regarding to be read-only but filled in by script, you will need to make sure to use the force the value to be saved:
Xrm.Page.getAttribute("regardingobjectid").setSubmitMode("always");
You must have the lookups for Contact and Lead on the form to be able to use them in your scripts, but you can make them not "visible by default" so they are there but not seen by the user (and taking up no space).
This is what I am trying to do, when my apps load, user is presented with a bunch of options ( These options are coming from a server) and when user selects one of those options I have to create a new tab bar controller with number of tabs, their name, their layout all coming from a server in the xml format. So the first question is it possible to do this in iphone, that is create all the view controller programmatically on the run time, if yes can you please point me to some reference, i have been searching in google, but may be my search terms are not good, I am not getting back any results.
Of course, it's possible. Anything that can be done using IB can also be done in code. In your particular case, you have to subclass the UITabBarController class and then use the viewControllers property to populate the bar at runtime, depending on your XML.
Please refer to the class reference at Apple.com for more information.
Possible duplicate of iPhone -- create UITabBar programmatically?
since the emails loads dynamically how do you find a specific email that contains a button back to your site. This is like signing up at a site. Customer receives email to confirm.
Thanks for the support
BigD
OWA, bless MS's little hearts (at least in the circa 2003 version I'm looking at here) uses frames, so first of all brush up on that or you are gonna be hating life. The list of incoming messages is in a frame named 'viewer' The message summaries are contained in a table lacking any useful means to identify it that is in a div of class 'msgViewerCont" and an ID of dvContents. So to see if a message exists you want to look to see if you can find a row in that table which contains the subject you expect to see.
(be careful using ID values on OWA.. apparently nobody in the group that developed it read the part of the HTML standard that specifies that ID values are supposed to be unique.. the re-use them all over that page.)
Presuming you know the subject of the message you are about to receive, and also that you keep that mail account cleared out so that it will be the ONLY message there with that subject line, then you can check to see if it exists usng
subject = regex.new("subject you are looking for")
browser.frame(:name, 'viewer').div(:id, dvContents).table(:index, 1).row(:text, subject).exists?
to click on it use .click instead of exists.
once you've clicked it, OWA will refresh the PreviewPane iframe.. inside that iframe is another one that has the message body in it.
all those frames, are nested inside the viewer frame. welcome to nested frame hell. hope you enjoy your stay. (like I said, bone up on frames, you're in for a fun ride)
Is there a way to manage Gmail lables(Virtual folders) with mutt??
Quoting this source,
A very cool gmail feature is the ability to add label to emails (also called "tags" in other contexts), and then view only mails with a given label.
There is a semi-standard email header called "X-Label" which can be used to store labels. mutt supports searching it, filtering views according to the value, and showing it in the index view; but it doesn't allow you to change it (although there are patches).
There are some useful code snippets in the link above.