Import - Export Model Dynamic AX 2012

 Import - Export Model Dynamic AX 2012


Song Nghia - Technical Consultant

1. Create model

AOT ->Tool->Model management->Create new model
2. Export model to .axmodel file:

Dung window power shell hoac dung Microsoft Dynamics AX pewer shell.
2.1 chuyen den thu muc cai dat cua file config.

EX: C:\Program Files\Microsoft Dynamics AX\60\Server\vtv_vn_dax63_cu12_hrp_staging
Cu phap: cd “C:\Program Files\Microsoft Dynamics
AX\60\Server\vtv_vn_dax63_cu12_hrp_staging”.

2.2 chay chuc nang Export cua Axutil.exe thanh file MyFile.axmodel.
Cu phap: “PS C:\Program Files\Microsoft Dynamics
AX\60\Server\vtv_vn_dax63_cu11_std_demo\bin> axutil.exe export /file:E:\USER.axmodel
/model:"SYP Labels"
(maybe ./axutil.exe)

3. Import model from .axmodel file:

Dung window power shell hoac dung Microsoft Dynamics AX pewer shell.

3.1: chuyen den thu muc cai dat cua file config.
EX: C:\Program Files\Microsoft Dynamics AX\60\Server\vtv_vn_dax63_cu12_hrp_staging
Cu phap: cd “C:\Program Files\Microsoft Dynamics
AX\60\Server\vtv_vn_dax63_cu12_hrp_staging”.

3.2 chay chuc nang Import cua Axutil.exe from file MyFile.axmodel.
Cu phap: “PS C:\Program Files\Microsoft Dynamics
AX\60\Server\vtv_vn_dax63_cu11_std_demo\bin> axutil.exe import /file:E:USER.axmodel /Verbose”

See document: 


Configuring Microsoft Dynamics AX 2012 Alerts and Email

 Configuring Microsoft Dynamics AX 2012 Alerts and Email Notifications
Using an SMTP Email Relay Server with Office 365

Song Nghia - Technical Consultant

With more AX Server machines being run in the cloud on Microsoft Azure we need a simple way to
connect Dynamics AX 2012 to cloud hosted mail servers without the need to run Exchange server in
the same Azure virtual network (vnet) as our Dynamics AX servers. Currently the demo images that
Microsoft provides for download all rely on a dedicated VM (AX2012R2B) running Exchange Server to send email alerts and workflow messages. This is not a practical or a realistic current scenario with
Dynamics AX servers running on Microsoft Azure. The Life Cycle Services demo image that gets
generated does not even include a mail server image to distribute notification emails. Today with
more clients running with Office 365 we need a way to connect our hosted AX servers to a cloud
hosted email service.
The challenge is that most cloud based email services running today require SSL or TLS secure
encryption for authentication and unfortunately Dynamics AX 2012 does not support this additional
authentication natively. There are a number of ways to customize Dynamics AX to support this
additional secure authentication but it is much easier to use a Windows Server Simple Mail Transfer
Protocol (SMTP) server as a relay. There are no additional costs to run an SMTP server as this is a
feature included in Windows Server. This article will walk through the steps to configure the
Windows Server 2012 R2 SMTP Feature to act as a relay to Office 365 as well as how to configure
Dynamics AX mail settings to support this scenario.
First consider where to install the SMTP service in your production environment. If you are using
Workflow extensively you will have at least one dedicated workflow batch server. Depending on the
volume of messages consider placing the SMTP service on this dedicated workflow batch server.
Avoid installing the SMTP service on the production database server as a best practice. However for
demo systems it works fine to include the SMTP service on the all in one server machine. For this
article we will configure the SMTP service on a Dynamics AX2012 R3-CU8 demo image generated
from Life Cycle Services.
This article only covers email alert and workflow messages. Microsoft also now has integration with
Exchange Server either on premise or on Office 365 for the Sales and Marketing module for
Account/Contacts, tasks and calendar. This integration is available but not in the scope of this article.
One more note about flooding SMTP messages from your server to the mail provider. You want to
avoid any extremely large volumes of relay messages so you don’t get blacklisted. Just keep this in
mind to avoid this situation.
We will cover the following topics throughout this article:
 Installing the SMTP Server
 Configuring the SMTP Server
o Testing SMTP Relay Messages
o Troubleshooting SMTP eMail Sending
 Configuring Dynamics AX to use Windows SMTP Server
 Configuring Alert eMail Messages
 Testing Alert eMail Messages
 Using Gmail as an SMTP Mail Server

Full document:




SrsReportRunPrinter Sent email with template

 SrsReportRunPrinter Sent email with template

Nghia Song - Technical Consultant

/// 
/// extesion of SrsReportRunPrinter
/// 
[ExtensionOf(classStr(SrsReportRunPrinter))]
final class LAW_SrsReportRunPrinter_C_Extension
{
    public SrsReportDataContract  dataContract;
    public PurchPurchaseOrderContract   purchPOContract; 
      

    public str buildEmalBody(PurchId _purchID)
    {
        PurchTable      purchTable = PurchTable::find(_purchID);
        PurchTotals     purchTotals;
        str             emailHeader,emailBody;

        purchTotals     = PurchTotals::newPurchTable(purchTable);
        purchTotals.calc();
        real            totalAmount = purchTotals.purchTotalAmount();
        emailHeader = strFmt('

Dear %1,

',purchTable.vendorName()); emailHeader += '

Good Day.

 

Please see attached P.O. for items to be delivered based on the Shipment date.

'; emailBody += strFmt('',_purchID, totalAmount,purchTable.DeliveryDate,InventLocation::find(purchTable.InventLocationId).Name); return emailHeader + emailBody; } /// /// extens to update Purchase Id incase of docoment called from PurchPurchaseOrderContract rdp /// public void printReport() { RecId recordId; SysIMailerNonInteractive mailerFail; PurchId purchId; Object objRdp = this.reportContract.parmRdpContract(); str emailBody; if (objRdp is PurchPurchaseOrderContract) { purchPOContract = objRdp; recordId = purchPOContract.parmRecordId(); purchId = VendPurchOrderJour::findRecId(recordId).PurchId; emailBody = this.buildEmalBody(purchId); printSettings.parmEMailBody(emailBody); } next printReport(); if (mailer && mailer.emailId) { if (recordId && purchId) { SysOutgoingEmailTable outEmail = SysOutgoingEmailTable::find(mailer.emailId,true); if (outEmail) { outEmail.LawPurchId = purchId; ttsbegin; outEmail.update(); ttscommit; } if (outEmail.Status == SysEmailStatus::Failed) { str toAddress = SrsReportRunMailer::lawBuildUserEmailAddress(PurchTable::find(purchId).CreatedBy); str fromAddress = outEmail.Sender; str mess = strFmt("@LAW:LAW_G02010107_01",purchId); mailerFail = SysMailerFactory::getNonInteractiveMailer(); //send fail email back to sender var messageBuilder = new SysMailerMessageBuilder(); messageBuilder.setFrom(fromAddress) .addTo(toAddress) .addCc("") .setSubject(mess) .setBody(""); boolean result = mailerFail.sendNonInteractive(messageBuilder.getMessage()); //end } } } } }
Store name/WH nameP.O.#P.O. AmountShipment/Delivery Date:
%4%1%2%3
Data elements that aren't copied during refresh

 Data elements that aren't copied during refresh

Song Nghia - Technical Consultant

When refreshing a production environment to a sandbox environment, or a sandbox environment to another sandbox environment, there are certain elements of the database that are not copied over to the target environment. These elements include:

  • Email addresses in the LogisticsElectronicAddress table.
  • Batch job history in the BatchJobHistory, BatchHistory, and BatchConstraintHistory tables.
  • SMTP Relay server in the SysEmailParameters table.
  • Print Management settings in the PrintMgmtSettings and PrintMgmtDocInstance tables.
  • Environment-specific records in the SysServerConfig, SysServerSessions, SysCorpNetPrinters, SysClientSessions, BatchServerConfig, and BatchServerGroup tables.
  • Document attachments in the DocuValue table. These attachments include any Microsoft Office templates that were overwritten in the source environment.
  • All users except the admin will be set to Disabled status.
  • All batch jobs are set to Withhold status.
  • All users will have their partition value reset to the "initial" partition record ID.
  • All Microsoft-encrypted fields will be cleared, because they can't be decrypted on a different database server. An example is the Password field in the SysEmailSMTPPassword table.
link: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/database/database-refresh

Power shell deploy all SSRS report d365 FO

 Power shell deploy all SSRS report d365 FO

Nghia Song - Technical Consultant


Follow steps:

1) Open run prompt and type services.msc

2) Make sure IIS , Batch , DIXF , SSRS  , MR services are running.

3) Open Windows Powershell as Administrator

4) Type the below command :-

         K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation “K:\AosService\PackagesLocalDirectory”

To Deploy specific reports type the below command :-

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -Module ApplicationSuite -ReportName AssetDep*,TaxVatRegister.Report -PackageInstallLocation “K:\AosService\PackagesLocalDirectory”




Events from the MPOS D365 Retail/ AX 2012 R3 can be found in Event Viewer here:

Events from the MPOS D365 Retail/ AX 2012 R3 can be found in Event Viewer



Song Nghia - Technical Consultant


This post is based on a conversation in Dynamics AX Community 

1. Events from the MPOS in AX 2012 R3 can be found in Event Viewer here:

    Application and Services Logs -> Microsoft -> Windows -> AppHost -> AppTracing.

activate the event log using Event Viewer.

Navigate to Application and Services Logs -> Microsoft -> Windows -> AppHost.
Right click AppHost and Select View -> Show Analytic and Debug Logs

2. Events from the MPOS in AX 7 / Dynamics 365 for Operations can be found in Event Viewer here:

Event Viewer:
    Applications and Services Logs->Microsoft->Dynamics->Commerce-ModernPos.- Admin, Debug, Operational (where Operational would contain errors and Debug is by default disabled but can be Enabled if needed.)

Please visit the source of this post at this link

https://community.dynamics.com/ax/f/33/p/191059/490711#490711


Sample create entity POS d365 typescript

 Sample create entity POS d365 typescript 
Song Nghia - Technical Consultant



export interface ISelectDate {
    Month: Months;
    Date: number;
    Year: number;
    ToMonth: Months;
    ToDate: number;
    ToYear: number;
}

export interface IAvailableMonth {
    month: Months;
    displayText: string;
}

export enum Months {
    January = 1,
    February = 2,
    March = 3,
    April = 4,
    May = 5,
    June = 6,
    July = 7,
    August = 8,
    September = 9,
    October = 10,
    November = 11,
    December = 12
}

PrePrintReceiptCopyTrigger POS 365

 PrePrintReceiptCopyTrigger POS 365



Song Nghia - Technical Consultant


import * as Triggers from "PosApi/Extend/Triggers/PrintingTriggers";
import { ClientEntities, ProxyEntities } from "PosApi/Entities";
import { ObjectExtensions } from "PosApi/TypeExtensions";
//import ReprintReceiptCache from "../ViewExtensions/ShowJournal/ReprintReceiptCache";
//import { Entities, XZReportDocument } from "../DataService/DataServiceRequests.g";
import { GetHardwareProfileClientRequest, GetHardwareProfileClientResponse } from "PosApi/Consume/Device";
import { GetReceiptsClientRequest, GetReceiptsClientResponse } from "PosApi/Consume/SalesOrders";
import { PrinterPrintRequest, PrinterPrintResponse } from "PosApi/Consume/Peripherals";

export default class PrePrintReceiptCopyTrigger extends Triggers.PrePrintReceiptCopyTrigger {

    public execute(options: Triggers.IPrePrintReceiptCopyTriggerOptions): Promise {

        if (ObjectExtensions.isNullOrUndefined(options)) {

            // This will never happen, but is included to demonstrate how to return a rejected promise when validation fails.
            //ABC
            let error: ClientEntities.ExtensionError
                = new ClientEntities.ExtensionError("The options provided to the PrePrintReceiptCopyTrigger were invalid.");
            return Promise.reject(error);
        } else {
            return this.context.runtime.executeAsync(new GetHardwareProfileClientRequest())
                .then((response: ClientEntities.ICancelableDataResult)
                    : Promise> => {
                    let hardwareProfile: ProxyEntities.HardwareProfile = response.data.result;
                    // Gets the receipts.
                    let salesOrderId: string = options.salesOrder.Id;
                    let receiptRetrievalCriteria: ProxyEntities.ReceiptRetrievalCriteria = {
                        IsCopy: false,
                        IsRemoteTransaction: false,
                        IsPreview: false,
                        QueryBySalesId: true,
                        ReceiptTypeValue: ProxyEntities.ReceiptType.CustomReceipt6,
                        HardwareProfileId: hardwareProfile.ProfileId
                    };
                    let getReceiptsClientRequest: GetReceiptsClientRequest =
                        new GetReceiptsClientRequest(salesOrderId, receiptRetrievalCriteria);
                    return this.context.runtime.executeAsync(getReceiptsClientRequest);
                })
                .then((response: ClientEntities.ICancelableDataResult)
                    : Promise> => {
                    let receipts: ProxyEntities.Receipt[] = response.data.result;
                    // Prints the receipts.
                    let printerPrintRequest: PrinterPrintRequest = new PrinterPrintRequest(receipts);
                    return this.context.runtime.executeAsync(printerPrintRequest);
                })
        }
}
 Get formRun, Form control, datasource and selected record from form datasource using Eventhandlers on Form in D365

 Get formRun, Form control, datasource and selected record from form datasource using Eventhandlers on Form in D365




Song Nghia - Technical Consultant

Thanks for: http://daxingwitheshant.blogspot.com/2018/11/get-formrun-form-control-datasource-and.html

Get formRun, Form control, datasource and selected record from form datasource :


[FormDataSourceEventHandler(formDataSourceStr(MyForm, MyRandomTableDS), FormDataSourceEventType::Written)] public static void MyRandomTableDS_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)

{


FormRun formRun = sender.formRun() as FormRun;


// you can even call custom methods

formRun.myCustomMethod();


// Get the selected datasource record

TableName tableBuffer = sender.cursor();


// Get datasource variable

FormDataSource DSVariable = sender.formRun().dataSource(“TableName”);

}


Get form datasource from xFormRun

[FormEventHandler(formStr(SomeForm), FormEventType::Initialized)] public static void SomeForm_OnInitialized(xFormRun sender, FormEventArgs e)

{

FormDataSource MyRandomTable_ds = sender.dataSource(formDataSourceStr(SomeForm, MyRandomTableDS));

}


Access form control from xFormRun

[FormEventHandler(formStr(SomeForm), FormEventType::Initialized)] public static void SomeForm_OnInitialized(xFormRun sender, FormEventArgs e)

{

// set the control to invisible as an example

sender.design().controlName(formControlStr(SomeForm, MyControl)).visible(false);

}


Get FormRun from form control

[FormControlEventHandler(formControlStr(MyForm, MyButton), FormControlEventType::Clicked)] public static void MyButton_OnClicked(FormControl sender, FormControlEventArgs e)

{

FormRun formRun = sender.formRun() as FormRun;

formRun.myCustomMethod();

}


Get current record in form control event

[FormControlEventHandler(formControlStr(SomeForm, SomeButton), FormControlEventType::Clicked)] public static void SomeButton_OnClicked(FormControl sender, FormControlEventArgs e)

{

// as an example the datasource number is used for access; I perceive the formDataSourceStr as more robust

SomeTable callerRec = sender.formRun().dataSource(1).cursor();

}

Sample COC next method in form

 Sample COC next method in form



Song Nghia - Technical Consultant

[ExtensionOf(formstr(AssetTransfer))]
final class LAW_AssetTransferForm_Extension
{
    void init()
    {
        next init();
        LAW_TransferLocationTmp tmp;
        delete_from tmp
            where tmp.CreatedBy == curUserId();
        AssetTable assetTable = this.args().record();

        tmp.clear();
        tmp.AssetId = assetTable.AssetId;
        tmp.fromLocation = assetTable.Location;
        tmp.insert();
    }

    public void closeOk()
    {
        LAW_TransferLocationTmp tmp;
        select tmp
            where tmp.CreatedBy == curUserId();
        if(tmp.ToLocation == '')
        {
            throw Error('Field To location must be filled in.');
        }
        next closeOk();
       
        //delete_from tmp
        //    where tmp.CreatedBy == curUserId();
        FormRun fr = this.args().caller();
        fr.dataSource().research(true);
    }

}
How to get multi data from argument

How to  get multi data from argument

        

Song Nghia - Technical Consultant
    private void checkAssetBooksStatus()
    {
        // Copy the main datasource query
        Query query = new Query(assetBook_ds.query());
        QueryBuildDataSource qbdsAssetBook = query.dataSourceTable(tableNum(AssetBook));

        // Finding all value models NOT in Open status to provide infolog warnings.
        QueryBuildRange statusRange = xSysQuery::findOrCreateRange(qbdsAssetBook, fieldNum(AssetBook, Status));
        statusRange.value(strfmt("%1,%2", SysQuery::valueNot(AssetStatus::Open), SysQuery::valueNot(AssetStatus::Closed)));

        QueryRun queryRun  = new QueryRun(query);

        // Check if any of the selected valuemodels are Not in open status.
        // Show infolog warning for all such selected value models.
        if (SysQuery::countLoops(queryRun) > 0)
        {
            warning("@FixedAssets:FA_MessageNotification_BooksCannotBeTransferedBecauseStatusIsWrong");

            while (queryRun.next())
            {
                AssetBook localAssetBook = queryRun.get(tableNum(AssetBook));
                
                warning(strFmt("@FixedAssets:FA_MessageNotification_AssetAndBookInformation", localAssetBook.AssetId, localAssetBook.BookId));
                
            }
        }

        statusRange = xSysQuery::findOrCreateRange(qbdsAssetBook, fieldNum(AssetBook, Status));
        statusRange.value(strfmt("%1,%2", SysQuery::value(AssetStatus::Open), SysQuery::value(AssetStatus::Closed)));

        //Close the form if no value models are selected that are in the Open or Closed status.
        if (SysQuery::countLoops(new QueryRun(query)) <= 0)
        {
            this.closeCancel();
        }
    }
Manual sync database in code x++

 Manual sync database in code x++

Song Nghia - Technical Consultant

Challenge/Problem: Synchronise Dynamics AX database from X++

Description: Previously I have written code to manipulate AX AOT objects via code (reflection) and found the need to kick off a database sync automatically from X++ code. I found the code snippets below to be useful for this operation.

The following two options allow you to perform the db syncronisation.

1. To synchronize a specific table: appl.dbSynchronize([tableid]);
2. To synchronize the whole app: appl.dbSynchronize(0);


HOW TO APPLY PACKAGE RETAIL D365 TO TIER 2

 HOW TO APPLY PACKAGE RETAIL D365 TO TIER 2


SONG NGHIA - TECHNICAL CONSULTANT

STEP 0. Build package 


STEP 1. Microsoft limit package small than 300mb  so delete source setup before upload to lcs



STEP 2. Login to LCS and choose  => asset libary  => software deployalbe package
STEP 3. Upload package to asset and waiting validate package



STEP 4. Choose upload package to apply 

In Tab Enviroment Features => Manage

Then waiting package applied.



End.



HOW TO APPLY CHANGE DATABASE IN RSSU

 HOW TO APPLY CHANGE DATABASE IN RSSU

                                                                            

SONG NGHIA - TECHNICAL CONSULTANT


STEP 1. DROP OLD TABLE IN RSSU AND OFFLINE DATABASE 
STEP 2. CREATE NEW TABLE INCLUDE NEW FIELDS,  RSSU AND OFFLINE DATABASE 
STEP 3. RESTART ASYNC CLIENT

FINAL RUN JOB


D365 FO error: Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server
Run Job execute error: "Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server"


Nghia Song - Technical Consultant

Error:

Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server —> System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.

Solution:
  1. On OneBox VM, run command prompt as administrator.
  2. Navigate to “C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\”
  3. Run “AzureStorageEmulator.exe Init”
  4. Run “AzureStorageEmulator.exe start”
Thanks for reading.
Nghia Song 
Split string by word and break line by max length
Split string by word and break line by max length

Nghia Song - Technical Consultant
   public container MergeSplitWordsToLines(container  inputStrings, int maxLength)
    {
        str currentLine = "";
        str separator = " ";
        container breakLines = conNull();
        str strL;
        int i = 1;

        for(i = 1; i <= conLen(inputStrings); i++)
        {
            strL = conPeek(inputStrings, i);
            if (strLen(currentLine) == 0)
            {
                currentLine =  strL;
            }
            else if (strLen(currentLine) + strLen(separator) + strLen(strL) > maxLength)
            {
                breakLines += currentLine;
                currentLine = strL;
            }
            else
            {
                currentLine += separator + strL;
            }
        }

        if (strLen(currentLine))
        {
            return breakLines;
        }
        return breakLines;
    }

    public container SplitStringByWords(str inputString, int maxLength)
    {
        container splitWords = conNull();
        container splitLines = conNull();

        splitWords = str2con(inputString, " ");

        if (conLen(splitWords))
        {
            splitLines = this.MergeSplitWordsToLines(splitWords, maxLength);
        }

        return splitLines;

    }

How to build customize MPOS and release

How to build customize MPOS and release


Song Nghia - Technical Consultant


Step 1. 
Developer command:
1.       Cd "K:\RetailSDK"
2.       K:
3.       msbuild.exe /t:rebuild


Step 2.
Download MPOS Setup after rebuild. 
Download to MPOS machine

Step 3.
Search file pfx : *.pfx
Download file pfx to MPOS machine

Step 4.
MPOS machine will have 2 file

Step 5. 
Double click to pfx file
Select Local Machine
Next

Step 6. 
Next

Step 7.
Next

Step 8.
Click Browse
Select Trusted Root Certificate
OK
Next
Step 9.
Install MPOS
Done



Check list merge code retail
CHECK LIST MERGE CODE RETAIL        
Song Nghia - Technical Consultant

Thanks Phuoc Dinh - Technical Consultant for document

1.     CRT
a.       Request
b.       Response
c.       Service
d.       Entity
Example:

2.     Retail Server

a.       EdmModelExtender.cs
b.       CustomizedEdmModelFactory.cs
c.       Controller class

Example:
3.     Retail Proxy
a.       Manager class

Example:

4.     POS
a.       Dataservice
                                       i.            DataServiceEntities.g
                                     ii.            DataServiceRequests.g
b.       Entities (if have)
c.       Handler (if have)
d.       Operations (if have)
e.       RequestHandlers (if have)
f.        TriggerHandlers  (if have)
g.       Resources (if have)
h.       ViewExtensions (if have)

Example



5.       SQL scripts 


6.       After build CRT & Retail Server copy and pasted dll into 2 folder in RetailServer as below:

a.       K:\RetailServer\WebRoot\bin

b.       K:\RetailServer\WebRoot\bin\Ext

7.       Setup CRT DLL into CommerRuntime.Ext.config


8.       Setup CRT & RetailServer DLL into web.config


9.       After build Retail package update DLL into web.config





Get log screen D365 FO
Get log screen D365 FO
Song Nghia - Technical Consultant


private str getLogScreen()
    {
        SysInfologEnumerator    sysInfologEnumerator;
        SysInfologMessageStruct infoMessageStruct;
        ErrorMsg                logMessage;
        str                     logString;
        int                     i;
        #Define.NewLine('\n')
    
        sysInfologEnumerator = SysInfologEnumerator::newData(infolog.infologData());
    
        while (sysInfologEnumerator.moveNext())
        {
            i = 1;
            infoMessageStruct = SysInfologMessageStruct::construct(sysInfologEnumerator.currentMessage());
            while (i <= infoMessageStruct.prefixDepth())
            {
                logString = logString + infoMessageStruct.preFixTextElement(i) + '. ';
                i++;
            }
            logString = logString + " " + infoMessageStruct.message();
        }
        infolog.clear();
        return logString;
    }
Get Customer Account Intercompany
Get Customer Account Intercompany
Song Nghia - Technical Consultant



private CustAccount getCustAccountInterCompany(RetailStoreTable retailStoreTable)
    {
        CustAccount  custAccount;
        InterCompanyTradingPartner interCompanyTradingPartner;
        RecId tradingPartnerVendRecId, tradingPartnerCustRecId;
        CustTable  custTbl;
        changecompany(retailStoreTable.inventLocationDataAreaId)
        {
            VendTable vendTable =  VendTable::find(retailStoreTable.LAW_DefaultVendor);
            RecId partyId = vendTable.Party;
            tradingPartnerVendRecId = InterCompanyTradingPartner::findVendor(partyId,retailStoreTable.inventLocationDataAreaId).RecId;
        }

        select interCompanyTradingPartner
            where interCompanyTradingPartner.RecId == tradingPartnerVendRecId;

        tradingPartnerCustRecId = InterCompanyTradingRelation::getRelatedTradingPartner(interCompanyTradingPartner).RecId;

        custAccount= InterCompanyTradingRelation::getRelatedTradingPartner(interCompanyTradingPartner).custTable().AccountNum;
        
        return custAccount;
    }

Provision retail component in onebox VM

Provision retail component in onebox VM

Song Nghia - Technical Consultant

Update dbo.USERINFO set Enable = '1' 

Update dbo.RetailTransactionServiceProfile set AzureResource = 'https://usnconeboxax1aos.cloud.onebox.dynamics.com' 

Update dbo.RetailTransactionServiceProfile set ServiceHostUrl = 'https://usnconeboxax1aossoap.cloud.onebox.dynamics.com' 
 
 
Update dbo.RETAILCONNDATABASEPROFILE set ConnectionString = 'AQAAAHNm4l3JT6ikAPoAN//zuzANlILUc2biXclPqKQA+gA3//O7MA2UgtRPAwRDTnplG8+rzS9omxRxmMRG72nKnkzG8RyAzutFnbPmItYRZ3TJ+phMNjDIYIXzV/b/g0sZSExFdZgzDKWya6vZimKx8YCmMCdtl3b8h6VCVnFrRe1f62OKx6kf5DGG9g3JFWv/jfsJRldrgzZv0Wx/+a328WTxKHR/wgNtwTVyzWcc+krMwxLbAnSAtKBYQLD3ewn+MX76SONOmFjp/+sh9Ml5ZcLNHgOQen824hy261hutcBt5XwPYHoUVGw5dVMdurtX9Zp7mrKn0+Ep0W8UuDTbSkaNbm0UaNOVLLMVEIxgy8tIQinx0pz54n12zd0YPo/7NfQUY2Ud2OMNF7kpGZkDSVjUHEsYJRNkHn5g13VSdwxjJOfyy8Ad1y0Czxz4esCGLQWIgboPAXu5KNPYnfnILYVwmZZGLFy3o0TL75zvb6bAREpgSJi38Syjl1pspQm+8Vocs/vNnHpA8eM/f/o63Lx/KIzzwfFi40rVGEPyqgsnvCyMlqXxhnWoeuPEVVscuhEfcE7BCi/Sui2qaExzvNegUHb+G4kEbmBD8EjdHQl7w1a97tYiA+8ZEqsnaUIyrziSwWIUDQsUf7gAwT4bOdke7i8XrK38YRrVrq04U9JZYcvum4DOyEJ6sX7DzSzxUYYS5KBky61n064pO9HJu3idG1ym6Vgi1o/HepDb0TzIjTxJGYHclNVcZz5ttbQCeOOkTW+vnQr6maKzqK44cDdbUgs4Ik2vKagtDo7YToaWv/IcYVI/qSXpbCKLWjd5jsocMgP1+c/AJBouemSOyrvZfKvfoRWk56XAV1ELj0xBxedITv+5P/qWMh0iKeBDTJx1mtBYCaojQ+UPig9vFBUyQB3sE6e6pNGEeuIcv6avPCxnn2SK879vRCwsH6yRSnNpIqaxTQDe6JSKloAEgrZLgYlCOsINlHQi8wkf93BwxWLIXTWYqAmG0Mm1/y04Ydw+0sq+jeUQ' 
 
where Name = 'Default' 
 
 
Update dbo.RETAILCHANNELPROFILEPROPERTY set Value = 'https://usnconeboxax1ret.cloud.onebox.dynamics.com/Commerce' 
 
where ChannelProfile = '5637144576' and key_ = '1'  
 
 
Update dbo.RETAILCHANNELPROFILEPROPERTY set Value = 'https://usnconeboxax1pos.cloud.onebox.dynamics.com' 
 
where ChannelProfile = '5637144576' and key_ = '7' 
 

Update dbo.RETAILCHANNELPROFILEPROPERTY set Value = 'https://usnconeboxax1ret.cloud.onebox.dynamics.com/MediaServer/' 
 
where ChannelProfile = '5637144576' and key_ = '2' 
 
 
EXEC sp_addrolemember 'DataSyncUsersRole','axretaildatasyncuser'; 
 
EXEC sp_addrolemember 'db_owner','axretaildatasyncuser'; 
 
delete crt.DOWNLOADSESSIONDATAFILEHISTORY 
 
delete  ax.retailassortmentlookup