Thursday, September 18, 2025

change lookup for documenttype in file upload from leave request

 Scenario:- Today in this blog we see how to alter lookup of document type based on document type in leave request form as shown in image below


 >>To get lookup of all document types write this logic

[ExtensionOf(classstr(DocuUpload))]
internal final class docucoc_Extension
{
    public DocuManagementOptions parmDocuMgmtOptions(DocuManagementOptions _value )
    {
        DocuManagementOptions docuMgmtOptions = next parmDocuMgmtOptions(_value);
        int num=this.currentTableId();
        if(tableId2Name(num)=="LeaveRequest")
        {this.setupDocuTypescoc();}
        return docuMgmtOptions;
    }

 

    public  void setupDocuTypescoc()
    {
        List            docuTypeList;
        ListIterator    docuTypeListIterator;
        ComboBoxItem    comboxBoxItem;

 

        // Get the list of document types for the primary table
        docuTypeList = DocuUpload::getDocuTypeListcoc();

 

        // Set the list of document types
        this.documentTypes(docuTypeList);

 

        // Initialize the iterator for the list of document types
        docuTypeListIterator = new ListIterator(docuTypeList);

 

        // If the iterator has at least one item, set the selected document type to the first element;
        // otherwise set the selected document to an empty string
        if (docuTypeListIterator.more())
        {
            comboxBoxItem = docuTypeListIterator.value();
            this.selectedDocumentType(comboxBoxItem.parmValue());
        }
        else
        {
            this.selectedDocumentType('');
        }
    }

 

    private static List getDocuTypeListcoc()
    {
        DocuType        docType;
        List            docuTypeList = new List(Types::Class);
        UserInfo        userInfo;

 

        // Get the current language
        select language from userInfo
            where UserInfo.id == curUserId();

 

        // Add all document types that aren't a document library
        while select @TypeId,ActionClassId from docType
            //index TypeIdx
            //where docType.ActionClassId == classNum(DocuActionArchive)
        {
            // If the document type isn't valid, just continue to the next element instead of adding it
            if (DocuEvent::doCheckSkipDocuType(docType))
            {
                continue;
            }

 

            docuTypeList.addEnd(new ComboBoxItem(docType.TypeId, docType.TypeId));
        }

 

        return docuTypeList;
    }

 

}

 

 





Wednesday, September 3, 2025

Filtering records in grid in datasource init method

 This article is about filtering records in grid

>> Generally if it comes to  Filtering records we go for execute query but sometime we see this not that appropriate working so  we go for formdatasource init


code:-

[ExtensionOf(FormDataSourcestr(PurchReqCopyRFQ,PurchReqLine))]
internal final class PurchReqCopyRFQ_Extension
{
    public void init()
    {
        next init();
        QueryBuildRange qbrBuyingLegalEntity;

        FormDataSource          purchReqLine_ds;

       purchReqLine_ds =this as FormDataSource;
       purchReqLine_ds.query().dataSourceTable(tableNum(PurchReqLine)).clearRanges();

        qbrBuyingLegalEntity = this.query().dataSourceTable(tableNum(PurchReqLine)).addRange(fieldNum(PurchReqLine, BuyingLegalEntity));

        qbrBuyingLegalEntity.value(queryValue(CompanyInfo::findDataArea(curExt()).RecId));
        qbrBuyingLegalEntity.status(RangeStatus::Locked);
    }

 

}

Tuesday, September 2, 2025

To get County region shot name based on legal entity

 LogisticsAddressCountryRegionTranslation::find(LogisticsAddressCountryRegion::findByISOCode(SysCountryRegionCode::countryInfo(curext())).CountryRegionId).ShortName

Thursday, August 21, 2025

Export and import data through data entity globally meaning with all legal entities

 scenario:- Today in this blog we learn about how to Export and import data through data entity globally meaning with all legal entities 

>> Generally when we create a data project either Export or Import the data project will appear in all legal entities but when we do export or import it will give only data from which legal entity you are doing the process but if you want data to be imported or exported from all legal entities then you need customization

>>Customization at two levels 

1) One drag DataAreaId field from Any datasource in dataentity to fields in Dataentity 

2) Open Data entity properties and change Primary context field to empty , Default is DataAreaID as shown in image below


3) After that do Regenerate and Update staging if the data entity is Customized if it is standard then build is enough followed by Modelbuild and sync 

Thats all Start Importing and Exporting You will see changes 

NOTE:-IF changes are not reflecting please do modify mapping and build sync 

Wednesday, August 6, 2025

To align controls in horizontal in form

 Scenario:- To align controls in horizontal in form 

To do this Please take a group control and add all controls and change property  for group as Arrangement to Horizontal left

>> And if you still want to adjust one control up and other control down then use Heightmode property to "SizeToAvailable" and for other use "SizeToContent"

Tuesday, August 5, 2025

Get Hyper link on form control

 Scenario:- Need a form control Hyperlink, Upon clicking on that link it should navigate to website.

These can be done in two steps

1)Take a command button and in properties change  style from none to CommandLink and give text what ever should be visible on hyperlink 

2) Override clicked method and write logic as below:-

Browser br = new Browser();
br.navigate("
https://manidynamics.blogspot.com", true);

Now open form you will get required functionality. 

That all task completed.

Thankyou!!

Thursday, July 17, 2025

Upload File from local system in a form

 Actions to be done at 3 stages 

1) Create Fileupload item by right clicking on design as shown in image below

2)Change Properties especially Fileuploadstrategyclass to "FileUploadTempStorageStrategy" as shown in image below.


3) After that to store file in Docref use logic in OnUploadCompleted() method

[Form]
public static class DaxTestingForm extends SysLookupMultiSelectGrid
{
    #characters
    [Control("Custom")]
    class ImageUpload
    {
        /// <summary>
        ///
        /// </summary>
        public void OnUploadCompleted()
        {
            FileUploadTemporaryStorageResult    result = this.getFileUploadResult() as FileUploadTemporaryStorageResult;
              
            super();

 

            if(result && result.getUploadStatus())
            {
                str fileName = "YourFileName.pdf"; //Insert the name of the attachchment

 

                using(System.IO.MemoryStream stream = result.openResult() as System.IO.MemoryStream)
                {
                    DocuRef docuRef = DocumentManagement::attachFile(
                            MainAccountTable.TableId, // The Table Id that will be linked to the the attachment
                    MainAccountTable.RecId,   //The RecId of the record that will be linked to the attachment
                    curext(),
                        DocuType::typeFile(),//Input here the attachment type
                    stream,
                            fileName,
                            null,
                            fileName);
                }
            }

 

            
        }
        
    }

 }

Otuput:-


change lookup for documenttype in file upload from leave request

 Scenario:- Today in this blog we see how to alter lookup of document type based on document type in leave request form as shown in image be...