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;
    }

 

}

 

 





No comments:

Post a Comment

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...