Wednesday, September 18, 2024

My Requirement is Delete option in Vendor Master for all roles except System Administrator

   [FormControlEventHandler(formControlStr(VendParameters, VendParameters_YNV_VendorMasterDeletionOption), FormControlEventType::Modified)]

    public static void VendParameters_YNV_VendorMasterDeletionOption_OnModified(FormControl sender, FormControlEventArgs e)

    {

        VendParameters          vendParameters;

        FormCheckBoxControl     formCheckBoxControl = sender as FormCheckBoxControl;

        ttsBegin;

        while select

            forUpdate crossCompany

                YNV_VendorMasterDeletionOption,DataAreaId

            from

            vendParameters where vendParameters.DataAreaId != curExt()

        {

            changeCompany(vendParameters.dataAreaId)

            {

                vendParameters.YNV_VendorMasterDeletionOption = formCheckBoxControl.checked();

                vendParameters.update();

            }

        }

        ttsCommit;

    }

====================

[ExtensionOf(FormDataSourcestr(VendTable, VendTable))]

 final class YNV_VendTableFormDatasource_Extension

{

    public int active()

    {

        int ret = next active();

 VendTable               vendTable = this.cursor();

        boolean                 validate;

        VendParameters          vendParameters = VendParameters::find();

        #SysSystemDefinedButtons

         FormCommandButtonControl  delete               =this.formRun().control(this.formRun().controlId(#SystemDefinedDeleteButton)) as FormCommandButtonControl;


        if (!Global::isSystemAdministrator() && vendParameters.YNV_VendorMasterDeletionOption)

        {

            delete.enabled(NoYes::No);

        }

        else

        {

            delete.enabled(NoYes::Yes);

        }

=================================================

OutPut:-











Monday, August 5, 2024

Multi selection

My requirement is to move multiple records from one grid to another grid by using the clicked method.


public void clicked()

        {

            super();

            SECURITYROLE            sECURITYROLELoc = SECURITYROLE_Ds.cursor();

            vendgroup               vendgrouploc;

            vendgroup               vendorgroup;

            ynv_xdscustomization    xdscustomization;

            int                     recordsCount;

 

            recordsCount = vendgroup_ds.recordsMarked().lastIndex();  // Total number of marked records.

            vendgrouploc    = vendgroup_ds.getFirst(1);

 

            while (vendgrouploc)

            {

                ttsbegin;

                xdscustomization.vendgroup      = vendgrouploc.vendgroup;

                xdscustomization.name           = vendgrouploc.name;

                xdscustomization.securityname   = securityroleloc.name;

                xdscustomization.insert();

                ttscommit;

                vendgrouploc = vendgroup_ds.getNext();

            }

        }

Thursday, May 23, 2024

XML

 My requirement is to create  XML files for the vend payment journal through code and send them to SharePoint.


using System.IO;

using System.IO.Path;

using Microsoft.Azure;

using Blobstorage = Microsoft.WindowsAzure.Storage;

using Microsoft.WindowsAzure.Storage.Blob;

using Microsoft.Dynamics.Platform.Integration.SharePoint;

using Microsoft.Dynamics.ApplicationPlatform.Services.Instrumentation;

using Microsoft.DynamicsOnline.Infrastructure.Components.SharedServiceUnitStorage;

using Microsoft.Dynamics.AX.Framework.FileManagement;

internal final class YNV_PoBankIntegration

{

    /// <summary>

    /// Class entry point. The system will call this method when a designated menu 

    /// is selected or when execution starts and this class is set as the startup class.

    /// </summary>

    /// <param name = "_args">The specified arguments.</param>

    public static void createXML(LedgerJournalTrans ledgerJournalTrans)

    {

            XmlDocument doc;

            XmlElement Document;

            XmlElement CstmrCdtTrfInitn;

            XmlElement GrpHdr;

            XmlElement oneChild;

            XmlElement secondChild;

            XmlElement thirdChild;

            XmlElement fourthChild;

            XmlElement InitgPtyNode;

            XmlElement InitgPtyChild;

            XmlElement PmtInfList;

            XmlElement PmtInfListChild1;

            XmlElement PmtInfListChild2;

            XmlElement PmtInfListChild3;

            XmlElement PmtInfListChild4;

            XmlElement PmtInfListChild5;

            XmlElement PmtTpInf;

            XmlElement  SvcLvlList;

            XmlElement SvcLvlListChild1;

            XmlElement ReqdExctnDt;

            XmlElement DbtrList;

            XmlElement DbtrListChild1;

            XmlElement PstlAdr;

            XmlElement Ctry;

            XmlElement AdrLine;

            XmlElement DbtrAcct;

            XmlElement IBAN;

            XmlElement Id;

            XmlElement DbtrAgt;

            XmlElement FinInstnId;

            XmlElement BIC;

            XmlElement CdtTrfTxInf;

            XmlElement PmtId;

            XmlElement EndToEndId;

            XmlElement Amt;

            XmlElement InstdAmt;

            XmlElement CdtrAgt;

            XmlElement FinInstnIdList;

            XmlElement Cdtr;

            XmlElement Nm;

            XmlElement CdtrAcct;

            boolean    transactionStatus = NoYes::No;

            DimensionAttributeValueCombination  combination,combinationOffset;

            LedgerJournalTrans      ledgerJournalTransLoc,ledgerJournalTransLocSum;

            LedgerJournalTable      ledgerJournalTable = LedgerJournalTable::find(ledgerJournalTrans.JournalNum);

            doc = XmlDocument::newBlank();

            Document = doc.createElement('Document');

            Document.setAttribute('xsi:schemaLocation','urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd');

            Document.setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');

            Document.setAttribute('xmlns','urn:iso:std:iso:20022:tech:xsd:pain.001.001.03');

            doc.appendChild(Document);

        //CstmrCdtTrfInitn

            CstmrCdtTrfInitn = doc.createElement('CstmrCdtTrfInitn');

            Document.appendChild(CstmrCdtTrfInitn);

        str formatted = System.String::Format(

                                '{0:yyyyMMddTHHmmss}',

                                DateTimeUtil::newDateTime(systemDateGet(), timeNow()));

        System.DateTime dateTime = System.DateTime::get_UtcNow();

        str utcTimeAsStr = dateTime.ToString('yyyyMdHHmmss');

        select sum(AmountCurDebit),sum(AmountCurCredit) from ledgerJournalTransLocSum where ledgerJournalTransLocSum.JournalNum == ledgerJournalTable.JournalNum;

        // GrpHdr

            GrpHdr = doc.createElement('GrpHdr');

            CstmrCdtTrfInitn.appendChild(GrpHdr);

            utcDateTime    todayDate = DateTimeUtil::getSystemDateTime();

       


            oneChild = doc.createElement('MsgId');

            oneChild.appendChild(doc.createTextNode(strFmt("%1-%2" ,ledgerJournalTrans.JournalNum , utcTimeAsStr)));

            GrpHdr.appendChild(oneChild);



            secondChild = doc.createElement('CreDtTm');

            secondChild.appendChild(doc.createTextNode(formatted));

            GrpHdr.appendChild(secondChild);


            thirdChild = doc.createElement('NbOfTxs');

            thirdChild.appendChild(doc.createTextNode(any2Str(ledgerJournalTable.numOfLines())));

            GrpHdr.appendChild(thirdChild);


            

            fourthChild = doc.createElement('CtrlSum');

            fourthChild.appendChild(doc.createTextNode(any2Str(trunc(ledgerJournalTransLocSum.AmountCurDebit - ledgerJournalTransLocSum.AmountCurCredit))));

            GrpHdr.appendChild(fourthChild);

        // InitgPtyNode

            InitgPtyNode = doc.createElement('InitgPtyc');

            GrpHdr.appendChild(InitgPtyNode);


            InitgPtyChild = doc.createElement('Nm');

            InitgPtyChild.appendChild(doc.createTextNode(CompanyInfo::findRecId(CompanyInfo::current()).Name));

            InitgPtyNode.appendChild(InitgPtyChild);



            PaymentFormatCodeSets_W     paymentFormatCodeSets_W = PaymentFormatCodeSets_W::find(VendPaymModeTable::find(ledgerJournalTrans.PaymMode).RecId);


            // PmtInfList Node

            PmtInfList = doc.createElement('PmtInf');

            CstmrCdtTrfInitn.appendChild(PmtInfList);


            PmtInfListChild1 = doc.createElement('PmtInfId');

            PmtInfListChild1.appendChild(doc.createTextNode(strFmt('0%1%2 020240515-01',ledgerJournalTrans.JournalNum,paymentFormatCodeSets_W.Code)));

            PmtInfList.appendChild(PmtInfListChild1);



            PmtInfListChild2 = doc.createElement('PmtMtd');

            PmtInfListChild2.appendChild(doc.createTextNode('TRF'));

            PmtInfList.appendChild(PmtInfListChild2);



            PmtInfListChild3 = doc.createElement('BtchBookg');

            PmtInfListChild3.appendChild(doc.createTextNode('false'));

            PmtInfList.appendChild(PmtInfListChild3);


            PmtInfListChild4 = doc.createElement('NbOfTxs');

            PmtInfListChild4.appendChild(doc.createTextNode(any2Str(ledgerJournalTable.numOfLines())));

            PmtInfList.appendChild(PmtInfListChild4);

            

            PmtInfListChild5 = doc.createElement('CtrlSum');

            PmtInfListChild5.appendChild(doc.createTextNode(any2Str(trunc(ledgerJournalTransLocSum.AmountCurDebit - ledgerJournalTransLocSum.AmountCurCredit))));

            PmtInfList.appendChild(PmtInfListChild5);

        // PmtTpInf

            PmtTpInf = doc.createElement('PmtTpInf');

            PmtInfList.appendChild(PmtTpInf);

        // SvcLvlList

            SvcLvlList = doc.createElement('SvcLvl');

            PmtTpInf.appendChild(SvcLvlList);

            

            SvcLvlListChild1 = doc.createElement('Cd');

            SvcLvlListChild1.appendChild(doc.createTextNode(paymentFormatCodeSets_W.Code));

            SvcLvlList.appendChild(SvcLvlListChild1);

        // ReqdExctnDt

            ReqdExctnDt = doc.createElement('ReqdExctnDt');

            ReqdExctnDt.appendChild(doc.createTextNode(any2Str((systemDateGet()))));

            PmtInfList.appendChild(ReqdExctnDt);

        // DbtrList

            DbtrList = doc.createElement('Dbtr');

            PmtInfList.appendChild(DbtrList);

            

            DbtrListChild1 = doc.createElement('Nm');

            DbtrListChild1.appendChild(doc.createTextNode(CompanyInfo::findByCompany_IN(ledgerJournalTrans.Company).Name));

            DbtrList.appendChild(DbtrListChild1);

        //PstlAdr

            PstlAdr = doc.createElement('PstlAdr');

            DbtrList.appendChild(PstlAdr);


            Ctry = doc.createElement('Ctry');

            Ctry.appendChild(doc.createTextNode(SysCountryRegionCode::countryInfo(ledgerJournalTrans.Company)));

            PstlAdr.appendChild(Ctry);


            AdrLine = doc.createElement('AdrLine');

            AdrLine.appendChild(doc.createTextNode(CompanyInfo::findByCompany_IN(ledgerJournalTrans.Company).postalAddress().Address));

            PstlAdr.appendChild(AdrLine);

            

             //   

            DbtrAcct = doc.createElement('DbtrAcct');

            PmtInfList.appendChild(DbtrAcct);

           

            Id = doc.createElement('Id');

            DbtrAcct.appendChild(Id)

;

            

                

            IBAN = doc.createElement('IBAN');

            combinationOffset = DimensionAttributeValueCombination::find(ledgerJournalTrans.OffsetLedgerDimension);

            IBAN.appendChild(doc.createTextNode(BankAccountTable::find(combinationOffset.DisplayValue).AccountNum));

            Id.appendChild(IBAN);


            

            DbtrAgt = doc.createElement('DbtrAgt');

            PmtInfList.appendChild(DbtrAgt);


            FinInstnId = doc.createElement('FinInstnId');

            DbtrAgt.appendChild(FinInstnId);


            BIC = doc.createElement('BIC');

            BIC.appendChild(doc.createTextNode(BankAccountTable::find(combinationOffset.DisplayValue).SWIFTNo));

            FinInstnId.appendChild(BIC);

 

        while select ledgerJournalTransLoc where ledgerJournalTransLoc.JournalNum == ledgerJournalTrans.JournalNum 

        {

            transactionStatus = NoYes::Yes;

            combination = DimensionAttributeValueCombination::find(ledgerJournalTransLoc.LedgerDimension);

            CdtTrfTxInf = doc.createElement('CdtTrfTxInf');

            PmtInfList.appendChild(CdtTrfTxInf);


            PmtId = doc.createElement('PmtId');

            CdtTrfTxInf.appendChild(PmtId);


            EndToEndId = doc.createElement('EndToEndId');

            EndToEndId.appendChild(doc.createTextNode(strFmt('%1-%2-05',ledgerJournalTransLoc.Voucher,ledgerJournalTransLoc.RecId)));

            PmtId.appendChild(EndToEndId);


            Amt = doc.createElement('Amt');

            CdtTrfTxInf.appendChild(Amt);

           

                InstdAmt = doc.createElement('InstdAmt');

                InstdAmt.setAttribute("Ccy",ledgerJournalTransLoc.CurrencyCode);

            if (ledgerJournalTransLoc.AmountCurDebit != 0)

            {

                InstdAmt.appendChild(doc.createTextNode(any2Str(trunc(ledgerJournalTransLoc.AmountCurDebit))));

            }

            else

            {

                InstdAmt.appendChild(doc.createTextNode(strFmt("-%1",any2Str(trunc(ledgerJournalTransLoc.AmountCurCredit)))));

            }

            Amt.appendChild(InstdAmt);


            CdtrAgt = doc.createElement('CdtrAgt');

            CdtTrfTxInf.appendChild(CdtrAgt);


            FinInstnIdList = doc.createElement('FinInstnId');

            CdtrAgt.appendChild(FinInstnIdList);


            BIC  = doc.createElement('BIC');

            BIC.appendChild(doc.createTextNode(VendBankAccount::find(combination.displayValue,ledgerJournalTransLoc.CustVendBankAccountId).SWIFTNo));

            FinInstnIdList.appendChild(BIC);


            

            Nm  = doc.createElement('Nm');

            Nm.appendChild(doc.createTextNode(VendBankAccount::find(combination.displayValue,ledgerJournalTransLoc.CustVendBankAccountId).Name));

            FinInstnIdList.appendChild(Nm);


            PstlAdr    = doc.createElement('PstlAdr');

            FinInstnIdList.appendChild(PstlAdr);


            Ctry   = doc.createElement('Ctry');

            Ctry.appendChild(doc.createTextNode(LogisticsAddressCountryRegion::find(LogisticsPostalAddress::findByLocation(VendBankAccount::find(combination.displayValue,ledgerJournalTransLoc.CustVendBankAccountId).Location).CountryRegionId).ISOcode));

            PstlAdr.appendChild(Ctry);


            AdrLine   = doc.createElement('AdrLine');

            AdrLine.appendChild(doc.createTextNode(LogisticsPostalAddress::findByLocation(VendBankAccount::find(combination.displayValue,ledgerJournalTransLoc.CustVendBankAccountId).Location).Address));

            PstlAdr.appendChild(AdrLine);


            

            Cdtr    = doc.createElement('Cdtr');

            CdtTrfTxInf.appendChild(Cdtr);


            Nm  = doc.createElement('Nm');

            Nm.appendChild(doc.createTextNode('...... ..'));

            Cdtr.appendChild(Nm);


            PstlAdr    = doc.createElement('PstlAdr');

            Cdtr.appendChild(PstlAdr);


            Ctry   = doc.createElement('Ctry');

            Ctry.appendChild(doc.createTextNode(LogisticsAddressCountryRegion::find(DirParty::primaryPostalAddress(VendTable::find(ledgerJournalTransLoc.accountDisplay()).Party).CountryRegionId).ISOcode));

            PstlAdr.appendChild(Ctry);


            AdrLine   = doc.createElement('AdrLine');

            AdrLine.appendChild(doc.createTextNode(DirParty::primaryPostalAddress(VendTable::find(ledgerJournalTransLoc.accountDisplay()).Party).Address));

            PstlAdr.appendChild(AdrLine);


            CdtrAcct     = doc.createElement('CdtrAcct');

            CdtTrfTxInf.appendChild(CdtrAcct);

            

            Id = doc.createElement('Id');

            CdtrAcct.appendChild(Id)

;

            

            IBAN   = doc.createElement('IBAN');

            IBAN.appendChild(doc.createTextNode(VendBankAccount::find(combination.displayValue,ledgerJournalTransLoc.CustVendBankAccountId).BankIBAN));

            Id.appendChild(IBAN);

        }

            Info("File sent to sharepoint");


            System.Byte[]   reportBytes = new System.Byte[0]();

            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();


            reportBytes = enc.GetBytes(doc.outerXml());


            System.IO.Stream streamLoc = new System.IO.MemoryStream(reportBytes);

        if (transactionStatus == NoYes::Yes)

        {

            YNV_PoBankIntegration::sendFileToSharePoint(streamLoc,ledgerJournalTrans.JournalNum);

        }

    }


    public static void sendFileToSharePoint(System.IO.Stream            stream, LedgerJournalId ledgerJournalId)

    {

       

        Filename                    fileName;

        FileUploadTemporaryStorageResult fileUploadResult;

        VendParameters  vendParameters =VendParameters::find();


        if (fileUploadResult == null)

        {

            //fileName = System.Text.RegularExpressions.Regex::Replace(strFmt("%1-%2",ledgerJournalId,utcTimeAsStr), @"[\W_]", "");

            System.DateTime dateTime = System.DateTime::get_UtcNow();

            str utcTimeAsStr = dateTime.ToString('yyyyMdHHmmss');

            str flileNameLoc = strFmt("%1%2.Xml",ledgerJournalId,utcTimeAsStr);


            try

            {

                

                str defaultSPServer = vendParameters.YNV_SharePointURL;   //'tekexperts.sharepoint.com';

                str spSite = vendParameters.YNV_SharePointSite; //'sites/YNVArchitectureAndDesign';


                str spFolderPath = vendParameters.YNV_FileLocation; //"Shared Documents/Finance/Integration/POC_BankIntegration";


                str fileContetType = System.Web.MimeMapping::GetMimeMapping(flileNameLoc);


            

                str externalId = xUserInfo::getExternalId(vendParameters.YNV_UserForSharepointUser);


                    Microsoft.Dynamics.AX.Framework.FileManagement.IDocumentStorageProvider storageProvider = new Microsoft.Dynamics.AX.Framework.FileManagement.SharePointDocumentStorageProvider(

                    defaultSPServer,

                    spSite,

                    spFolderPath,

                    externalId);


                storageProvider.ProviderId = DocuStorageProviderType::SharePoint;


                if (storageProvider != null)

                {

                    str uniqueFilename = storageProvider.GenerateUniqueName(filename);

                    Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation location = storageProvider.SaveFile(

                        newGuid(),

                        flileNameLoc,

                        fileContetType,

                        stream);

                }


            }

            catch(Exception::Error)

            {

                error("Upload failed.");

            }

        }

    }


}


output:-

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd">
<CstmrCdtTrfInitn>
<GrpHdr>
<MsgId>JBN001963-2024521072602</MsgId>
<CreDtTm>05/21/2024 07:26:02</CreDtTm>
<NbOfTxs>2</NbOfTxs>
<CtrlSum>1120</CtrlSum>
<InitgPtyc>
<Nm>Tek Experts EOOD</Nm>
</InitgPtyc>
</GrpHdr>
<PmtInf>
<PmtInfId>0JBN001963 %2020240515-01</PmtInfId>
<PmtMtd>TRF</PmtMtd>
<BtchBookg>false</BtchBookg>
<NbOfTxs>2</NbOfTxs>
<CtrlSum>1120</CtrlSum>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
</PmtTpInf>
<ReqdExctnDt/>
<Dbtr>
<Nm>Tek Experts EOOD</Nm>
<PstlAdr>
<Ctry>BG</Ctry>
<AdrLine>xxxxx 1000 BGR</AdrLine>
</PstlAdr>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN/>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC/>
</FinInstnId>
</DbtrAgt>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>VPAY005613-5637299076-05</EndToEndId>
</PmtId>
<Amt>
<InstdAmt>Ccy=BGN>780.00</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BIC>UNCRBGSFXXX</BIC>
<Nm>UNCR Bank</Nm>
<PstlAdr>
<Ctry>BG</Ctry>
<AdrLine>xxxxx Sofia 1000 BGR</AdrLine>
</PstlAdr>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>...... ..</Nm>
<PstlAdr>
<Ctry>BG</Ctry>
<AdrLine>xxxxx Sofia BGR</AdrLine>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>BG16UNCR70001521952092</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>VPAY005614-5637299077-05</EndToEndId>
</PmtId>
<Amt>
<InstdAmt>Ccy=BGN>340.00</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BIC>UNCRBGSFXXX</BIC>
<Nm>UNCR Bank</Nm>
<PstlAdr>
<Ctry>BG</Ctry>
<AdrLine>xxxxx Sofia 1000 BGR</AdrLine>
</PstlAdr>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>...... ..</Nm>
<PstlAdr>
<Ctry>BG</Ctry>
<AdrLine>xxxxx Sofia BGR</AdrLine>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>BG16UNCR70001521952092</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
</PmtInf>
</CstmrCdtTrfInitn>
</Document>

Cursor Records in same form

FormMethods:- 

 form --init method --  you will not get any cursor record in the form init level.

1. Get the Cursor record at the DataSource level.

internal final class DAXSalesTable_Extension

{                                                                                        

   boolean validateWrite()

   {

       boolean                     ret;

       FormRun                      fr = this.formRun();

       FormDataSource             FDS =  fr.dataSource();

       SalesTable                  salestableloc = FDS.cursor();

       ret =    next validateWrite();

       return ret;

   }       

}

-----------------------------------------------

2. Get the cursor record in Datasourcefield level:-

   [ExtensionOf(formDataFieldStr(SalesTable,SalesTable,CustAccount))]

internal final class DAXSalesTableDatasourceField_Extension

{

   public void modified()

   {

       SalesTable          salesTable;

       FormDataSource      fds;

       FormDataObject  fd = any2Object(this) as FormDataObject;// This line of code works at both the control level and the form data field level.

       next Modified();

       fds = fd.datasource();

       salesTable = fds.cursor();

   }

}

---------------------------------------------------

3. Get the cursor record in the Control level:-

[ExtensionOf(formControlStr(SalesTable,SalesStatus))]

internal final class DAXSalesTableControl_Extension

{

   public void clicked()   

   {

       next clicked();

       FormControl                 callerButton    = any2Object(this) as FormControl;

       FormRun                     formRun         = callerButton.formRun();

       FormDataSource              formDataSource  = formRun.datasource();

       CustTableChangeProposal     custTableChangeProposal = formDataSource.cursor();

   }

}

get control:-

 

       FormRun formRun = this as FormRun;

       FormButtonControl DAXTeamButton = formRun.design().controlName(formControlStr(CustChangeProposal, DAXTeamButton)) as FormButtonControl;

---------------------------------------------------

Form on activated:-

How to get FormControl in OnActivated method:-

internal final class Class1

{

   /// <summary>

   ///

   /// </summary>

   /// <param name="sender"></param>

   /// <param name="e"></param>

   /// <summary>

   ///

   /// </summary>

   /// <param name="sender"></param>

   /// <param name="e"></param>

   [FormEventHandler(formStr(EcoResProductDetailsExtended), FormEventType::Activated)]

   public static void EcoResProductDetailsExtended_OnActivated(xFormRun sender, FormEventArgs e)

   {

       FormControl ctrlname = sender.design().controlName(formControlStr(EcoResProductDetailsExtended,"USMFButton"));    

       FormDataSource  FDS=sender.dataSource(formDataSourceStr(EcoResProductDetailsExtended, InventTable));

       InventTable        _table    =FDS.cursor() ;

       if(curExt()=="USMF") // Condition

       {

          ctrlname.enabled(true);

       }

       else

       {

           ctrlname.enabled(false);

       }

   }

 

}

 // PurchTable callerRec = sender.formRun().dataSource("PurchTable").cursor();

----------------------------------------------------------------------------------------


     






Thursday, May 2, 2024

Customization Analysis Report (CAR Report)

 

The CAR Customization Analysis Report is a Microsoft Excel report. This report contains details of your customizations & artefacts, extension models, best practices issues, errors & warnings.

The report is in the form of a Microsoft Excel workbook. By using this command you can get Complete details of your BP Errors, warnings, and Errors.

Steps to make a Customized analysis report.

  1. Run Cmd in your development machine as administrator.
  2. Select the drive where your model and package lie in cmd. In my case my drive is K:\
    Review this example.
    For the first time, you will see this in your command prompt. You have to change the Directory according to your model and package.


    Now you go to main of C:\ by using this command cd\
    Capture1.PNG
    as you see you are in the main of C:\
    Now you have to go to the Drive where the Model Lies in my case It lies on K:\, so I have to change it to K:\
    Capture2.PNG
    Remember: You have to choose the right Drive as I say where your Model Lies. For Example  K:\AosService\PackagesLocalDirectory
    In my case my Models are in Drive K and the path is mentioned above.
  3. Now Run the command
    K:\AosService\PackagesLocalDirectory\bin\xppbp.exe -metadata=”K:\AosService\PackagesLocalDirectory” -all -model=”YourModelName” -xmlLog=C:\temp\BPCheckLogcd.xml -module=”YourModuleName” -car=c:\temp\CAReport.xlsx

    The Green Text shows the path where you want to save the report file, In my case I am not changing it. You can change as per your requirement.

  4. After success full command run you can see this.
    Capture3.PNG
    In my case, I have only 3 warnings and 0 errors. To see the detailed xlsx report you need to go to the path which you provided to save the file, in my case c:\temp\CAReport.xlsx this is my path.
  5. Find your xlsx Document.
    Capture4.PNG

My Requirement is Delete option in Vendor Master for all roles except System Administrator

   [FormControlEventHandler(formControlStr(VendParameters, VendParameters_YNV_VendorMasterDeletionOption), FormControlEventType::Modified)] ...