Form Look Up



Form Look Up

Today, we Learn how to create Form Look Up
Step: 1
Create a Project and Add two forms.




Step :2
  • Add HCMWORKER table in SL_LookUp_Form Data Source.
  • Add Grid and Drag and Drop the two fields on the grid
Step :3
Set Personnel Number field Property : set as Auto Declaration to YES


Step :4
Now Compile the complete project then run the form.




Step :5
Now right click on Design node(not Designs) and set style property to LookUp.



Compile and Run again Form will look like the below image.



Step :6
Now override the init method of SL_Lookup_Form .



copy paste the below code.



Step:7
Now Select SL_First_Form
Create a Method with name of CustomLookup and copy paste the below code.




Step: 8
  • Add StringEdit Control in the Design.
  • After adding the StringEdit Control override the lookup method.
  • Copy paste the below code.


Step :9
Compile project and run SL_First_Form




Please feel free to contact me if you are facing any issue during implementation of this blog.










Support Faryal's Cusine


How to find or create default Dimension from X++ in AX 2012


How to find or create default Dimension from X++ in AX 2012


Following is the code you can use to find or create dimension in AX 2012


static DimensionDefault generateDefaultDimension(container _attr, container _value, boolean _createIfNotFound = true)
    {
        DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
        DimensionDefault result;
        int i;
        DimensionAttribute dimensionAttribute;
        DimensionAttributeValue dimensionAttributeValue;
        //_attr is dimension name in table DimensionAttribute
        container conAttr = _attr;
        container conValue = _value;
        str dimValue;

        for (i = 1; i <= conLen(conAttr); i++)
        {
            dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));

            if (dimensionAttribute.RecId == 0)
            {
                continue;
            }

            dimValue = conPeek(conValue,i);

            if (dimValue != "")
            {
                // _createIfNotFound is "true". A dimensionAttributeValue record will be created if not found.
                dimensionAttributeValue=
                dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,_createIfNotFound);

                // Add the dimensionAttibuteValue to the default dimension
                valueSetStorage.addItem(dimensionAttributeValue);
            }
        }
        result = valueSetStorage.save();
        return result;
    }

Support Faryal's Cusine


Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...