You are a Dynamics 365 Finance developer. You create a class.
You need to mark the class to ensure that when code is compiled, the process fails if a specific method is called in the source code.
Which attribute should you use?
Answer:
D
One use of the SysObsoleteAttribute class is to notify the compiler that the compile should fail if a particular method is called in the source code. The compiler rejects the compile, and displays the specific message that is stored in this use of the attribute.
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-attribute-classes
You are a Dynamics 365 Finance developer.
You have a table named FMVehicle that contains a field named VehicleId. The table has an index named VehicleIdIdx on the VehicleId field. You declare a table buffer named vehicle to refer to the table.
You need to select all records from the FMVehicle table in ascending order based on VehicleId field in the vehicle variable.
Which embedded-SQL statement should you use?
Answer:
B
The 'index VehicleIdIdx' statement will cause an Order By Asc of the fields contained in the index. In this case, that means an Order By Asc of the VehicleID field.
HOTSPOT -
You have a Dynamics 365 Finance environment.
You have the following code: (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:
Answer:
Box 1: Yes -
Class extension - Method wrapping and Chain of Command.
The functionality for class extension, or class augmentation, has been improved. You can now wrap logic around methods that are defined in the base class that you're augmenting. You can extend the logic of public and protected methods without having to use event handlers. When you wrap a method, you can also access public and protected methods, and variables of the base class. In this way, you can start transactions and easily manage state variables that are associated with your class.
Box 2: Yes -
In the following example, the wrapper around doSomething and the required use of the next keyword create a Chain of Command (CoC) for the method. CoC is a design pattern where a request is handled by a series of receivers. The pattern supports loose coupling of the sender and the receivers
[ExtensionOf(classStr(BusinessLogic1))]
final class BusinessLogic1_Extension
{
str doSomething(int arg)
{
// Part 1
var s = next doSomething(arg + 4);
// Part 2
return s;
}
}
Box 3: Yes -
Instance and static methods can be wrapped by extension classes. If a static method is the target that will be wrapped, the method in the extension must be qualified by using the static keyword.
Box 4: No -
Wrapper methods must always call next.
Note: Wrapper methods in an extension class must always call next, so that the next method in the chain and, finally, the original implementation are always called. This restriction helps guarantee that every method in the chain contributes to the result.
In the current implementation of this restriction, the call to next must be in the first-level statements in the method body.
Here are some important rules:
✑ Calls to next can't be done conditionally inside an if statement.
✑ Calls to next can't be done in while, do-while, or for loop statements.
✑ A next statement can't be preceded by a return statement.
✑ Because logical expressions are optimized, calls to next can't occur in logical expressions. At runtime, the execution of the complete expression isn't guaranteed.
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc
HOTSPOT -
You are a Dynamics 365 Finance developer.
You have the following code: (Line numbers are included for reference only.)
You need to evaluate the code.
What is the correct output for the method? To answer, select the appropriate option in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
Answer:
Box 1: One, Two, Four, Fire -
The statements in the finally clause are executed when control leaves the try block, either normally or through an exception.
Box 2: One, Three, Four, Five -
Box 3: One, Three -
Return ends the call.
Box 4: One, Three, One, Two, Four, Five
Retry restarts the try statement.
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-exceptions
HOTSPOT -
You have the following code:
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:
Answer:
Box 1: Yes -
Add 1 to a date adds one day.
Box 2: No -
Date2num converts a date to an integer that corresponds to the number of days since January 1, 1900 so this would give us a large number.
Int2str converts the large number into a string.
Str2date converts a string to a date. However, the large number would not be in the correct format for a date.
Reference:
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/types-of-fields https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-conversion-run-time-functions
You are using the SysTest framework to test code in Visual Studio.
You need to create a unit test class.
Which three attributes can you use to create the class? Each correct answer presents a complete solution.
NOTE: Each correct selection is worth one point.
Answer:
BCE
The SysTest framework now supports the major test attributes in the adaptor to be on par with the MSTest framework adaptor. This includes attributes like
Category, Owner, Priority, and Test Property.
Note:
The Priority attribute SysTestPriority, which requires an integer value, is now available. A priority can only be specified once, but is supported on both the class and method level, with method level taking precedence over class level.
The Owner attribute, SysTestOwner, has also been added. This attribute was technically already supported for filtering in the Test Toolbox window, but the attribute itself was missing in X++. Similar to Priority, an owner can only be specified once and is supported on both the class and method level, with the method level taking precedence.
SysTestProperty specifies a property and a value (two strings), and can now be used in the Test Toolbox window in Visual Studio. Test Property can be specified multiple times, and can exist on both the class and method level.
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/perf-test/systest-filtering
HOTSPOT -
You have the following class definition:
You need to create an extension class and create a new static method in it that converts miles to kilometers and then call the method from another class.
How should you complete the code and call the method? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
Answer:
Box 1: final class UnitConv_MyExtension
Box 2: var km = UnitConv::miToKm(62.1371);
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc
You are a Dynamics 365 Finance developer. You create an integer variable named totalSales.
You need to display the value from totalSales in an info statement.
Which three code segments can you use? Each correct answer presents a complete solution.
NOTE: Each correct selection is worth one point.
Answer:
ACD
A: int2Str converts an integer to the equivalent string.
C: any2Str converts an anytype value to a str value. The anytype data type is a placeholder for any data type.
D: Example:
void MyMethod()
{
for (int i = 0; i < 10; i++)
{
info(strfmt("i is %1", i));
}
}
Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-variables-data-types https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data-primitive#anytype
DRAG DROP -
You create a Visual Studio project named CustomerDetailUpdate.
You must update data in a table named CustTable. You must be able to run the code from Visual Studio.
In which order should you perform the actions? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.
Select and Place:
Answer:
Reference:
https://community.dynamics.com/365/financeandoperations/b/daxology/posts/runnable-class
You create a new class.
Class compilation must fail if a specific method in the source code is called.
You need to mark the class with the appropriate attribute.
Which attribute should you use?
Answer:
C
Reference:
https://docs.microsoft.com/en-us/dynamicsax-2012/developer/overview-of-attribute-classes