Tuesday, September 2, 2025

If a How to get Purchase Order (PO) is linked to a Purchase Requisition (PR), fetch the Name from the PR and populate it in the Description field of the Product Receipt form.

 If a Purchase Order (PO) is linked to a Purchase Requisition (PR), fetch the Name from the PR and populate it in the Description field of the Product Receipt form.


[ExtensionOf(formDataSourceStr(PurchEditLines,PurchParmTable))]

internal final class PurchParmTableFormDataSource_Extension

{

    public void executeQuery()

    {

        next executeQuery();

        PurchReqTable purchReqTable;

        PurchReqLine  purchReqLine;

        FormStringControl   Invoicedescription = this.formRun().design().controlName("PurchParmTable_Description");

        PurchParmTable purchParmTable = this.cursor();

 

  

        select firstOnly purchReqLine

            where purchReqLine.PurchId == purchParmTable.PurchId

            && purchReqLine.INVENTDIMIDDATAAREA == purchParmTable.DataAreaId;

           

        if (purchReqLine.RecId)

        {

       

            select firstOnly purchReqTable

                where purchReqTable.RecId == purchReqLine.PurchReqTable;

 

            if (purchReqTable.RecId)

            {

               

                purchParmTable.Description = purchReqTable.PurchReqName;

                Invoicedescription.allowEdit(false);


            }

        }

        else

        {

            

            FormStringControl descriptionCtrl =  this.formRun().design().controlName('PurchParmTable_Description'); // Control name in the form

               

            if (descriptionCtrl)

            {

                descriptionCtrl.mandatory(true);

            }

        }

    

 

 

    }


}

No comments:

Post a Comment

How to Control Edit Access for Sales Tax Fields in PR Lines Through Configuration in D365 Finance & Operations

 To provide a configuration-driven approach for controlling edit access to the Item Sales Tax Group and Sales Tax Group fields on Purchase...