web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Adding Registration number with a job

(0) ShareShare
ReportReport
Posted on by 72

Hello everyone so i'm trying to make a job that add a registration number, registration type and description to a customer like photo below 

pastedimage1671025638334v1.png

can anyone help me please?

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi wassim,

    This registration tab is added as an extension. Refer to the form "LogisticsPostalAddress.Extension".

    So, you need to join CustTable >>DirPartyTable >> LogsiticsPostalAddress >> LogisticsLocation >> DirPartyLocation >> TaxRegistration table. You can check each table relations.

    You need to make use of the above 7 tables to insert records in to the TaxRegistration table.

    Thanks,

    Girish S.

  • wassim.77 Profile Picture
    72 on at

    thnk you for your quick response Girish. do you think there is a way to pass the DirPartyLocation to the job without entring it manually?

  • GirishS Profile Picture
    27,827 Moderator on at

    If you have CustTable then with the help of that you can get DirPartyLocation and pass it to the job.

    Refer to the below link. You can refer to Solution 2 on the link.

    https://community.dynamics.com/365/financeandoperations/b/365finopsknowledge/posts/get-customer-address-by-type-in-dynamics-ax-d365-f-o-x

    Thanks,

    Girish S.

  • wassim.77 Profile Picture
    72 on at

    How do i get custtable?

  • GirishS Profile Picture
    27,827 Moderator on at

    Initially you said you need to add the registration number against customer. Thats the reason why I mentioned custTable.

    CustTable will store details of the customer.

    Thanks,

    Girish S.

  • wassim.77 Profile Picture
    72 on at

    Okey so this is the requirement o the task i need to add Registration Number to multiple customers from a excel file that containes a AccountNum, CountryRegionId,

    TaxRegistrationTypeName and a RegistrationNumber .

    i will be using CustCustomerV3Entity.

    my question is what existing methode in CustCustomerV3 should i use to insert into TaxRegistration.

    this the business logic i will be using 

    class HmcImportRegistrationJob
    {
        /// 
        /// Runs the class with the specified arguments.
        /// 
        /// The specified arguments.
        
          
        
        
        
    
            public static void main(Args _args)
            {
                TaxRegistration         taxRegistration;
                DirPartyTable           dirPartyTable;
                CustTable               custTable;
                DirPartyLocation        dirPartyLocation;
    
                CustAccount                     accountNum =  "DE-001";
                TaxRegistrationTypeCountryId    countryRegionId = "USA";
                TaxRegistrationTypeName         taxRegistrationTypeName = "BRN";
                TaxRegistrationNumber           taxRegistrationNumber ='Z12345678';
    
                TaxRegistrationType             taxRegistrationType = TaxRegistrationType::findByType(taxRegistrationTypeName);
                TaxRegistrationTypeApplicabilityRule rule =
                TaxRegistrationTypeApplicabilityRule::findByTypeCountryId(taxRegistrationType.RecId, countryRegionId);
                custTable = CustTable::find(accountNum);    
    
                select dirPartyTable
                where dirPartyTable.RecId == custTable.Party;
    
                select dirPartyLocation
                where dirPartyLocation.Party == dirPartyTable.RecId;
    
                
                taxRegistration.DirPartyLocation = dirPartyLocation.RecId;
                taxRegistration.TaxRegistrationTypeApplicabilityRule = rule.RecId;
                taxRegistration.RegistrationNumber = taxRegistrationNumber;
                taxRegistration.ValidFrom = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
                taxRegistration.ValidTo = maxDate();
                taxRegistration.insert();
            }
    
    }

  • GirishS Profile Picture
    27,827 Moderator on at

    CustCustomerV3Entity doesn't have TaxRegistration table. So, there won't be any existing method.

    What about the code you have written?

    Is that working?

    Thanks,

    Girish S.

  • wassim.77 Profile Picture
    72 on at

    yes it's working it's inserting the data.

    i thougt maybe overriding postGetStagingData or insertEntityDataSource?

    or do you have any better solution?

    thank you Girish

  • GirishS Profile Picture
    27,827 Moderator on at

    But I think above said method can be used when the TaxRegistration table exist as datasource in the entity.

    Instead you can create a new entity with all the required tables along with TaxRegistration table. So that you can use that entity.

    Thanks,

    Girish S.

  • wassim.77 Profile Picture
    72 on at

    i just need CustCustomerV3Entity because it contains CustTable.

    from the custaccount i can determine dirpartylocation

    and from CountryRegionId, TaxRegistrationTypeName i can determine TaxRegistrationTypeApplicabilityRule

    for the RegistrationNumber i will just use the one in the file

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans