PL-400 · Question #377
You develop code that will perform an update to existing records in a table. The update must occur based on the alternate key configured for the table. You need to perform the update. Which two…
The correct answer is A. UpdateRequest B. UpsertRequest. To update existing Dataverse records based on an alternate key, both the UpdateRequest and UpsertRequest messages can be used, with UpsertRequest offering creation if the record does not exist.
Question
Options
- AUpdateRequest
- BUpsertRequest
- CCreateRequest
- DRetrieveRequest
How the community answered
(55 responses)- A84% (46)
- C13% (7)
- D4% (2)
Why each option
To update existing Dataverse records based on an alternate key, both the UpdateRequest and UpsertRequest messages can be used, with UpsertRequest offering creation if the record does not exist.
The UpdateRequest message can be used to update an existing record by specifying the record's alternate key instead of its primary key (GUID). The alternate key attributes and values are provided within the Entity object of the request.
The UpsertRequest message is specifically designed to either update an existing record or create a new one based on a specified key, which can be an alternate key. If a record with the alternate key exists, it is updated; otherwise, a new record is created.
CreateRequest is exclusively used for creating new records and cannot be used to update existing records.
RetrieveRequest is used solely for fetching (reading) existing records and does not perform any modification operations like updating or creating.
Concept tested: Dataverse alternate key update operations
Source: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-alternate-keys
Community Discussion
No community discussion yet for this question.