First of all I am relatively new to Microsoft Dynamics CRM Online.
My aim: I want to take a list of current active campaigns (in my case a list of events) from our CRM and list them within a drop down list on a booking form. I would then like a person to fill out a form and select an event they would like to attend. After clicking submit a contact will be created in the CRM and the person will be added in the "Responses" section as attending.
What I have so far:
public void Run(String connectionString, String AddDetails)
{
try
{
// Establish a connection to the organization web service using CrmConnection.
Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(connectionString);
// Obtain an organization service proxy.
// The using statement assures that the service proxy will be properly disposed.
using (_orgService = new OrganizationService(connection))
{
// Instantiate an account object.
Entity account = new Entity("contact");
// Set the required attributes. For account, only the name is required.
// See the metadata to determine
// which attributes must be set for each entity.
account["lastname"] = AddDetails;
_orgService.Create(account);
}
}
// Catch any service fault exceptions that Microsoft Dynamics CRM throws.
catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
{
// You can handle an exception here or pass it back to the calling method.
throw;
}
}
I can create contacts and retrieve the unique ID for this record. This works perfectly. I just want to retrieve a campaign and attach it to the event/campaign next.
My problem: I can not seem to get a list of campaigns to added them to a web page and then attach this person to the campaign.
I have read quite a few articles for creating quick campaigns which are confusing. Is what I am trying to achieve out of the norm? or impossible? could anyone provide me with some code to get me started in the right direction?
Thanks in advance