Saturday, August 10, 2024

How to add a number sequence in a new table in Dynamics 365 for Finance and Operations?

 In this blog , we will create a new number sequence in D365 Finance and Operations form. 

And this blog will contain below steps for the users and user will be able to understand below steps as well:


1. Create a EDT of String Type with Length 20
2. Create a Table
3. Create a List Form
4. Create a new module and attach a new form
5. Create a new class
6. Create a new runnable class , build and check the AR parameters > Number Sequence Form
7. Add the new number sequence code
        8. Go to Form and Click New.

Detailed steps are now below:

Step 1. Create a EDT of String Type with Length 20
         
a. To create a new EDT, Right click on solution and then add > New Item.

Step 2. Create a Table
    

a.  Add the new EDT on Fields and Index and on Field Groups as well. Update the properties as follows.
Step 3. Create a List Form with below pattern and details.
            Data Source = Table in above step
            

Step 4. Create a new module and attach a new form
            a. First create a display menu item.
b. Create a Menu Item Now and link the Display Menu Item now. 

c. Build the project and check the environment now.

    


Step 4. Create a new class with name VehicleIdNumSeq
   
b. Create a new method load Module with below code.

protected void loadModule()
    {
        NumberSeqDatatype datatype = NumberSeqDatatype::construct();
        datatype.parmDatatypeId(extendedTypeNum(AnandBook2_VehicleId));
        datatype.parmReferenceLabel("Anand Vehicle Id");
        datatype.parmReferenceHelp(literalStr("Unique key used for the cars."));
        datatype.parmWizardIsContinuous(false);
        datatype.parmWizardIsManual(NoYes::No);
        datatype.parmWizardFetchAheadQty(10);
        datatype.parmWizardIsChangeDownAllowed(NoYes::No);
        datatype.parmWizardIsChangeUpAllowed(NoYes::No);
        datatype.parmSortField(1);

        datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatype);
    }

c. Create a Subscription and a method as follows:

[SubscribesTo(classstr(NumberSeqGlobal),delegatestr(NumberSeqGlobal,buildModulesMapDelegate))]
    static void buildModulesMapSubsciber(Map numberSeqModuleNamesMap)
    {
        NumberSeqGlobal::addModuleToMap(classnum(VehicleIdNumSeq), numberSeqModuleNamesMap);
    }
d. Create a final method on this class
public NumberSeqModule numberSeqModule()
    {
        return NumberSeqModule::Cust;
    }

Here Cust is for Accounts Receivables Parameters form to know all the codes we can check the designer. If I select Asset , then our Field of Code will be available in Fixed Assets Parameters form.

e. Create a new runnable class and add the code and set it as a startup object.

class LoadVehicleIdNumSeq
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        VehicleIdNumSeq VehicleIdNumSeq = new VehicleIdNumSeq();
        VehicleIdNumSeq.load();
    }
}

f. To add it as Startup Object, right click on the solution and Set as Startup Object. 


17. Build and run the project from VS and check the AR parameters > Number Sequence Form.

18. Add the new number sequence code as shown in screenshot.
19.Go to your custom Form and Click New.

Error Path: [AxTable/AnandBook2_Vehicle/Modules]:Enum 'ModuleAxapta' does not exist.

Have you ever got this error:


 Project Path File Line Suppression State Error Path: [AxTable/AnandBook2_Vehicle/Modules]:Enum 'ModuleAxapta' does not exist. AnandBook2 (USR) [AnandBook2] 




Solution:

This error suggests there is standard models not available in our solution.

To resolve it add the solution with standard models needed.

Step 1. Go to Update model parameters



Step 2. Select your model.


Step 3. Select the standard model.

            Application Foundation, Application Suite, Application Platform.



Step 4. Rebuild solution and check.
    









Friday, August 9, 2024

ERROR :- --------------------------- Microsoft Visual Studio --------------------------- Please correct the metadata files for the following issue(s): Module 'ConProductionIntegration' has invalid reference to module 'ConVehicleManagement' that can cause circular dependencies. This is an indication that model store is in a broken state. Then select the "Refresh models" menu item in the Dynamics 365 | Model management menu to refresh the models. --------------------------- OK ---------------------------

 How to resolve this error?

--------------------------- Microsoft Visual Studio --------------------------- Please correct the metadata files for the following issue(s): Module 'ConProductionIntegration' has invalid reference to module 'ConVehicleManagement' that can cause circular dependencies. This is an indication that model store is in a broken state. Then select the "Refresh models" menu item in the Dynamics 365 | Model management menu to refresh the models. --------------------------- OK ---------------------------



Solution

Before we dive into solutions, let's break down the error message:

  • Circular dependency: This means that module 1 depends on 2 , and vice versa, creating a loop.
  • Model store is in a broken state: This indicates inconsistencies in the data that defines your model.
  • Refresh models: This is a potential solution to rectify the model store.
To resolve it find the Descriptor XML file in Folder and delete the dependent XML tag.



Thanks for reading and if it resolve , please share your comments.

Monday, July 15, 2024

How to solve error "The supplied SnapshotPoint is on an incorrect snapshot"

Getting this error while writing the code in Dynamics 365 Finance and Operations and visual studio getting crashed as shown in screen.


Solution of this error:

Disable word wrap option in Text Editor



Monday, July 1, 2024

GET the corect date and timezone of the client in Dynamics 365 for Finance and Operations

Many a time we get a requirement to fetch exact data and time from a user , in that case we can use system inbuilt function from DateTimeUtility

Below is such a scenario we faced from checking the date must not be lesser than today. This code fit in the best way.


 public boolean validateField(FieldId _fieldIdToCheck)

    {

        boolean ret;

    

        ret = super(_fieldIdToCheck);


        switch(_fieldIdToCheck)

        {

            case fieldNum(ConVMSVehicleTablePhase2, AcquiredDate):

                Timezone clientTimeZone = DateTimeUtil::getClientMachineTimeZone();

                TransDate today = DateTimeUtil::getSystemDate(clientTimeZone);

                if(this.AcquiredDate < today)

                {   

                    ret = checkFailed("@ConVMS:AcqDateMustBeTodayOrLater");

                }

        }

    

        return ret;

    }

Thursday, May 30, 2024

What are standard datatypes and extended data types in D365FO?

 Standard Datatypes

Data TypeDescriptionExampleDeclaration
StringA sequence of characters. X++ supports various string types: left-aligned, right-aligned, fixed length, or non-fixed length. Maximum length is 999 characters."Hello, World!"name str
IntegerA whole number without a decimal point.1090age int
RealA number with a decimal point.3.14pi real
DateStores the day, month, and year.10\29\1978birthday date
UTCDateTimeHolds year, month, day, hour, minute, and second, including time zone information.9/28/2008 07:11:02 amutcmeetingTime utcDateTime
EnumA set of named constants with integer values assigned internally. The first value has the number 0, the second has 1, and so on.Color { Red, Green, Blue }
BooleanCan only be true or false.isRegistered boolean
TimeStores hours, minutes, and seconds. Use the timeOfDay system type for declaration.15:23:08meetingDuration timeOfDay
GUIDA Globally Unique Identifier, a reference number that is unique in any context.{3F2504E0-4F89-11D3-9A0C-0305E82C3301}userId guid
Int64A large integer represented by 64 bits.5637144579populationCount int64            


Extended Data Types

What are models and why do we use it? Elaborate the steps to create, modify delete new model in D365 finance and operations?

 Model management in D365FO


Click to check Model management


How to add a number sequence in a new table in Dynamics 365 for Finance and Operations?

 In this blog , we will create a new number sequence in D365 Finance and Operations form.  And this blog will contain below steps for the us...