Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Create Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Creates a business entity instance.

The relevant classes are specified in the following table.

TypeClass
RequestCreateRequest
ResponseCreateResponse
TargetTargetCreate
Optional ParametersCreateDuplicatesOptionalParameter

PersistInSyncOptionalParameter

RequestIdOptionalParameter

EntitySee the following table.

The following table shows the entities and target classes for this message.

EntityTarget class
accountTargetCreateAccount
activitymimeattachmentTargetCreateActivityMimeAttachment
annotationTargetCreateAnnotation
annualfiscalcalendarTargetCreateAnnualFiscalCalendar
appointmentTargetCreateAppointment
attributemapTargetCreateAttributeMap
businessunitTargetCreateBusinessUnit
businessunitnewsarticleTargetCreateBusinessUnitNewsArticle
calendarTargetCreateCalendar
campaignTargetCreateCampaign
campaignactivityTargetCreateCampaignActivity
campaignresponseTargetCreateCampaignResponse
columnmappingTargetCreateColumnMapping
competitorTargetCreateCompetitor
constraintbasedgroupTargetCreateConstraintBasedGroup
contactTargetCreateContact
contractTargetCreateContract
contractdetailTargetCreateContractDetail
contracttemplateTargetCreateContractTemplate
Custom entityTargetCreateX where X is the name of the custom entity.
customeraddressTargetCreateCustomerAddress
customeropportunityroleTargetCreateCustomerOpportunityRole
customerrelationshipTargetCreateCustomerRelationship
discountTargetCreateDiscount
discounttypeTargetCreateDiscountType
duplicateruleTargetCreateDuplicateRule
duplicateruleconditionTargetCreateDuplicateRuleCondition
DynamicEntityTargetCreateDynamic
emailTargetCreateEmail
equipmentTargetCreateEquipment
faxTargetCreateFax
fixedmonthlyfiscalcalendarTargetCreateFixedMonthlyFiscalCalendar
importTargetCreateImport
importfileTargetCreateImportFile
importmapTargetCreateImportMap
incidentTargetCreateIncident
incidentresolutionTargetCreateIncidentResolution
invoiceTargetCreateInvoice
invoicedetailTargetCreateInvoiceDetail
isvconfigTargetCreateIsvConfig
kbarticleTargetCreateKbArticle
kbarticlecommentTargetCreateKbArticleComment
kbarticletemplateTargetCreateKbArticleTemplate
leadTargetCreateLead
letterTargetCreateLetter
listTargetCreateList
lookupmappingTargetCreateLookUpMapping
mailmergetemplateTargetCreateMailMergeTemplate
monthlyfiscalcalendarTargetCreateMonthlyFiscalCalendar
opportunityTargetCreateOpportunity
opportunitycloseTargetCreateOpportunityClose
opportunityproductTargetCreateOpportunityProduct
ordercloseTargetCreateOrderClose
organizationuiTargetCreateOrganizationUI
ownermappingTargetCreateOwnerMapping
phonecallTargetCreatePhoneCall
picklistmappingTargetCreatePickListMapping
pluginassemblyTargetCreatePluginAssembly
plugintypeTargetCreatePluginType
pricelevelTargetCreatePriceLevel
productTargetCreateProduct
productpricelevelTargetCreateProductPriceLevel
quarterlyfiscalcalendarTargetCreateQuarterlyFiscalCalendar
queueTargetCreateQueue
quoteTargetCreateQuote
quotecloseTargetCreateQuoteClose
quotedetailTargetCreateQuoteDetail
relationshiproleTargetCreateRelationshipRole
relationshiprolemapTargetCreateRelationshipRoleMap
reportTargetCreateReport
reportcategoryTargetCreateReportCategory
reportentityTargetCreateReportEntity
reportvisibilityTargetCreateReportVisibility
resourcespecTargetCreateResourceSpec
roleTargetCreateRole
salesliteratureTargetCreateSalesLiterature
salesliteratureitemTargetCreateSalesLiteratureItem
salesorderTargetCreateSalesOrder
salesorderdetailTargetCreateSalesOrderDetail
savedqueryTargetCreateSavedQuery
sdkmessageprocessingstepTargetCreateSdkMessageProcessingStep
sdkmessageprocessingstepimageTargetCreateSdkMessageProcessingStepImage
sdkmessageprocessingstepsecureconfigTargetCreateSdkMessageProcessingStepSecureConfig
semiannualfiscalcalendarTargetCreateSemiAnnualFiscalCalendar
serviceTargetCreateService
serviceappointmentTargetCreateServiceAppointment
siteTargetCreateSite
subjectTargetCreateSubject
systemuserTargetCreateSystemUser
taskTargetCreateTask
teamTargetCreateTeam
templateTargetCreateTemplate
territoryTargetCreateTerritory
transactioncurrencyTargetCreateTransactionCurrency
transformationmappingTargetCreateTransformationMapping
transformationparametermappingTargetCreateTransformationParameterMapping
uomTargetCreateUoM
userqueryTargetCreateUserQuery
webwizardTargetCreateWebWizard
wizardaccessprivilegeTargetCreateWizardAccessPrivilege
wizardpageTargetCreateWizardPage
workflowTargetCreateWorkflow
workflowdependencyTargetCreateWorkflowDependency
workflowlogTargetCreateWorkflowLog

Remarks

To use this message, pass an instance of the CreateRequest class as the request parameter in the Execute method.

The entity instance specified in the target must contain all the attributes that are marked as system required in the class topic for the entity. If the entity instance includes attributes that are not valid for create, they will be ignored.

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see Create Privileges.

For better performance, use the Create method instead of using this message.

Example

The following code example demonstrates how to create a business entity.

[C#]
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the account object.
account account = new account();

// Set the properties of the account object.
account.name = "Fourth Coffee";
account.address1_line1 = "23 Market St.";
account.address1_city = "Sammamish";
account.address1_stateorprovince = "MT";
account.address1_postalcode = "99999";
account.donotbulkemail = new CrmBoolean();
account.donotbulkemail.Value = true;

// Create the target object for the request.
TargetCreateAccount target = new TargetCreateAccount();

// Set the properties of the target object.
target.Account = account;

// Create the request object.
CreateRequest create = new CreateRequest();

// Set the properties of the request object.
create.Target = target;

// Execute the request.
CreateResponse created = (CreateResponse)service.Execute(create);
[Visual Basic .NET]
' Set up the CRM Service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the account object.
Dim account As New account()

' Set the properties of the account object.
account.name = "Fourth Coffee"
account.address1_line1 = "23 Market St."
account.address1_city = "Sammamish"
account.address1_stateorprovince = "MT"
account.address1_postalcode = "99999"
account.donotbulkemail = New CrmBoolean()
account.donotbulkemail.Value = True

' Create the target object for the request.
Dim target As New TargetCreateAccount()

' Set the properties of the target object.
target.Account = account

' Create the request object.
Dim create As New CreateRequest()

' Set the properties of the request object.
create.Target = target

' Execute the request.
Dim created As CreateResponse = CType(service.Execute(create), CreateResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.