What is the Route Details -> Description entity? - microsoft-dynamics

In "Dynamics 365 Finance and Operations - Supply Chain", I am trying to find the entity name and its attributes that correlate with this:
Route details -> Description -> (Type, Description)
I have done OData queries against a number of different route-operations related entities and I cannot find where those 2 attributes live.

I found an answer to this over on the Microsoft forum. It turns out that writing to Route Details -> Type, Description is not a straightforward thing. Those 2 attributes are actually fields on the DocuRef table in F&O and it appears that there is no publicly exposed entity for that. And thus the fields cannot be populated via OData calls. So I have been looking into building an X++ function in the web service endpoint layer of the F&O model.

Related

Fetching $metadata for a specific collection or entity with Odata web services in Microsoft Dynamics NAV 2016

The environment
As part of an integration project, I need a PHP website to be able to both read from and write to Microsoft Dynamics NAV 2016's Odata services.
Microsoft Dynamics NAV 2016 uses the Odata v3 standard.
The context
Now, let's take my customer service as an example.
Fetching a collection of entities
Fetching an overview of my collection of customer entities works fine, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/Company(\'<CompanyName>\')/customer
Fetching a single entity
Fetching a single customer entity based on id works fine, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/Company(\'<CompanyName>\')/customer(\'<Id>\')
Fetching the global metadata
Getting an overview of the $metadata for all of my services works fine (although it's lacking Json support), using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata
Fetching collection-specific metadata
Now, based on both the Odata v3 specs and the value of the odata.metadata property of my customer overview service, I would expect to be able to get an overview of the $metadata of the customer entity, using a link with the following format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#customer
This doesn't work as expected. See sub-section The issue below.
Fetching entity-specific metadata
Similarly, based on both the Odata v3 specs and the value of the odata.metadata property of my dataset when retrieving a single customer, I would expect to be able to get an overview of the $metadata of a single field of the customer entity, using a link with this format :
https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#customer/#<FieldName>
This doesn't work as expected. See sub-section The issue below.
The issue
For some reason, everything following $metadata appears to be ignored. This means that the last three URLs give me the exact same output, which is not what I expected.
The actual question(s)
Is it possible to fetch the metadata of just one collection or entity, as I'm trying in sub-sections Fetching collection-specific metadata and Fetching entity-specific metadata of my The context section hereabove?
If yes, what I doing wrong here? What am I missing?
As #xuzhg suggested in the comments and as is indicated by Github issues like Support Metadata as a service (#181), it appears that the Odata $metadata are not really a dynamic service. Instead, it's just a single XML file.
This explains not only why anything after $metadata is ignored in links of format https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#..., but also why it only supports XML, and not Json (unlike actual Odata services).
Since the specific metadata you want is identified by a fragment appended to the metadata URI, you must fetch the entire $metadata document and then dereference the fragment on the client.
The good news is that the fragment dereferencing is pretty straightforward. A fragment like #customer specifies an EntityType element whose Name attribute has the value customer. Similarly, #customer/#someprop maps to a Property element whose Name attribute is someprop.

Cross-service references in DB

I am building service oriented system, with multiple services and application.
Current I am not sure how to handle DB references between resources from multiple services and databases.
For example, I have a users service, where I can define all users and their roles.
Next I have, products service, where I can define my products, their prices and other information.
I also have invoicing service, which is used to create invoices. This service will use information from previous two services. It will link products and users to invoice. Now I am not sure what is the best approach for this?
Do I just save product ID and user ID that it got from other two services, without any referential integrity?
If I do this, then I will have problem when generating reports, because at time of generation I will need to send a lot of requests to products service, to get names and prices of product in invoice. Same for users.
Do I create some table products in my invoicing application, and store name and price of product at the moment of invoice creation?
If I go with this approach, then in case that price or name of product changes, I will have inconsistent data across my applications?
Is there some well-known pattern for this kind of problem, that is what is the best solution.
Cross-service references in DB is a common challenge for Data integrity between multiple web services, And specially when we are talking about Real time access.
There is two approaches for your case :
1- Databases Replication across your servers
I suppose that you have each application hosted on a separate server, So i can name your servers as Users_server, Products_server and Invoices_Server.
In your example, your Invoice web service need to grab data from Users & Products Servers, in this case you can create a Replication of your Users Database and Products Database on your Invoices_server.
This way you can run your Join queries on the same server and get data from multiple databases.
Query example :
SELECT *
FROM UsersDB.User u
JOIN InvoicesDB.Invoice i ON u.Id = i.ClientId
2- Main Database Replication
1st step you have to replicate all your databases into one main server we can call it Base_server, which basically contain all your databases from all your services.
Then you can build an internal web service for your application to provide needed data in just "One Call", this answer your question about generating reports.
In other words, you will make one call to the mane Base service instead of making 2 or 3 calls to your separate services.
Note: As a Backend developer we use this organization as a best practice while building a large bundle based application, we create a base bundle and then create service_bundle which rely on the base bundle.
If your services are already live, we may need more details about the technology and databases type you using in order to give you a more accurate solution.
Just because you are using SOA doesn't mean you abandon database integrity. Continue to use referential integrity where your database design requires it.
At the service level, you can have each service be responsible for returning identity information for the entities which it owns. This identity information may or may not be the actual primary key from the database, but it will be used by the clients of the service as though it were the actual primary key.
When a client wants to create an invoice, it will call the User service and receive a User entity, which will contain a User Identifier. It will call the Product service and receive a set of products, each with a product identifier. It will then call the Invoice service to create an invoice, passing the user identifier and the product identifiers. This will likely return an invoice identifier.
You can (probably should) enforce the integrity making the productId and userId foreign keys in your invoice table. Then your DB makes sure the referenced entities exist. Reports should join tables, not query services for each item. I assume a central DB shared across the system.

Amazon MWS - Submit Feed - Add Product

I'm trying to add a new product to my seller account, using SubmitFeed function (feed type being _POST_PRODUCT_DATA_). Everytime I try it, a different error comes up. Want to confirm if I understand the underlying concepts correct.
ISBN/UPC/EAN are standard global identifiers used to identity a commodity uniquely.
ASIN are standard Amazon identifiers used to identify a commodity on Amazon uniquely.
SKU is my personal unique identifier.
So, if I want to sell a product that is existent on Amazon, I can specify ASIN/UPC/EAN/ISBN. What is benefit of providing Description Data as it won't affect the description already showing on Product Listing Page on Amazon
I can add a new product (not existent on Amazon) by specifying my local SKU and omitting any ASIN/UPC/EAN/ISBN. Are there any specific rules for mandatory fields/data to be specified while adding product with specific categories/product-types?
Your understanding of the underlying concepts seems accurate.
There is no direct benefit to providing tons of details to an already existing product. Unless Amazon for some reason switches to "your" data from whoever else's. There are rumors of that happening, but I haven't had such a case myself.
For the most part, you cannot add a new product without specifying a ASIN/UPC/EAN/ISBN. There are exceptions to this, but they are few and far between. It is in Amazon's interest that identical products will be on the same page. If the description or other information on that page is wrong, contact Amazon. Apart from what the XSDs define as mandatory, there are category specific mandatory fields. The easiest way to find them is by creating a product manually in Seller Central.

Generated value for nonPK field

I have the entity of some BusinessParticipant, it just simple flat entity. And these Participants may be organized in groups, by user's wish. The group has no data, just id. So creating entity and table seems overkill... I'll wish to have 2 db tables, one for participants and one to link the participant to it's group.
The problem is how should I generate the group id? All the GenerateValue & co. work with #id annotation only.
Are there any way to mark the field that is not PK, to be automatically generated?
I have created a proposal for JPA to support #GeneratedValue on non-id fields.
Please vote here for it to be included in a future release
Depends on your persistence provider. For example, ObjectDB supports #GeneratedValue on normal fields, but this is non-standard functionality. If you're using Hibernate, there's no clean way to do this, see this stackoverflow question: Hibernate JPA Sequence (non-Id)

Entity Reference In Web Service

I have 2 tables in database one of them is employee and the other one is city. I created ado.net entity data model from database. I took a employe and i can access city of these. I am using web service and have a webmethod which return List. I selected employees and called ToList() method. I can not access city name in presentation layer which feeds by web service (asmx not wcf), only access in ID of city. how can i solve this problem.
You can use .Include when retrieving your entity from EF to load navigation properties for your entity.
http://msdn.microsoft.com/en-us/library/bb896272.aspx heres the docs on .Include, if you have EF4.1 or above there is also a lambda version in an extension method which gives you type safety (Reference System.Data.Entity)