Get Company Tax Registration Number in d365 fo x++

//Get Company Tax Registration Number In dynamic 365 finance and operation    

 public  TaxRegistrationNumber getTaxRegistrationByType(companyInfo _compInfo, str _type)

    {

        TaxRegistration                             taxRegistration;

        DirPartyLocation                            partyLocation;

        TaxRegistrationTypeApplicabilityRule        taxRegistrationRule;

        TaxRegistrationType                         taxRegistrationType;

      select firstonly RegistrationNumber from taxRegistration  join partyLocation join taxRegistrationRule join taxRegistrationType

            where taxRegistration.DirPartyLocation == partyLocation.RecId

            && partyLocation.Party == _compInfo.RecId

            && taxRegistration.TaxRegistrationTypeApplicabilityRule == taxRegistrationRule.RecId

           && taxRegistrationRule.TaxRegistrationType == taxRegistrationType.RecId

            && taxRegistrationType.TaxRegstrationType == _type;

        return taxRegistration.RegistrationNumber;

    }

Comments

Popular posts from this blog

Get Current Worker data in d365 fo x++

Table Level Event Handler in d365 fo x++