Wednesday, November 19, 2025

Filter Attachments Docuref when attachments are attached from standard and through custom

 [ExtensionOf(formDatasourceStr(DocuView,DocuRef))]

final class DaxDocuViewForm_Extension
{
    void initValue()
    {
        DocuRef      docuref;
        next initvalue();
        //Args args = element.args();
        //PurchTable     purchtable = args.record();
        if(element.args().menuitemname() == menuitemdisplaystr(Dax_VendorattachmentMenuitem))
        {
            docuref.DAX_NoYes = NoYes::Yes;
        }
        else
        {
            docuref.DAX_NoYes = NoYes::No;
        }
    }
}


and in Docuhistory:-

internal final class Dax_DocuHistoryTable
{

    [DataEventHandler(tableStr(DocuHistory), DataEventType::Inserted)]
    public static void DocuHistory_onInserted(Common sender, DataEventArgs e)
    {
        DocuHistory docuHistory = sender as DocuHistory;
        DocuHistory docuHistoryloc;
        DocuRef     docuRef;
        if(docuHistory.DocuValueDeleted==NoYes::No)
        {
            if (!docuHistory)
            return;

 

            select firstonly docuRef
                where docuRef.RecId == docuHistory.DocuRefRecId;

 

                if (docuRef)
                {
                    ttsbegin;
                    docuHistory.selectForUpdate(true);
                    docuHistory.Dax_IsCustomAttachment = docuRef.DAX_NoYes;
                    docuHistory.update();
                    ttscommit;
                }
        }
        else
        {
            if (!docuHistory)
            return;
            select firstonly docuHistoryloc
                where docuHistoryloc.DocuRefRecId==docuHistory.DocuRefRecId
&& docuHistoryloc.DocuValueDeleted==NoYes::No;
            ttsbegin;
            docuHistory.selectForUpdate(true);
            docuHistory.Dax_IsCustomAttachment =docuHistoryloc.Dax_IsCustomAttachment;
            docuHistory.update();
            ttscommit;

 

        }
    }

 

}

Tuesday, November 18, 2025

Highlight text of record based on condition in d365fo x++

 public void displayOption(Common _record, FormRowDisplayOption _options)

{

    WorkflowWorkItemTable workflowWorkItemTable;


    select workflowWorkItemTable

        where workflowWorkItemTable.Status==WorkflowWorkItemStatus::Pending

        && workflowWorkItemTable.UserId==curUserId()

        && workflowWorkItemTable.RefRecId==_record.RecId

        && workflowWorkItemTable.RefTableId==tableNum(BudgetTransactionLine);


    BudgetTransactionLine  budgetTransactionLine=_record;

    if(workflowWorkItemTable)

    {

        _options.textColor(WinAPI::RGB2int(0, 150, 0));

    }

    next displayOption(_record,_options);

}

Write a condition on HTML editor control if it is having value in d365fo x++

 Htmleditor htmledc=formRun.design().controlName("YourHtmlEditorControlName") as Htmleditor;

if(htmledc.parmHtmlContent())

{write condtion}

Get ledger dimension description beside dimension in d365fo x++

 In this blog we learn how to Get ledger dimension description beside dimension in d365fo x++ Step1)write a display method in table and give...