Partager via


OrganizationService.Create Method (Entity)

 

Applies To: Dynamics CRM 2015

Creates a record. (Developer Extensions)

Namespace:   Microsoft.Xrm.Client.Services
Assembly:  Microsoft.Xrm.Client (in Microsoft.Xrm.Client.dll)

Syntax

public virtual Guid Create(
    Entity entity
)
public:
virtual Guid Create(
    Entity^ entity
)
abstract Create : 
        entity:Entity -> Guid
override Create : 
        entity:Entity -> Guid
Public Overridable Function Create (
    entity As Entity
) As Guid

Parameters

  • entity
    Type: Microsoft.Xrm.Sdk.Entity

    An entity instance that contains the properties to set in the newly created record.

Return Value

Type: System.Guid

Type: Guid
The ID of the newly created record.

Implements

IOrganizationService.Create(Entity)

Remarks

This is a wrapper for the IOrganizationService. Create Method.

Message Availability

 This message works regardless whether the caller is connected to the server or offline.

Not all entity types support this message offline. See Supported Entities later in this topic.

Privileges and Access Rights

To perform this action, the caller must have privileges on the entity that is specified in the entity parameter. For a list of the required privileges, see Create message privileges.

Notes for Callers

This method creates one record in a transaction. To create a record that has related records in a transaction, use CreateRequest.

By default the caller becomes the owner for the new record. However, for the caller to own the new record, it must have both Create and Read privileges for the entity. For more information, see Privileges by entity. Alternatively, you can set the ownerid property to the ID of another user.

The entity instance that is specified as a parameter must contain values for all the attributes where the RequiredLevel is set to SystemRequired. You can see this in the metadata topic for the entity. If the entity instance includes properties where IsValidForCreate is false, the values are ignored. You can find this information in the metadata for your organization. See the preceding metadata browser information.

For more information about the exceptions that can be thrown when this method is called, see Handle exceptions in your code.

Supported Entities

You can use this method to create any record of an entity that supports the Create message, including custom entities.

The following table shows the default entities that support this message. For the listed entities of this message, the Availability column shows Server if the caller must be connected to the server and shows Both if the caller can be either connected to, or disconnected from, the server.

Entity

Availability

account

Both

activitymimeattachment

Both

annotation

Both

annualfiscalcalendar

Both

appointment

Both

asyncoperation

Server

attributemap

Server

businessunit

Server

businessunitnewsarticle

Both

calendar

Both

campaign

Both

campaignactivity

Both

campaignresponse

Both

columnmapping

Both

competitor

Both

connection

Both

connectionrole

Both

connectionroleobjecttypecode

Both

constraintbasedgroup

Both

contact

Both

contract

Both

contractdetail

Both

contracttemplate

Server

customeraddress

Both

customeropportunityrole

Both

customerrelationship

Both

discount

Server

discounttype

Server

duplicaterule

Server

duplicaterulecondition

Server

email

Both

equipment

Server

fax

Both

fieldpermission

Server

fieldsecurityprofile

Server

fixedmonthlyfiscalcalendar

Both

goal

Server

goalrollupquery

Server

import

Both

importentitymapping

Both

importfile

Both

importjob

Both

importmap

Both

incident

Both

incidentresolution

Both

invoice

Both

invoicedetail

Both

isvconfig

Server

kbarticle

Both

kbarticlecomment

Both

kbarticletemplate

Both

lead

Both

letter

Both

list

Both

lookupmapping

Both

mailmergetemplate

Both

metric

Server

monthlyfiscalcalendar

Both

msdyn_postalbum

Server

msdyn_postconfig

Server

msdyn_postruleconfig

Server

opportunity

Both

opportunityclose

Both

opportunityproduct

Both

orderclose

Both

organizationui

Server

ownermapping

Both

phonecall

Both

picklistmapping

Both

pluginassembly

Server

plugintype

Server

post

Server

postcomment

Server

postfollow

Server

postlike

Server

pricelevel

Server

principalobjectattributeaccess

Server

processsession

Both

product

Server

productpricelevel

Server

publisher

Server

publisheraddress

Server

quarterlyfiscalcalendar

Both

queue

Server

queueitem

Both

quote

Both

quoteclose

Both

quotedetail

Both

recurrencerule

Server

recurringappointmentmaster

Both

relationshiprole

Both

relationshiprolemap

Both

report

Server

reportcategory

Server

reportentity

Server

reportvisibility

Server

resourcespec

Both

role

Server

rollupfield

Server

salesliterature

Server

salesliteratureitem

Server

salesorder

Both

salesorderdetail

Both

savedquery

Server

savedqueryvisualization

Server

sdkmessageprocessingstep

Server

sdkmessageprocessingstepimage

Server

sdkmessageprocessingstepsecureconfig

Server

semiannualfiscalcalendar

Both

service

Server

serviceappointment

Both

serviceendpoint

Server

sharepointdocumentlocation

Server

sharepointsite

Server

site

Server

solution

Server

subject

Both

systemform

Server

systemuser

Server

task

Both

team

Server

template

Both

territory

Server

transactioncurrency

Server

transformationmapping

Both

transformationparametermapping

Both

uom

Server

uomschedule

Both

userentityinstancedata

Both

userentityuisettings

Both

userform

Server

userquery

Both

userqueryvisualization

Both

webresource

Server

workflow

Server

workflowdependency

Server

workflowlog

Server

See Also

OrganizationService Class
Microsoft.Xrm.Client.Services Namespace
Model your business data
Access entity relationships (Dynamics CRM 2015)
Developer extensions context object model (Dynamics CRM 2015)
Developer extensions for Microsoft Dynamics CRM 2015

Return to top

© 2017 Microsoft. All rights reserved. Copyright