Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Tuesday, November 15, 2022

Table [ax].[GUPITEMBASEPRICE] does not exist, skip creating CONSTRAINT [ax].[GUPITEMBASEPRICE].[I_-1063074925_1429128816] Creating [DataSyncUsersRole] service upgrade in D365 fo on premise

 Error while upgrading service upgrade in On-premise environment in D365


usually this error occurs while upgrading between version 10.0.28 and 10.0.30.. may be appear in future as well

It's not a proper solution, but this workaround helped me...


usually this error occurs at step 57 or step 60.

1. I did manually create table AX.GUPItemBasePrice table in AXDB

(Needed to create this table because upgrade package had removed the "AX" schema and all tables were with "DBO" schema. upgrade package is looking for table in "AX" schema. Got to know from Error Logs)

USE [AXDB]

GO


/****** Object:  Table [ax].[GUPITEMBASEPRICE]    Script Date: 11/15/2022 12:41:45 AM ******/

SET ANSI_NULLS ON

GO


SET QUOTED_IDENTIFIER ON

GO


CREATE TABLE [ax].[GUPITEMBASEPRICE](

[RECID] [bigint] NOT NULL,

[ACTIVATIONDATE] [date] NOT NULL,

[INVENTDIMID] [nvarchar](20) NOT NULL,

[ITEMID] [nvarchar](100) NOT NULL,

[MARKUP] [numeric](32, 16) NOT NULL,

[MARKUPQTY] [numeric](32, 16) NOT NULL,

[PRICE] [numeric](32, 16) NOT NULL,

[PRICEALLOCATEMARKUP] [int] NOT NULL,

[PRICEQTY] [numeric](32, 16) NOT NULL,

[PRICETYPE] [int] NOT NULL,

[UNITID] [nvarchar](10) NOT NULL,

[FROMDATE] [date] NOT NULL,

[TODATE] [date] NOT NULL,

[CREATEDDATETIME] [datetime] NOT NULL,

[DATAAREAID] [nvarchar](4) NOT NULL,

[ROWVERSION] [timestamp] NOT NULL,

 CONSTRAINT [I_GUPITEMBASEPRICE_RECID] PRIMARY KEY CLUSTERED 

(

[RECID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],

 CONSTRAINT [I_-1063074925_1429128816] UNIQUE NONCLUSTERED 

(

[ITEMID] ASC,

[INVENTDIMID] ASC,

[PRICETYPE] ASC,

[FROMDATE] ASC,

[TODATE] ASC,

[CREATEDDATETIME] ASC,

[DATAAREAID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_ACTIVATIONDATE]  DEFAULT ('1900-01-01') FOR [ACTIVATIONDATE]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_INVENTDIMID]  DEFAULT ('') FOR [INVENTDIMID]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_ITEMID]  DEFAULT ('') FOR [ITEMID]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_MARKUP]  DEFAULT ((0)) FOR [MARKUP]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_MARKUPQTY]  DEFAULT ((0)) FOR [MARKUPQTY]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_PRICE]  DEFAULT ((0)) FOR [PRICE]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_PRICEALLOCATEMARKUP]  DEFAULT ((0)) FOR [PRICEALLOCATEMARKUP]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_PRICEQTY]  DEFAULT ((0)) FOR [PRICEQTY]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_PRICETYPE]  DEFAULT ((0)) FOR [PRICETYPE]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_UNITID]  DEFAULT ('') FOR [UNITID]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_FROMDATE]  DEFAULT ('1900-01-01') FOR [FROMDATE]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_TODATE]  DEFAULT ('1900-01-01') FOR [TODATE]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_CREATEDDATETIME]  DEFAULT (getutcdate()) FOR [CREATEDDATETIME]

GO


ALTER TABLE [ax].[GUPITEMBASEPRICE] ADD  CONSTRAINT [DF_GUPITEMBASEPRICE_DATAAREAID]  DEFAULT ('dat') FOR [DATAAREAID]

GO


2. Removed all Roles from AXDB (Whichever is allowing to delete)

3. Removed all schemas from AXDB (Whichever is allowing to delete)

4. Execute below query in AXDB

DROP VIEW __RETAIL_PENDING_DEPLOYMENT

5. re-execute the step with below command

AXUpdateInstaller.exe execute -runbookid="Dev-runbook14112022" -rerunstep=60

Monday, September 5, 2022

Get on hand inventory in d365fo

 [ExtensionOf(tableStr(ReqPO))]

final class ReqPOTable_Extension

{

    public void insert(ReqPlanData _reqPlanData)

    {

        InventOnhand    inventOnHand, inventOnHandRWH;

        InventDim       inventDim;

        InventDimParm   inventDimParm;

        

        inventDim = InventDim::find(this.CovInventDimId);

        inventDimParm.initFromInventDim(inventDim);

        inventOnHand = InventOnhand::newParameters(this.ItemId, inventDim, inventDimParm);

        this.GKAvailPhysical = inventOnHand.availPhysical();


        inventOnHandRWH = InventOnhand::newItemId(this.ItemId);

        inventOnHandRWH.parmInventLocationId("TEST");


        this.GKAvailPhysicalRWH = inventOnHandRWH.availPhysical();

        //-------------------------------------------------------------------------------

        this.GKModelGroupId = InventModelGroupItem::findByItemIdLegalEntity(this.ItemId).ModelGroupId;

        //-------------------------------------------------------------------------------

        

        //-------------------------------------------------------------------------------


        EcoResProductCategory   EcoResProductCategory;

        EcoResCategory               EcoResCategory,EcoResCategoryNext;

        EcoResCategoryId            parentCategory;

        List                                    li = new List(Types::String);

        ListEnumerator                 enumer;


        select * from EcoResCategory

        join RecId from EcoResProductCategory

            where EcoResCategory.RecId == EcoResProductCategory.Category

            && EcoResProductCategory.Product == InventTable::find(this.itemId).Product;


        parentCategory = EcoResCategory.ParentCategory;


        while (parentCategory)

        {

            li.addStart(EcoResCategory.Name);


            select * from EcoResCategory

            where EcoResCategory.RecId ==  parentCategory

            && EcoResCategory.ParentCategory != 0;  // skip the top node


            parentCategory = EcoResCategory.ParentCategory;

        }


        enumer = li.getEnumerator();

        while (enumer.moveNext())

        {

            this.GKProductcategory = enumer.current();

        }


        next insert();

    }


}

Tuesday, August 23, 2022

Steps to upgrade or apply service update On-Premise environment in D365FO

To install Custom package on-premise environment

AXUpdateInstaller.exe devinstall

--------------------------------------------------------------------------------------------------

To install Service update package


Step 1: Download the service update package from LCS

Step 2: Right click and Unblock the package

Step 3: Extract to some folder like C:/Temp 

Step 4: go-to - C:/Temp/"Serive Update extracted folder"/RetailServer/Scripts

Step 5: search file "DropAllRetailChannelDbObjects.sql" and click edit on notepad, copy all code

Step 6: Open SQL and New query on AXDB -> paste the code and Execute

Step 7: go-to - C:/Temp/"Serive Update extracted folder"/DefaultTopologyData.XML(Open in notepad)

Step 8: search in notepad (LocalHost) and replace with PC name

Step 9: Paste the list of devTools list by executing AXUpdateInstaller.exe list(Inside CMD under same folder). Example below: -  

<Machine>

      <Name>TESTDEV001</Name>

      <ServiceModelList>

        <string>AOSService</string>

        <string>DevToolsService</string>

<string>ALMService</string>

<string>BIService</string>

<string>DIXFService</string>

<string>MROneBox</string>

<string>PayrollTaxModule</string>

<string>PerfSDK</string>

<string>ReportingService</string>

<string>RetailCloudPos</string>

<string>RetailHQConfiguration</string>

<string>RetailSDK</string>

<string>RetailSelfService</string>

<string>RetailServer</string>

<string>RetailStorefront</string>

      </ServiceModelList>

    </Machine>

Step 10: open CMD as admin and navigate to extracted folder. i.e. C:/Temp/"Serive Update extracted folder"

Step 11: Execute below commands: -  

AXUpdateInstaller.exe list

AXUpdateInstaller.exe generate -runbookid="Dev-runbook22082022-1" -topologyfile="DefaultTopologyData.xml" -servicemodelfile="DefaultServiceModelData.xml" -runbookfile="Dev-runbook22082022-1.xml"


AXUpdateInstaller.exe import -runbookfile="Dev-runbook22082022-1.xml"


AXUpdateInstaller.exe execute -runbookid="Dev-runbook22082022-1"

--------------------------------------------------------------------------------------------------

To re-run step: - 

AXUpdateInstaller.exe execute -runbookid="Dev-runbook22082022-1" -rerunstep=60

To mark step has completed: - 

AXUpdateInstaller.exe execute -runbookid="Dev-runbook22082022-1" -setstepcomplete=60

--------------------------------------------------------------------------------------------------

Additional Basic Troubleshooting solutions: - 

Unable to find Dynamics 365 Finance and operations extension: -

Solution - Check for service: - CNG Key Isolation

to install - C:\Temp\FinanceAndOperations_10.0.1265.20_Application\DevToolsService\Scripts

Microsoft.Dynamics.Framework.Tools.Installer.vsix

Any Step failed: - 

solution - Right click on extracted folder - Uncheck Read only option.

Wednesday, July 20, 2022

Enable developer mode of Retail POS in d365 how to check label text id of each button on CPOS in d365

 open cpos on edge

f12

setting

enable javascript source maps true

console

Commerce.Helpers.DeveloperModeHelper.setDeveloperMode(true);


Monday, July 18, 2022

Export Import Model in D365fo

CMD as admin

go to path-

 C:\AOSService\PackagesLocalDirectory\bin


Export - 


ModelUtil.exe -export -metadatastorepath=K:\AosService\PackagesLocalDirectory -modelname=CustomModel -outputpath=C:\Temp


Import-


ModelUtil.exe -import -metadatastorepath=C:\AOSService\PackagesLocalDirectory -file="C:\Temp\Custom Seperate Models\CustomModel.axmodel"


Each model might contains Resources folder which contains DLLs. Need to import seperately.

synchronize DB

Build the model


Thursday, March 17, 2022

Enable/ Disable or Hide/ Show new, edit, delete button on form in D365fo

 This is posts shows that how to enable disable or show hide system defined button on Form


FormCommandButtonControl attachButton; public void init() { #SysSystemDefinedButtons

//(This Macro contains all system defined buttons to be used on forms and you can play with

// and you play with all system defined buttons like command button, grid controls etc. super(); attachButton= this.control(this.controlId(#SystemDefinedAttachButton)) as FormCommandButtonControl; attachButton.visible(false); }


  public void init()
    {
        this.form().design().showNewButton(0);
        this.form().design().showDeleteButton(0);
        super();

    }

[ExtensionOf(FormStr(InventBatch))]
public final class P_InventBatchForm_Extension
{
    void run()
    {
        next run();
        inventBatch_ds.allowCreate(false); // Disable System Defined NEW Button
      }

}

ref: - System-defined buttons - Finance & Operations | Dynamics 365 | Microsoft Docs