Friday, September 13, 2013

Get Campaign List for a given Account/Contact in MS CRM 2011

Get all campaign where the given Account is part of.

SELECT CodeName,name FROM FilteredCampaign  -- Campaign Deatils
WHERE CampaignId IN (
SELECT CampaignId FROM FilteredCampaignItem -- Marketing list associated with the Campaign
WHERE EntityId IN (
SELECT LM.listid FROM FilteredListMember LM -- account associated with all marketing lists
LEFT JOIN FilteredAccount Account ON Account.AccountId=EntityId
WHERE Account.name='HP'))

Get all launched campaign where the given Contact is part of.

SELECT CodeName,Name FROM FilteredCampaign -- Campaign Deatils
WHERE CampaignId IN (
SELECT CampaignId FROM FilteredCampaignItem  -- Marketing list associated with the Campaign
WHERE EntityId IN (
SELECT LM.listid FROM FilteredListMember LM -- contact associated with all marketing lists
LEFT JOIN FilteredContact CONTACT ON CONTACT.ContactId=EntityId
WHERE CONTACT.FirstName='CHANDAN'))
AND statuscodename='Launched' -- Only LAUNCHED CAMPAIGN

3 comments:

Unknown said...

Keep up the fantastic piece of work, I read few blog posts on this web site and I believe that your site is real interesting and has lots of great information. ERP Software in Mumbai || System Software || CRM Software in Mumbai || MLM Software

Unknown said...

I really appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. CRM Software || MLM Software in Mumbai || ERP Software || System Software in Mumbai

Anonymous said...

Techvedic offering Best and affordable Customer Relationship Management (CRM) Solutions. It has developed VedicCloud CRM X. For consultation and support, Dial our Toll-Free Number has given below.

Techvedic Customer Relationship Management | New Delhi, India - 110058 | 1 800 3000 1126