exam questions

Exam PL-400 All Questions

View all questions & answers for the PL-400 exam

Exam PL-400 topic 5 question 5 discussion

Actual exam question from Microsoft's PL-400
Question #: 5
Topic #: 5
[All PL-400 Questions]

HOTSPOT -
You are examining code written by another developer that is not functioning correctly. There are no other JavaScript or business rules in use on the form.
This code is properly registered to the OnChange event of the telephone1 field on an account entity form. The main operation is to update the primary contact's phone number when the account phone number changes. The primary contact field is a lookup. (Line numbers are included for reference only.)

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Yes -
getFormTyp gets the form type for the record.
Form type 2 is Update.
Note: Syntax: formContext.ui.getFormType();

Return Value -

Type: Number -
Description: Form type. Returns one of the following values

RETURN VALUE -

Value Form type -
0 Undefined
1 Create
2 Update
3 Read Only
4 Disabled
6 Bulk Edit

Box 2: Yes -
Xrm.WebApi.updateRecord Return Value: On success, returns a promise object containing the values specified earlier in the description of the successCallback parameter.
Note:
Syntax: Xrm.WebApi.updateRecord(entityLogicalName, id, data).then(successCallback, errorCallback);
Where errorCallback: A function to call when the operation fails. An object with the following properties will be passed: errorCode: Number. The error code. message: String. An error message describing the issue.

Box 3: No -
It will displayed even if the update fails.
Reference:
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/getformtype https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/updaterecord

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Nielson
Highly Voted 3 years, 2 months ago
Second answer should be 'no'. primaryContact on line 11 will be null resulting in javascript error on line 12 (primaryContact[0] => Cannot read properties of null)
upvoted 33 times
...
ETU69
Highly Voted 3 years ago
To summarize: Yes, No, Yes should be the correct answers.
upvoted 27 times
ziggy1117
1 year, 3 months ago
Xrm.webapi is an asynch call.. so it can happen that the Done dialog box will display before xrm.webapi finishes
upvoted 7 times
...
...
Juan0414
Most Recent 2 months ago
Yes - https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/formcontext-ui/getformtype#return-value No - Line 12 would fail because of null No - The alert on line 21 will be shown regardless the call is successful or not, also the order is not guaranteed as it is an async call
upvoted 1 times
...
hai297
7 months, 1 week ago
Yes No: will throw error on line 12 No: Always show popup even any event on update record, and the update is async
upvoted 7 times
...
700157a
1 year, 3 months ago
Answer is Y,N,N
upvoted 5 times
...
ziggy1117
1 year, 3 months ago
Y N - the code will fail if the primaryContact is null, code will stop and will throw an error N - no because Xrm.WebApi is an Asynch call the the "Done" dialog box is outside the Asynch call. So it can (probably most of the time) happen that the Done dialog box will even display first
upvoted 7 times
...
yuko17
1 year, 5 months ago
Yes、No、Yes
upvoted 2 times
yuko17
1 year, 5 months ago
Yes,No,No
upvoted 3 times
...
...
CRMBug
1 year, 11 months ago
Yes ,No , No
upvoted 3 times
...
No_Doubt
2 years ago
1- Yes: since formtype 2 is update 2- No: JS error, reading attribute from a null object before the call of the API 3- No: this is an async call, so saying ALWAYS make it wrong.
upvoted 5 times
...
Flatternschuchtern
2 years, 1 month ago
The correct answers are: 1) Yes 2) No, it will crash before getting to callback. 3) No, it is outside of callback and will not be awaited.
upvoted 6 times
...
northstar88
2 years, 1 month ago
To help reinforce, the last one should be NO. Xrm.WebApi.updateRecord is an async promise function. Once the line is called, client will not wait for the result and will immediately call line 21. If the update is REALLY quick, I think it is possible for line 21 to show after update is completed and line 15 called. However it is unlikely, and since the answer has "always" in it, the statement is false. Hence, No.
upvoted 3 times
...
CE_Team_Gold
2 years, 4 months ago
Y,N,N - Clearly. Source: 4 years as a Developer in Dynamics 365 CE. Explanation: UpdateRecord is async.The function gets called and then the 21st line gets run directly after. After the callback async function finishes, the success/errorcallback-alert will be shown. The 3. Statement even says "always" - which is a clear indicator for a false statement here.
upvoted 7 times
...
CinthiaN
2 years, 8 months ago
IMO - Yes, No, Yes
upvoted 2 times
...
crismadalina
2 years, 9 months ago
Yes,no,no
upvoted 4 times
...
shibax
2 years, 9 months ago
Y,N,N is correct!
upvoted 6 times
...
shibax
2 years, 9 months ago
Y,N,Y is correct
upvoted 5 times
...
HelloWorldHere
2 years, 9 months ago
Yes No No
upvoted 7 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago