We have written a small monitoring web site for our customer that shows the current status of their Navision system.
This was done by creating a codeunit that has a number of functions that gather data and counts for job queues etc and published the data through a page, which has been configured to be used as a web service.
The website then calls this web service and displays the data dynamically.
My question is this.
One of the counts that the codeunit creates is the number of Sessions (from the Virtual table "Session") where the Application Name is either "Microsoft Dynamics NAV Classic client" or "Application Server for Microsoft Dynamics NAV Classic". When the codeunit is run from Navision (and displayed in a list form, or displayed in an RTC page) then the correct count is displayed.
However, when calling the published page as a web service using ASP.Net, the count is always 0.
It seems the web service is somehow, unable or unwilling to give us this count.
The code in the codeunit that gets this count is as follows.
tblSession.RESET;
tblSession.SETFILTER("Application Name",
'Microsoft Dynamics NAV Classic client|Application Server for Microsoft Dynamics NAV Classic');
intValue := tblSession.COUNT;
I have even tried writing a brand new codeunit just to get the count of sessions by itterating through them, checking the Application Name, and if its one of our chosen types, incrementing a count, and returning this as a return parameter in the function. It still returns 0.
Has anyone else experienced this, or does anyone know why the data does not carry through the web service?
It appears that in Nav 2015 there is a table named "Active Session". If you want a count of the current sessions, try counting the records from this table instead.
Related
I have developed a Power BI report using Power BI Desktop, pointing to a private on premise development database as the datasource so that I was able to develop and test it easily. Then, I published it from my Power BI Desktop pbix to the work area of my customer.
As a result, the work area contains the published report and the dataset. Later, my customer has changed the dataset so that it now points to the correct on premise production database of their own. It works perfectly.
Now, I want to publish a new report for my customer using the previously published and reconfigured dataset. The problem is that I can't see any option in Power BI Desktop to have the report point to the published dataset, nor I can't see any option to avoid creating a new dataset each time I publish a report, nor any way to reconfigure from the web portal the new published report to point to the same dataset as the first one.
Is there any way to do this or any work around for this scenario? I think the most reasonable solution would be to be able to change the dataset of any report, so that the datasets of any report could be interchangeable.
Update:
I had already used connection specific parameters, but I'm not given rights to change the published dataset, so thats a dead end.
Another thing I have come up to is that in Power BI Desktop you cannot change the connection parameters values to those of production enviroment and publish the report if you can't access the target database from your computer, because PowerBI Desktop ask you to apply changes first, and when it tries to apply the values it tries to connect to the corresponding database and, obviously, ends with a network related error or timeout error trying to connect to the database server, therefore cancelling changes and returning to the starting point.
It's always a good practice to use connection specific parameters to define the data source. This means that you do not enter server name directly, but specify it indirectly using a parameter. The same for the database name, if applicable.
If you are about to make a new report, cancel Get data dialog, define parameters as described bellow, and then in Get data specify the datasource using these parameters:
To modify an existing report, open Power Query Editor by clicking Edit Queries and in Manage Parameters define two new text parameters, lets name them ServerName and DatabaseName:
Set their current values to point to one of your data sources, e.g. SQLSERVER2016 and AdventureWorks2016. Then right click your query in the report and open Advanced Editor. Find the server name and database name in the M code:
and replace them with the parameters defined above, so the M code will look like this:
Now you can close and apply changes and your report should work as before. But now when you want to change the data source, do it using Edit Parameters:
and change the server and/or database name to point to the other data source, that you want to use for your report:
After changing parameter values, Power BI Desktop will ask you to apply the changes and reload the data from the new data source. To change the parameter values (i.e. the data source) of a report published in Power BI Service, go to dataset's settings and enter new server and/or database name:
If the server is on-premise, check the Gateway connection too, to make sure that it is configured properly to use the right gateway. You may also want to check the available gateways in Manage gateways:
After changing the data source, refresh your dataset to get the data from the new data source. With Power BI Pro account you can do this 8 times per 24 hours, while if the dataset is in a dedicated capacity, this limit is raised to 48 times per 24 hours.
This is a easy way to make your reports "switchable", e.g. for switching one report from DEV or QA to PROD environment, or as part of your disaster recovery plan, to automate switching all reports in some workgroup to another DR server. In your case, this will allow you (or your customers) to easily switch the datasource of the report.
I think the only correct answer is that it cannot be done, at least at this moment.
The most closest way of achieving this is with Live connections:
https://learn.microsoft.com/en-us/power-bi/desktop-report-lifecycle-datasets
But if you have already designed your report without using the Live connection but your own development enviroment and corresponding connection parameters then you are lost, your only chance is redo all your report with the Live Connection, or the queerest one solution, to use an alias in your configuration matching the name of the database server and the same database name that in the target production environment.
I have implemented Power BI embedded in a web app with direct query using Azure SQL as data source.
The Azure SQL database is being updated by webjobs and if I leave open the Power BI embedded web app I don't see the visuals refreshing with the new data unless I trigger a query for example changing tab or filtering with a slicer.
In the documentation I found the following:
"If there is no user interaction in a visualization, like in a dashboard, data is refreshed automatically about every fifteen minutes."
Do I understand correctly that an open visual in my case should be refreshing without need of user interaction?
Can you point out to the reason for it not to be updating automatically? Also do you know a way to control the time of the refresh with direct query without user interaction more exactly than the "...about every fifteen minutes..."
When inspecting the connection properties on Power BI desktop I have made sure it indicates "Direct Query".
From my understanding the embedded report won't refresh automatically. However, if you're using the Power BI JS framework (https://github.com/Microsoft/PowerBI-JavaScript) to embed your report from a Workspace Collection, then you can use a refresh() method on the report object to manually get the latest data, provided your report is using Direct Query.
This method is only present in version 2.2.0 of the framework and was then removed in the latest version (currently 2.2.1) while further testing around billing is performed (see https://github.com/Microsoft/PowerBI-JavaScript/commit/5230b2f96b10a1104efecdffe78255b9788526b8).
However, in my testing I found the session count remained unaffected by the refresh method. You can refresh up to intervals of 15 seconds (a limit set by the server). This may change however, given the method was removed in 2.2.1, but using 2.2.0 seems to work currently.
Here's a quick and dirty example which will refresh the report every minute within the allocated session:
powerbi.embed(reportContainer, embedConfig);
report = powerbi.get(reportContainer);
window.setInterval(function () {
report.refresh();
}, 60 * 1000);
If the session expires (after 1 hour currently) then a new JWT will need to be requested and the report needs to be reloaded with the new token.
You may want to implement some checks around the session expiry if you plan to keep the report open for more than the allotted session time.
I'm trying to figure out how to load an "entity" (contact, customer etc.) in Microsoft Dynamics by passing in a phone number via the web API (meaning as a URL parameter). If there is a match for the phone number against any of the records, then the record is loaded in Dynamics (browser).
I'm digging through the web API documentation, but so far I'm not seeing it.
I will answer this assuming that you are asking about Dynamics CRM.
The process can be divided into two steps:
Fetch the GUID of the record in CRM (if it exists) based on the phone number.
Use the GUID to open the record in CRM.
For simplicity I will answer this for fetching and showing only one type of record (in this case a Contact). It should easily expand to multiple records.
Step 1:
As you mention in the title, the Web API/ODATA endpoint can be queried for data. The following sample query fetches the GUID of the record with a phone number equal to 12345678:
https://yourorg.api.crm.dynamics.com/XRMServices/2011/OrganizationData.svc/ContactSet?$select=ContactId&$filter=Telephone1 eq '12345678'
Step 2:
Use the GUID fetched in Step 1 (if a record exists) to open the Contact form with a URL. The record will open directly in CRM by inserting the GUID in the following:
https://yourorg.crm.dynamics.com/main.aspx?etn=contact&pagetype=entityrecord&id=%7BGUIDhere%7D
As mentioned you can expand this process to query for different entity types and open the corresponding forms.
I have no experience with NAV.
I have to move Purchase Order data from one system, to NAV2009. I worked on the ETL part, and I have all the data to be moved to NAV ready. How do I import it to NAV?
This depends, of course, on where your data is stored and whether your license allows to write code / create new objects in NAV. But in any case, there are at least two tables that must be filled - "Purchase Header" and "Purchase Line". Probably, some other tables (like Document Dimension) might be required - depends on the data you need to transfer. It is not recommended to insert records directly into corresponding SQL Server tables, since there is a lot of C/AL code in NAV order tables that validates the data, so C/AL triggers must be executed.
This still leaves several options.
Write C/AL code that would read data from external source and insert records into purchase header and purchase line. This assumes that you have appropriate license permissions and some experience with NAV dev environment.
Create an XMLPort object if the data can be stored in XML format. Or a Dataport for csv-like files - this object is still available in 2009. Can be restricted by the license too. About NAV XMLPort objects and NAV Dataport objects
Publish purchase order pages as web services and insert records from a consuming application. Registering and consuming a web service in NAV 2009
I am working on a SSIS (2012) package that collects data from our till system to staging area and from staging area to CRM 2011 (on-premise | Roll up 11).
In CRM we have contact entity and order entity. These two entity are related via a guid called contactid(PK in contact) and customerid(FK in order).
when i insert new order in to CRM how do I ensure that the guid is created to associate that order to either a new contact or already existing contact?
I'm assuming since you're using SSIS your doing straight SQL inserts? If so, this is not supported. Ideally you'd be using the SDK, and in that case, you can set the GUID manually before actually creating the record, although the Contact Id still has to exist when creating the Order.
So you'll want to grab all of your existing Contacts up front, then determine for each order, if the contact exists or not. If it does, just set the customerId when you create the order and you're all set. If it doesn't, you'll need to create the Contact (potentially assigning it an Id), and then setting the customerId when you create the order.
I would echo what Daryl has said in that SQL inserts are not supported and generally a bad idea. However there is a solution, a company called Kingsway Soft make a SSIS component that allows you to read and write into CRM using the web services. The best part of it is that it is free if you don't want to run it using SQL agent. Even if you do want to schedule it the cost is very small for such an excellent product.
You can download it from here
http://www.kingswaysoft.com/products/ssis-integration-toolkit-for-microsoft-dynamics-crm