MyRapidi
MyRapidi

Search our Wiki

MS Dynamics BC PostedSales Invoices -> D365 Sales Invoice Add/Update

This transfer will transfer new and updated MS Dynamics Business Central Posted Sales invoice Headers into D365 invoice. All mappings are either 1:1 or additional lookups have been created. However, there are specific mappings where you have more than 1 option to map the indicated fields:

  1. Currency_Code -> transactioncurrencyid
  2. Business Central Field D365 Sales Field
    ##BLANKVALUE(LSLOOKUP('TRANSACTIONCURRENCY',"Currency_Code"),SKIPFIELD()) transactioncurrencyid
    ##IF(EQUALS("Currency_Code",''),DBLOOKUP('DESTDS','transactioncurrency','isocurrencycode','%%CURR%','transactioncurrencyid'),DBLOOKUP('DESTDS','transactioncurrency','isocurrencycode',"Currency_Code",'transactioncurrencyid'))) transactioncurrencyid

    Note: In Business Central, the field Currency_Code is a predefined picklist that will provide you with all currency codes. In D365 Sales, the field transactioncurrencyid is a GUID field and can only be used in this manner. A 1:1 mapping is not possible due to the above.

    • Formula ##BLANKVALUE(LSLOOKUP('TRANSACTIONCURRENCY',"Currency_Code"),SKIPFIELD()) where the D365 Sales transactioncurrencyid is retrieved from a dynamic lookup table and ,if the formula evaluates to NULL, then the field is skipped from the data transferring process.
    • Formula ##IF(EQUALS("Currency_Code",''),DBLOOKUP('DESTDS','transactioncurrency','isocurrencycode','%%CURR%','transactioncurrencyid'),DBLOOKUP('DESTDS','transactioncurrency','isocurrencycode',"Currency_Code",'transactioncurrencyid'))) where we have 2 lookups made on the destination ( D365 Sales) to retrieve the transactioncurrencyid.
  3. Salesperson_Code ->Ownerid
  4. Business Central Field D365 Sales Field
    ##'/systemusers('+BLANKVALUE(LSLOOKUP('%%LSUSER%'+'#REVERSE',"Salesperson_Code"),'%%DEF_OWNER%')+')' ownerid
    ##CASE(DBLOOKUP('DESTDS','systemuser','new_salespersoncode',"Salesperson_Code",'systemuserid'),'',SKIPFIELD(),'/systemusers('+DBLOOKUP('DESTDS','systemuser','new_salespersoncode',"Salesperson_Code",'systemuserid')+')') ownerid

    Note: In Business Central, the field Salesperon_Code is a free-text field which is usually populated with the salesperson’s initials. In D365 Sales, there is no standard field that can hold this information in the same manner. Instead the owner ID is the equivalent of the Salesperson Code but it is stored as a GUID field.

    • Formula ##'/systemusers('+BLANKVALUE(LSLOOKUP('%%LSUSER%'+'#REVERSE',"Salesperson_Code"),'%%DEF_OWNER%')+')' that will retrieve the corresponding owner ID for the Business Central Salesperson Code. This data is fed into D365 Sales by a separate transfer and is available in the dynamic lookup table called LSUSER. If the formula evaluates to NULL, a default user will be assigned to the record that will be created in D365 Sales. The default owner ID is created as a TAG and the value will be the actual GUID.
    • ##CASE(DBLOOKUP('DESTDS','systemuser','new_salespersoncode',"Salesperson_Code",'systemuserid'),'',SKIPFIELD(),'/systemusers('+DBLOOKUP('DESTDS','systemuser','new_salespersoncode',"Salesperson_Code",'systemuserid')+')') which will perform a lookup on the destination (D365 Sales) but it will require setting up a new field new_salespersoncode to hold the salesperson code.