### Example X++ deployable package class implementation
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/fin-ops-core/dev-itpro/deployment/run-custom-scripts.md
Complete example of a deployable package class with transaction handling, company context validation, record update operations, and result verification. Includes error handling and success messaging as recommended best practices.
```xpp
class MyScriptClassForIssueXYZ
{
public static void main(Args _args)
{
if (curExt() != 'DAT')
{
throw error("This script must run in the DAT company!");
}
ttsbegin;
MyTable myTable;
update_recordset myTable
setting myField = 17
where myTable.myReference == 'xyz';
if (myTable.RowCount() != 1)
{
throw error("Not updating the expected row!");
}
info("Success");
ttscommit;
}
}
```
--------------------------------
### Query Employee detail entity via HTTP GET
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/human-resources/hr-employ-detail.md
This example demonstrates querying the Employee detail entity via the Dynamics 365 Human Resources API. The HTTP GET request retrieves employee employment details including dates, status, and classification information. All entity properties are read-only and the endpoint is available starting from version 10.0.39.
```HTTP
GET [Organization URI]/api/data/v9.1/payintv1employmentdetailentity
```
```JSON
{
"mserp_employerquantity": 0,
"mserp_employerunit": 200000000,
"mserp_effective": "2012-09-11T20:30:58Z",
"mserp_expiration": "2154-12-31T23:59:59Z",
"mserp_workernoticeamount": 0,
"mserp_workerstartdate": "2010-02-01T08:00:00Z",
"mserp_workerunitofnotice": 200000000,
"mserp_status": 200000000,
"mserp_employmentstartdate": "2006-02-01T08:00:00Z",
"mserp_employmentenddate": "2154-12-31T23:59:59Z",
"mserp_company": "USMF",
"mserp_personnelnumber": "000001",
"mserp_workertype": 200000000,
"mserp_benifitsemploymenttype": "",
"mserp_employmentcategory": "",
"mserp_reasoncodeid": 0,
"mserp_reasoncodeid_bigint": 0,
"mserp_adjustedworkerstartdate": null,
"mserp_terminationdate": null,
"mserp_lastdateworked": null,
}
```
--------------------------------
### Execute Complete-PreReqs.ps1 PowerShell Script
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/fin-ops-core/dev-itpro/deployment/setup-deploy-on-premises-pu41.md
This command finalizes the VM setup process after prerequisites are installed. It runs the completion script without additional parameters in a standard setup. This step should be executed after all prerequisite installations are finished.
```powershell
# If remoting, execute
# .\Complete-PreReqs-AllVMs.ps1 -ConfigurationFilePath .\ConfigTemplate.xml
.\Complete-PreReqs.ps1
```
--------------------------------
### Configure Commerce Runtime and Hardware Station Extensions (XML)
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/commerce/localizations/dev-itpro/emea-cze-fi-sample-sdk.md
Adds assembly references to the composition section of configuration files to enable fiscal registration service integration. This includes extensions for Commerce Runtime and Hardware Station.
```xml
```
```xml
```
--------------------------------
### Enable extensions and package configuration files
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/commerce/localizations/dev-itpro/emea-swe-fi-sample-sdk.md
Adds required assemblies to CRT and Hardware station configuration, registers ISV files for packaging, and enables the POS extension package. Replace assembly and file placeholders with your actual binaries.
```xml
```
```xml
```
```json
{
"extensionPackages": [
{
"baseUrl": "Microsoft/AuditEvent.SE"
}
]
}
```
--------------------------------
### Convert GUID to string using guid2str
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/fin-ops-core/dev-itpro/dev-ref/xpp-conversion-run-time-functions.md
Illustrates the guid2str function for converting a GUID object into its string representation. It includes an example of creating a GUID from a string and then converting it back.
```xpp
static void guid2StrExample()
{
guid _guid;
str stringGuid;
_guid = Global::guidFromString("{12345678-1234-1234-1234-123456789abc}");
print strfmt("GUID is %1", _guid);
stringGuid = guid2str(_guid);
info("String GUID is " + stringGuid);
}
/**** Output to Infolog
String GUID is {12345678-1234-1234-1234-123456789ABC}
****/
```
--------------------------------
### X++ GUID Functions Examples
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/fin-ops-core/dev-itpro/dev-ref/xpp-data-primitive.md
Demonstrates the usage of GUID functions in X++ for converting GUIDs to strings and back, testing different string formats, and handling optional braces.
```xpp
// An example of how to use the GUID functions.
static void GuidRoundTripJob(Args _args)
{
guid guid2;
str string3;
// Convert a guid to a string, and back to a guid.
guid2 = newGuid();
info(strFmt("Info_a1: guid2 == %1", guid2));
string3 = guid2str(guid2);
info(strFmt("Info_a2: string3 == %1", string3));
guid2 = str2guid(string3);
info(strFmt("Info_a3: guid2 == %1", guid2));
// Test string representations of a guid. Mixing upper and lower case letters does not affect the guid.
guid2 = str2guid("BB345678-abcd-ABCD-0000-bbbbffff9012");
string3 = guid2str(guid2);
info(strFmt("Info_b1: 8-4-4-4-12 format for dashes works (%1)", string3));
info(strFmt("Info_b2: Mixed upper and lower case works."));
// Test invalid dash locations, see output is all zeros. Dash locations must be exact.
guid2 = str2guid("CC2345678abcd-ABCD-0000-cccc9012");
string3 = guid2str(guid2);
info(strFmt("Info_c1: These embedded dash locations are required. %1", string3));
// Braces {} are optional.
guid2 = str2guid("{DD345678-abcd-ABCD-0000-ddddaaaa9012}");
string3 = guid2str(guid2);
info(strFmt("Info_d1: Braces {} are optional (%1)", string3));
}
```
--------------------------------
### Install Sealed CSU using Command Prompt
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/commerce/dev-itpro/retail-store-scale-unit-download-install.md
This command installs the sealed Commerce Scale Unit (CSU) using specified parameters and a configuration file. Ensure you replace placeholder values with your actual environment details. Administrator privileges are required to run this command.
```cmd
CommerceStoreScaleUnitSetup.exe install --port 446 --SSLCertThumbprint "" --RetailServerCertThumbprint "" --AsyncClientCertThumbprint "" --AsyncClientAADClientID "" --RetailServerAADClientID "" --CPOSAADClientID "" --RetailServerAADResourceID "" --Config "c:\temp\StoreSystemSetup.xml" --SkipSChannelCheck --trustSqlservercertificate
```
--------------------------------
### GET /api/data/v9.1/mserp_payintv1hcmjobfunctionentities
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/human-resources/hr-payroll-job-function.md
Example query for the PayIntV1HcmJobFunctionEntity. Returns information about the job function.
```APIDOC
## GET /api/data/v9.1/mserp_payintv1hcmjobfunctionentities
### Description
This endpoint provides an example query for the PayIntV1HcmJobFunctionEntity, returning information about the job function.
### Method
GET
### Endpoint
/api/data/v9.1/mserp_payintv1hcmjobfunctionentities
### Parameters
#### Path Parameters
- _None_
#### Query Parameters
- _None_
#### Request Body
- _None_
### Request Example
\`\`
GET [Organization URI]/api/data/v9.1/mserp_payintv1hcmjobfunctionentities_\`\`
### Response
#### Success Response (200)
- **mserp_description** (String) - Read-only - The description of the job function.
- **mserp_jobfunctionid** (String) - Read-only - The ID of the job function.
- **mserp_regulatoryjobcategory** (Enum) - Read-only - The category of the job.
#### Response Example
\`\`json
{\n "mserp_description": "Officials and Manager",\n "mserp_jobfunctionid": "0100",\n "mserp_regulatoryjobcategory": 200000000,\n}\`\`
```
--------------------------------
### Include CRT and Hardware Station DLLs in Deployable Packages (XML)
Source: https://github.com/microsoftdocs/dynamics-365-unified-operations-public/blob/main/articles/commerce/localizations/dev-itpro/emea-cze-fi-sample-sdk.md
Specifies which DLL files should be included as customizable files in the deployable packages. This ensures that the Commerce Runtime and Hardware Station extensions are part of the deployment.
```xml
```
```xml
```