Condividi tramite


Recuperare, aggiornare ed eliminare entità.

 

Data di pubblicazione: gennaio 2017

Si applica a: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

In questo argomento viene mostrato come recuperare, aggiornare ed eliminare un'entità utilizzando l'entità Bank Account personalizzata creata in Creare un'entità personalizzata.

In questo argomento

Recuperare e aggiornare un'entità

Per eliminare un'entità personalizzata

Recuperare e aggiornare un'entità

Nell'esempio di seguito viene illustrato come recupera un'entità con il messaggio RetrieveEntityRequest. Quindi aggiorna l'entità per disabilitare la stampa unione impostando la proprietà di IsMailMergeEnabled su false e imposta HasNotes su true nel UpdateEntityRequest per specificare che l'entità deve includere una relazione con l'entità Annotation in modo che l'entità possa visualizzare note.



RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
{
 EntityFilters = EntityFilters.Entity,
 LogicalName = _customEntityName
};
RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)_serviceProxy.Execute(retrieveBankAccountEntityRequest);
EntityMetadata BankAccountEntity = retrieveBankAccountEntityResponse.EntityMetadata;

// Disable Mail merge
BankAccountEntity.IsMailMergeEnabled = new BooleanManagedProperty(false);
// Enable Notes
UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
 Entity = BankAccountEntity,
 HasNotes = true
};



_serviceProxy.Execute(updateBankAccountRequest);


Dim retrieveBankAccountEntityRequest As RetrieveEntityRequest = New RetrieveEntityRequest With {
 .EntityFilters = EntityFilters.Entity,
 .LogicalName = _customEntityName
}
Dim retrieveBankAccountEntityResponse As RetrieveEntityResponse = CType(_serviceProxy.Execute(retrieveBankAccountEntityRequest), RetrieveEntityResponse)
Dim BankAccountEntity As EntityMetadata = retrieveBankAccountEntityResponse.EntityMetadata

' Disable Mail merge
BankAccountEntity.IsMailMergeEnabled = New BooleanManagedProperty(False)
' Enable Notes
Dim updateBankAccountRequest As UpdateEntityRequest = New UpdateEntityRequest With {
 .Entity = BankAccountEntity,
 .HasNotes = True
}
_serviceProxy.Execute(updateBankAccountRequest)

Per eliminare un'entità personalizzata

Nell'esempio seguente viene utilizzato il messaggio DeleteEntityRequest per eliminare l'entità con il nome logico specificato dalla variabile _customEntityName.


DeleteEntityRequest request = new DeleteEntityRequest()
{
 LogicalName = _customEntityName,
};
_serviceProxy.Execute(request);

Dim request As New DeleteEntityRequest() With {.LogicalName = _customEntityName}
_serviceProxy.Execute(request)

Vedere anche

Utilizzare il codice di esempio e dell'helper
Personalizzare i metadati dell'entità
Creare e aggiornare un'entità che è possibile inviare per posta elettronica
Creare un'entità personalizzata

Microsoft Dynamics 365

© 2017 Microsoft. Tutti i diritti sono riservati. Copyright