ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 163 - PL-400 discussion

Report
Export

You have the following code:

You have a contact record that uses the GUID 991bf2fd-d40c-4752-9984-26b7c0455b69.

You need to assign the contact record as the primary contact for an account when you create the account.

Which two code segments can you use? Each correct answer presents a complete solution.

NOTE: Each correct selection is worth one point.

A.

var data = { "name": "Contoso account",

"primarycontactid": { "logicalname": "contact",

"id": "991bf2fd-d40c-4752-9984-26b7c0455b69" } };

Answers
A.

var data = { "name": "Contoso account",

"primarycontactid": { "logicalname": "contact",

"id": "991bf2fd-d40c-4752-9984-26b7c0455b69" } };

B.

var data = { "name": "Contoso account", "[email protected]":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

Answers
B.

var data = { "name": "Contoso account", "[email protected]":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

C.

var data = { "name": "Contoso account", "[email protected]":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

Answers
C.

var data = { "name": "Contoso account", "[email protected]":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

D.

var data = { "name": "Contoso account", "primarycontactid":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

Answers
D.

var data = { "name": "Contoso account", "primarycontactid":

"/contacts(991bf2fd-d40c-4752-9984-26b7c0455b69)" };

Suggested answer: A, B

Explanation:

B: To associate new table records to existing table records, set the value of single-valued navigation properties using the

@odata.bind annotation

Example: var data =

{

"name": "Sample Account",

"[email protected]": "/contacts(465b158c-541c-e511-80d3-3863bb347ba8)"

}

A: For mobile clients in the offline mode, you cannot use the @odata.bind annotation, and instead have to pass a lookup

object (logicalname and id) pointing to the target record.

var data =

{

"name": "Sample Account", "primarycontactid":

{

"logicalname": "contact",

"id": "465b158c-541c-e511-80d3-3863bb347ba8"

}}

Note Syntax:

Xrm.WebApi.createRecord(entityLogicalName, data).then(successCallback, errorCallback); entityLogicalName: Logical name of the table you want to create. For example: "account".

Data: A JSON object defining the columns and values for the new table record.

Reference:

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/createrecord

asked 05/10/2024
Mohamed Ramez Hamad
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first