Tuesday, June 14, 2016


Hi Daxer’s !!!

Recently I have gone through one customization.

Scenario:Add “Registrationnumber” field in Other Information group of Customer form if you enter some value on registration number it should update at taxes action pane  >>tax registration >>Registration number










>>First I have added one field in custTable like sk_Registrationnumber and also added that field to customer form as above screen shot

Note : Based on Customer Accountnum in custTable ,i need to update  registrationnumber in TaxRegistration table so I need to check relation between Custtable and Taxregistration


Taxregistration.dirpartylocation>>Dirpartylocation.party>>custtable.party
CustTable>>Modifiedfield()>>

case fieldNum(CustTable,sk_registrationnumber):
            if (this.SK_RegistrationNumber)
                {
                ttsBegin;
                while select forupdate  taxregistration
                    join DirPartyLocation
                        where taxregistration.DirPartyLocation==DirPartyLocation.RecId
                            join CustTable
                                where DirPartyLocation.Party==CustTable.Party
                    if(TaxRegistration)
                    {
                        {
                            taxregistration.validTimeStateUpdateMode(validTimeStateupdate::Correction);
                            taxregistration.ValidFrom=today();
                            taxregistration.ValidTo=today()+20;
                            taxregistration.RegistrationNumber=this.SK_RegistrationNumber;
                            taxregistration.update();
                        }
                    }
                ttsCommit;
                }
---------------------------or------------------------------------


case fieldNum(CustTable,SK_RegistrationNumber):
            if(this.SK_RegistrationNumber)
            {
                ttsBegin;
                //TaxRegistration = TaxRegistration::find(DirPartyLocation::findByPartyLocation(CustTable::find(this.AccountNum)
               // TaxRegistration.DirPartyLocation=Dirpartylocation::findByPartyLocation(this.Party,true).Location;
               // TaxRegistration.TaxRegistrationTypeApplicabilityRule=5637146891;
               
                //TaxRegistration.selectForUpdate(true);
                TransDate = systemDateGet();
                transDateTo = dateMax();
                TaxRegistration.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
                SELECT forUpdate validTimeState(TransDate, transDateTo) * from TaxRegistration
                    Join dirpartylocation
                        where TaxRegistration.DirPartyLocation==dirpartylocation.RecId
                            join DirPartyTable
                                where dirpartylocation.Party==DirPartyTable.RecId
                                    join CustTable
                                        where DirPartyTable.RecId==CustTable.Party;
                if(TaxRegistration)
                {
                    TaxRegistration.RegistrationNumber=this.SK_RegistrationNumber;
                    TaxRegistration.update();
                }
                ttsCommit;
            }




No comments:

Post a Comment

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...