How to access Gmail for storage in custom CRM using a SQL Server database? - vb.net

I have a client who wants his custom-written CRM to be able to access his sales people's emails so that, effectively, a history of email conversations between customer and salesperson is stored inside the CRM's database.
The CRM is written in Visual Basic 2008 and the database is SQL Server 2008. The only email these people use, in the shop and on the road, is Gmail. Each sales person has their own Gmail address. That's how they operate.
If they're on the road and respond to a customer's email inquiry about a product, they would like that email conversation to be stored in a table in the database. I think that's the part I can't wrap my head around. How do I get access to the email data (knowing the user id and password) and doing so from Visual Basic 2008?
A free or close to free solution would be preferred.

One thing that we have done in the past is create a separate email account and just have the users to BCC this email address, for example, crm#somewhere.com. We then have a small application, on the server, that polls email from this central mailbox and automatically attaches it to the entity based on the recipients email address.
We also allow the user to add some commands at the bottom of the email, for attaching to things like work orders and/or bills, for example, wo 1000 (for a work order 1000) or b 1000 (for bill 1000).
Just another idea.

Related

Send order confirmation mail to contact instead of account owner in Shopware B2B Suite

We have an ERP integration which has data sovereignty. All changes are made through the ERP.
The problem now is that orders go to the mail of the main account and not to that of the contact who placed the order.
The ERP only has a logic of customer accounts with contacts, but no email address for the main contact. So we had to create fake email addresses. Also, the ERP has no authorization logic. Meaning there is no admin or anything like that. So we can't just take the first user for example, because this could also be deactivated.
So I do know, that this how B2B Suite is designed, but it doesn't fit our needs.
What's the best way now to send the email to the account of the ordering contact, or at least a copy?
The B2B-Suite currently always assigns the order to the customer account. However, the information about which contact placed the order is stored in the b2b tables.
I would suggest that to follow this guide Add data to mails.
With the order-data, you could load the B2B-order-context and the Contact-Information and replace the recipients with the correct email.
Useful services would be:
Shopware\B2B\Order\FrameworkOrderContextRepository::fetchOneOrderContextByReferencedOrderId()
Shopware\B2B\StoreFrontAuthentication\Framework\StoreFrontAuthenticationRepository::fetchAuthenticationById()
Shopware\B2B\StoreFrontAuthentication\Framework\IdentityChainIdentityLoader::fetchIdentityByAuthentication()

How does one create database tables (MSSQL) to handle notifications to users and system notifications to all users?

I would like to create a notification system for a web application I'm working on. I'm having trouble designing a database that is laid out in a "correct" format. This is what I would like to accomplish:
Have different notification types, such as Office, User, Client, Vendors, and System. User, Client, and Vendors are different "classes" of users that can login to different portals on the site. They would each have notifications just to their login. Office and System would be notifications for a whole entire office, so every user would see it (like meeting notices) while system would be for every user in all systems (like website shutting down for maintenance).
I want a notification button that displays the number of unread notifications. A user can click on the notification to mark it as read to remove it from the list.
The user can go to a separate "all notifications screen" to see all the notifications they ever got and search them.
I have a single table like this:
*Table: Notifications
notification_id int primary key
entity_type varchar
entity_id int
title varchar
message varchar
created datetime
didRead bit
readDate datetime
The entity type is Office, User, Client, Vendors, or System. The id is the corresponding entity id. Since each user for users, client, and vendors are in a different table, it is possible for a separate user, client, and vendor to all have the same id like 4444 etc. The entity type lets me know what table to look into to use the id for.
This works well if the notification is for a user. One record for the one notification for the user. The user reads it and it is marked.
The problem is with system and office notifications. Once I create a single record for a system notification, I can show it to the user by doing a SQL for the their notifications OR system notifications OR office notifications. However, I have NO way of determining if that user read the system or office notification. Since the entity id in the case of system is null or in office it is the office id, if I mark it as read, it will be read for everyone in the office. Only the first person to see it gets alerted.
I could make it so every system notification creates an individual notification for a user, but lets say I have 8 million users. Doesn't that mean for every system notification that I have to create 8 million records? I may be wrong (as in maybe it is no big deal for SQL Server), but something tells me that is bad and will bloat the database fast. Especially since I can see office notifications take off.
I was thinking of making a notification read table containing entity id, entity type, and notification id, but then aren't I just moving the same issue to a different table? Also wouldn't a join to this table now need three items being the entity id, entity type, and notification id? I would assume that would kill performance once the table grew.
Main Question: How can I design the table so I am able to read/unread any notification that comes to any user, including their individual notifications and system/office wide notifications? I want system and office notifications to hit a broad range of users, while user, client, and vendor notifications only hit a specific user while allowing all cases to be readable/unreadable.
I use Microsoft SQL server if that makes a difference.
Edit:
Tried adding an image (crappy paint skills) to show what I was asking for.

Writing data from email to SQL server 2008R2

Following our company processes, our database has to send an email to a manager requesting for approval for some document record changes.
I was wondering if it was possible for the manager to reply to the server with an email containing "Yes" or "Approved" with the document# and have it update the document record accordingly. Right now, the manager has to send the QA dept the approval email, and they have to update the document record manually.
I have looked at SQL Mail, but it seems to be a bad way to go according to a lot of places.
We use Exchange 2010 and SQL Server 2008
Thanks!
Do you have IIS installed in your environment? If so, you can redirect the user from Mail (Outlook) to a service page to update the document approval flag.
If so, create a ASP or ASPX page that takes two query parameters. A document id and a approval notice.
Put two links in the email for the manager to click. You will have to send the email from SQL server with a HTML body. Enclosed are sample links for document 123.
Approve Change
Reject Change
Check out www3schools link below for details query string.
http://www.w3schools.com/asp/coll_querystring.asp
Check out the link below for details on working with databases.
http://blogs.msdn.com/b/morebits/archive/2010/09/26/working-with-data-beginners-guide-to-database-in-asp-net-web-pages-part-1.aspx
As an added feature, you might want to record the Active Directory (Windows Login) of who approved or rejected the document. That way, someone can not approve the document themselves. A date/time might be also handy.
This is one of many solutions you can use.

By what means would I unsync Outlook Address Book items synced from a specific source, particularly CRM?

So I installed the Dynamics CRM Client for Outlook and wired up a client's CRM to do some work for them. Unbeknownst to me, Microsoft decided to auto-opt-in the Contact sync to the Outlook Address Book. IE: All the contacts from the CRM's Contact entity have now synced into my primary Outlook Address Book. I now have over 35k contacts that I do NOT want in there.
Is there a way to "unsync" specific items from the Outlook Address Book that were synced from a particular source? Obviously, I only want those CRM contacts removed. Is there an API or something I could use to traverse the Address Book that would allow me to:
a) Identify which contacts came from the CRM
b) Delete them
Or, if there is a non-programmatic method of doing so? That would be best.
Try to sort the contacts by the creation date and delete the contacts that were added after you installed Dynamics CRM.

Email Synching into Custom App

How have people intergrated custom CRM type applications with email?
I have a Access 2003 front-end application with a SQL Server 2005 backend. One CRM
part of the application tracks the activity with the customer in a traffic
log table. Sometimes the salesstaff has communication with their customer
using email instead. What do people do to synch this up with an application?
I was thinking about creating a form to enter the initial message, so I
could save it into a table and then have the system generate a email, of
course, this doesn't handle the email communication after the initial email.
Thanks
What you need to do is setup your domain name with a free google apps account. Your sales staff can still use the clients of their choice, but since they are essentially using custom gmail accounts, every single email that they send and receive will be recorded in a nice and neat transactional format in the gmail interface. Since your sales staff is always online, they will always have access to every message they ever sent. If you want to have access to the emails, you can set it up that every single message that gets sent are automatically blind forwarded to your account. Filters can be set up to automatically tag and archive them, so you will not be overwhelmed, but you will still be able to search them. Google Apps will also give you a central contact directory similar to outlook/exchange.
Here are a few options for you:
Use web forms for all communications. When a message is sent out, the only thing it includes is a link back to the site. Responses are sent the same way.
Setup an email alias that your sales staff Cc's when they want their correspondence to be tracked. Your app would periodically read a POP mailbox, and record the traffic. Customers would have to remember to Cc the same email box for the traffic to be remembered.
Establish a single common email box, such as sales#domain.com. All outgoing mail is marked as being from that account, so all replies will go through it. To send mail, sales staff uses a web form. Messages are tagged with a key that associates them with a particular customer. Putting the key in the subject header usually works OK (that's how many support ticket management systems work, for example). Replies from customers keep the tag. Your app then reads an associated POP mailbox, parses out the keys, and stores the email accordingly.