Friday, December 21, 2018

Configure your Lifecycle Services project to connect to Azure DevOps

Configure your Lifecycle Services project to connect to Azure DevOps


1.    Navigate to LCS project, go to the Project settings tile, select Visual Studio Team Services à click - Setup Visual Studio Team Services button.
Note: if you have already configured LCS to connect to your Azure DevOps project, you can skip this section.
2.    Enter the root URL for your Azure DevOps account and the access token created earlier, and then click Continue.
3.    Select VSTS service project within your Azure DevOps account that you want to connect to, and click Continue
4.    On the Review and save page, click Save.

Track user sign-ins


Track user sign-ins ---- 
Many organizations are required to maintain an audit trail of users who have used the system
Steps:
1.    Sign in to LCS, and open the project that is associated with the Finance and Operations implementation.
2.    Navigate to the environment, and open the Environment details page.
3.    On the Monitoring tab, select the Environment monitoring link to open the monitoring dashboard.
4.    On the Activity tab, select View raw logs.
5.    In the Query field, select User Login Events. You see a time duration that has a start date that is set to End date - 7 days.
6.    Set the end date, and then select Search. The search results that are returned include all users who signed in to the system during the seven days before the selected end date.
7.    The search results show the AADUserID value and the sign-in start and end times of the user's session. To map the AADUserID value to the user's user name and email address, use the Users page in Finance and Operations (System administration > Users).
8.    To export the records and keep them for a longer period, select Export grid.

Query cookbook

Create new users on development machines


Create new users on development machines

Steps

1.    Download the following script: ProvisionAxDeveloper.ps1, the script is available at https://github.com/Microsoft/Dynamics-AX-Scripts.
2.     Open a Microsoft Windows PowerShell Command Prompt window as an administrator.
3.     Run the ProvisionAxDeveloper.ps1 script. Specify the following parameters:
·         DatabaseServerName – Typically, this is the machine name.
·         Users – Use the following format: <domain or machine name>\user1, … <domain or machine name>\user n
Examples
 
> ProvisionAxDeveloper.ps1 -databaseservername RDXP00DB20RAINM -users RDXP00DB20RAINM\username1,RDXP00DB20RAINM\username2
4.     If more than one user account will be developing on the same version control workspace, you need to make the workspace public.
 .      In Visual Studio, open Source Control Explorer, select the workspace dropdown and select Manage workspaces.
a.     Select the application workspace, click Edit, then click Advanced and set the workspace to Public workspace

Cloud environment that is provisioned through LCS


Cloud environment that is provisioned through LCS

Accessing an instance through a URL

The system can be accessed by end users. The administrator can add users to this system by using the Users page in the instance. Note that these additional users don't have to be users in LCS. You obtain the base URL for the cloud environment from your LCS project site.

Retail SETUP CPOS - Dynamics 365


Retail configuration

For Dynamics 365 for Operations, Version 1611
1.    Run the RetailTenantUpdateTool.
·         The icon for this tool is available on the desktop.
·         This tool is also available at the following location: C:\windowsSystem32WindowsPowerShellv1.0PowerShell.exe -File C:\RetailSDKToolsRetailTenantUpdateTool.ps1
2.    Double-click the icon to start this tool. You will be prompted for your Azure AD credentials. You must use the same credentials that you used in the admin user provisioning tool earlier.

For Dynamics 365 for Operations 7.0
3.    Query Azure AD for your tenant and user ID. Open a Windows PowerShell Integrated Scripting Environment (ISE) window with administrative privileges, and run the following command. You will be prompted for Azure AD credentials. Use the same user account that you used in the admin user provisioning tool earlier.
$msocred = Get-Credential
Connect-MsolService -Credential $msocred
$company = Get-MsolCompanyInformation
Write-Host "TenantID: $($company.ObjectId)"
$msocred.UserName
$users = Get-MsolUser -SearchString "$($msocred.username)"
foreach($u in $users)
{
    if($u.SignInName -eq $msocred.UserName)
    {
       Write-Host "SignInName:$($u.SignInName) UserId: $($u.ObjectId)"
    }
}
4.    Update the following SQL script, and run it in on AXDB for that environment. Supply values for the following parameters from the preceding Windows PowerShell script output:
·         TenantID 
·         UserId 
DECLARE @TenantId NVARCHAR(1024)         DECLARE @UserId NVARCHAR(1024)
SET @TenantId = ‘‘
SET @UserId = ‘‘
IF(LEN(@TenantId) > 0 AND LEN(@UserId) > 0)
    BEGIN
    UPDATE AxDBRAIN.dbo.SYSSERVICECONFIGURATIONSETTING SET [VALUE] = @TenantId WHERE [NAME] = ‘TENANTID’
    UPDATE RetailHoustonStore.ax.SYSSERVICECONFIGURATIONSETTING SET [VALUE] = @TenantId WHERE [NAME] = ‘TENANTID’
    UPDATE AxDBRAIN.dbo.RETAILSTAFFTABLE SET EXTERNALIDENTITYID = @TenantId, EXTERNALIDENTITYSUBID = @UserId WHERE STAFFID = ‘000160’
    END
ELSE
    BEGIN
    RAISERROR (15600, -1, -1, ‘TenantId and UserId must be set before running this script’)
    END
5.    Reset Internet Information Services (IIS) by running IISRESET in an elevated Command Prompt window.
6.    Update the Real-time service profile to use the new admin user.
 .      Click Retail > Headquarters setup > Retail scheduler > Real-time service profiles.
a.    Click Retail > Headquarters setup > Retail scheduler > Real-time service profiles.
b.    Edit the JBB record so that it uses the user that you used earlier (for example, **administrator@contosoax7.onmicrosoft.com**).
c.     Run CDX Job 1070 (Staff) for the default channel database.
d.    Verify that the job succeeded by viewing the Download Sessions page on the client.

Prerequisite setup for CPOS

Steps:
1. Navigate to All worker à Select worker à Retail Tab à External Identity à Create new identity
2. Enter external Identity on Retail Tab of Worker detail form
Ex: Alias – <User Id> , UPN - <email Id>, External Sub Identifier - <Telementry Id>

3.    Navigate RetailàChannel Setup àPOS Setup à Registers à select Register and Click à configuration status (To Setup)

Right Corner à Click Approve All

4.    Navigate RetailàChannel Setup àPOS Setup à Devices

Select à Application type à Retail Cloud POS
Click à Validate device for activation
5.    Retail à Retail IT à Distribution Schedule àSelect Job - P-0001 à Click Run Now (In Order to get all default data for POS)

Activate a Modern POS or Cloud POS device by using guided activation

1.    Open the initial device activation page for Modern POS or Cloud POS. You're prompted to sign in.
2.    On the Before you start page, follow the instructions, and then click Next.

3.    Start Cloud POS or Modern POS.
4.    Use your AAD credentials to sign in. The AAD account must already be mapped. For instructions, see Retail Modern POS self-service and device activation. For Cloud POS, the server URL is automatically entered in the address bar. For Modern POS, you must copy and paste the server URL.

5.    Click Next to populate the list of stores.
6.    Select the correct store in the list.

7.    Select the correct register and device. Note: The device can be PendingDe-activated, or Activated. Alternatively, if you turned on the Retail HQ Allow devices to be associated to registers from store setting, you might see a list of registers that have no device associated with them.

8.    Click Activate. The device should be activated.

 Create a device ID from Modern POS and Cloud POS

We have added features to create a device (that is, automatically generate a device ID) from Modern POS or Cloud POS, so that the device can be associated with a register that doesn't yet have devices mapped to it. This functionality can be used in Modern POS only if you set the HQ settings as follows.
1.     Go to Retail > Headquarters setup > Parameters > Retail shared parametersGeneral.
2.     Under Devices, set Allow register association from device to Yes.
3.     In the Modern POS client, you can now add a device when you select a register that is listed as No associated devices in the guided activation flow.
4.     After you select the register, you can either select a device that doesn't have register mapping or use the Or, Add a Device link.
5.     Click the Or, Add a Device link, and then either enter the new device ID or select automatically create a new device ID for me.
6.     Click Activate to create a new device ID, associate it with the selected register, and complete the activation.

Tuesday, December 11, 2018

“in” operator in Dynamics 365 for finance and operation

//From Platform update PU21

So far, it will supporrt only for ENUM in where clause


SalesTable salesTable;
container salesStatus = [SalesStatus::Canceled, SalesStatus::Delivered, SalesStatus::Invoiced];
 
New Update:
while select salesId from salesTable
    where salesTable.SalesStatus in salesStatus 
{
}

Friday, December 7, 2018

Post Purchase Invoice with Match product receipts through Code in D365 FO

TmpFrmVirtual               tmpFrmVirtualVend;

        PurchFormLetter_Invoice     purchFormLetter;

        VendPackingSlipJour         vendPackingSlipJour;

        SysQueryRun                 chooseLinesQuery;

        SysQueryRun                 chooseLinesPendingInvoiceQuery;

        container                   conTmpFrmVirtual;

        List                        selectedList    = new List(Types::Record);

 

        while select TableId, RecId, PurchId from  vendPackingSlipJour

            where vendPackingSlipJour.PurchId == _purchTable.PurchId

        {

            tmpFrmVirtualVend.clear();

            tmpFrmVirtualVend.TableNum  = vendPackingSlipJour.TableId;

            tmpFrmVirtualVend.RecordNo  = vendPackingSlipJour.RecId;

            tmpFrmVirtualVend.NoYes     = NoYes::Yes;

            tmpFrmVirtualVend.Id        = vendPackingSlipJour.PurchId;

            tmpFrmVirtualVend.insert();

        }

 

        chooseLinesQuery = new SysQueryRun(queryStr(PurchUpdate));

        chooseLinesQuery.query().addDataSource(tableNum(VendInvoiceInfoTable)).enabled(false);

 

        //chooseLinesPendingInvoiceQuery needs to be initialized, although it will not be used

        chooseLinesPendingInvoiceQuery = new SysQueryRun(queryStr(PurchUpdatePendingInvoice));

        chooseLinesPendingInvoiceQuery.query().dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable,PurchId)).value(queryValue(''));

          

        purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);

        purchFormLetter.chooseLinesQuery (chooseLinesQuery);

        purchFormLetter.parmQueryChooseLinesPendingInvoice(chooseLinesPendingInvoiceQuery);

        purchFormLetter.purchTable (_purchTable);

        purchFormLetter.transDate (DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));

        purchFormLetter.parmParmTableNum (invoiceId);

        purchFormLetter.printFormLetter (NoYes::No);

        purchFormLetter.sumBy (AccountOrder::Auto);

        purchFormLetter.specQty (PurchUpdate::All);

        while select tmpFrmVirtualVend

        {

            selectedList.addEnd(tmpFrmVirtualVend);

            conTmpFrmVirtual = selectedList.pack();

        }

        purchFormLetter.selectFromJournal(conTmpFrmVirtual);

        VendInvoiceInfoTable        vendInvoiceInfoTable;

        select forupdate vendInvoiceInfoTable

            where vendInvoiceInfoTable.ParmId == purchFormLetter.parmId()

                    && vendInvoiceInfoTable.PurchId == _purchTable.PurchId;

        if(vendInvoiceInfoTable)

        {

            vendInvoiceInfoTable.DocumentDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());

            vendInvoiceInfoTable.LastMatchVariance = LastMatchVarianceOptions::OK;

            vendInvoiceInfoTable.ParmJobStatus = ParmJobStatus::Waiting;

            vendInvoiceInfoTable.Approved = NoYes::Yes;

            vendInvoiceInfoTable.Approver = HcmWorkerLookup::currentWorker();

            vendInvoiceInfoTable.update();

        }

        purchFormLetter.reArrangeNow(true);

        purchFormLetter.run();

Tuesday, November 27, 2018

Form - Chain Of Command D365 FO PU20


Chain of Command on FORMS

1. Method on DataSource extension
            [ExtensionOf(FormDatasourceStr(<FormName>,<DataSourceName>))]
2. Method on DataSource field extension
            [ExtensionOf(FormDataFieldStr(<FormName>,<DataSourceName>,<DataSourceFieldName>))]
3. Method on Form Control extension
            [ExtensionOf(FormControlStr(<FormName>,<controlName>))]
4. Method on Form extension
            [ExtensionOf(FormMethodStr(<FormName>,<cMethodName>))]


Samples:

FORM on Extension

DataSource Method

FormDataSource fds = this;
<Table buffer> = fds.cursor();

DataSourceField

FormDataSource fds;
FormDataObject fdo = any2Object(this) as FormDataObject;
fds = fdo.Datasource();
<Table buffer> = fds.cursor();

FormControl

FormDataSource fds;
FormButtonControl fbc = this as FormButtonControl;
fds = fbc.formRun().Datasource(tableStr(<Table Name of DS>));
<Table buffer> = fds.cursor();


Sample:
 FormDateTimeControl     dtc1 = any2object(this) as formDateTimeControl;
        FormRun                 fr              = dtc1.formRun() as FormRun;
        FormDateTimeControl     dtc2   = fr.design().controlName(formControlStr(<formname>, <controlname>) as formDateTimeControl;

Skip Inventory reservation on Sales order lines in D365FO

[ExtensionOf(classStr(InventUpd_Reservation))] final class InventUpd_ReservationCls_SAN_Extension {     void updateNow()     {         if(mo...