Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all 10032 articles
Browse latest View live

NAV dotnet and XDocument.Descendants

$
0
0
Hi

does anyone have a solution for the XDocument.Decendants function in NAV ?

in C#
var identity = xmlDoc.Descendants(XName.Get("Identity", "http://schemas.xmlsoap.org/ws/2006/02/addressingidentity")).FirstOrDefault();

that will return identity as XElement

Don't know how to do the .FirstOrDefault

Here is the code I have tried
OBJECT Codeunit 50437 Certificate Management
{
  OBJECT-PROPERTIES
  {
    Date=11.07.13;
    Time=11:06:45;
    Modified=Yes;
    Version List=BL7.00;
  }
  PROPERTIES
  {
    OnRun=BEGIN
            MESSAGE(GetServerCertificateValue('https://ws.b2b.is/Statements/20130201/BillService.svc'));
          END;

  }
  CODE
  {

    LOCAL PROCEDURE GetWsdlContent@1000000007(wsdlUrl@1000000000 : Text) wsdlContent : Text;
    VAR
      WebClient@1000000001 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.WebClient";
    BEGIN
      WebClient := WebClient.WebClient;
      wsdlContent := WebClient.DownloadString(wsdlUrl);
    END;

    LOCAL PROCEDURE GetServerCertificateValue@1000000021(ServiceUrl@1000000000 : Text) encodedValue : Text;
    VAR
      xmlDoc@1000000001 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XDocument";
      xName@1000000004 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XName";
      Enum@1000000010 : DotNet "'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Linq.Enumerable";
      Identities@1000000003 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Collections.Generic.IEnumerable`1";
      Identity@1000000005 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XElement";
      keyInfo@1000000007 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XElement";
      x509Data@1000000008 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XElement";
      x509Certificate@1000000009 : DotNet "'System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Linq.XElement";
      wsdlUrl@1000000006 : Text;
      wsdlContent@1000000002 : Text;
    BEGIN
      wsdlUrl := ServiceUrl + '?wsdl';
      wsdlContent := GetWsdlContent(wsdlUrl);
      xmlDoc := xmlDoc.Parse(wsdlContent);
      Identities := xmlDoc.Descendants(xName.Get('Identity','http://schemas.xmlsoap.org/ws/2006/02/addressingidentity'));
      Enum := Identities.GetEnumerator;
      //Identity := Enum.FirstOrDefault(Identities);
      IF ISNULL(Identity) THEN
        ERROR(STRSUBSTNO('Unable to Parse Identity from Wsdl Content, Url:{%1}',wsdlUrl));
      keyInfo := Identity.Element(xName.Get('KeyInfo', 'http://www.w3.org/2000/09/xmldsig#'));
      IF ISNULL(keyInfo) THEN
        ERROR(STRSUBSTNO('Unable to Parse keyInfo from Wsdl Content, Url:{%1}', wsdlUrl));
      x509Data := keyInfo.Element(xName.Get('X509Data', 'http://www.w3.org/2000/09/xmldsig#'));
      IF ISNULL(x509Data) THEN
        ERROR(STRSUBSTNO('Unable to Parse keyInfo/X509Data from Wsdl Content, Url:{%1}', wsdlUrl));
      x509Certificate := x509Data.Element(xName.Get('X509Certificate', 'http://www.w3.org/2000/09/xmldsig#'));
      IF ISNULL(x509Certificate) THEN
        ERROR(STRSUBSTNO('Unable to Parse keyInfo/X509Data/x509Certificate from Wsdl Content, Url:{%1}', wsdlUrl));
      encodedValue := x509Certificate.Value;
    END;

    BEGIN
    {
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.ServiceModel;
      using System.Xml.Linq;
      using System.Security.Cryptography.X509Certificates;
      using System.Net;

      /// <summary>
              /// Gets the content of the WSDL as string.
              /// </summary>
              /// <param name="wsdlUrl">The WSDL URL.</param>
              /// <returns></returns>
              private static string GetWsdlContent(string wsdlUrl)
              {
                  try
                  {
                      using (WebClient client = new WebClient())
                      {
                          var wsdlContent = client.DownloadString(wsdlUrl);
                          return wsdlContent;
                      }
                  }
                  catch (Exception ex)
                  {
                      throw new Exception(string.Format("Unable to Download Wsdl, Url:{0}, {1}", wsdlUrl, ex.Message), ex);
                  }
              }


      public static string GetServerCertificate(string address)
              {
                  var wsdlUrl = string.Concat(address, "?wsdl");
                  var wsdlContent = GetWsdlContent(wsdlUrl);
                  try
                  {
                      var xmlDoc = XDocument.Parse(wsdlContent);
                      var identity = xmlDoc.Descendants(XName.Get("Identity", "http://schemas.xmlsoap.org/ws/2006/02/addressingidentity")).FirstOrDefault();
                      if (identity == null)
                      {
                          throw new Exception(string.Format("Unable to Parse Identity from Wsdl Content, Url:{0}", wsdlUrl));
                      }
                      var keyInfo = identity.Element(XName.Get("KeyInfo", "http://www.w3.org/2000/09/xmldsig#"));
                      if (keyInfo == null)
                      {
                          throw new Exception(string.Format("Unable to Parse keyInfo from Wsdl Content, Url:{0}", wsdlUrl));
                      }
                      var x509Data = keyInfo.Element(XName.Get("X509Data", "http://www.w3.org/2000/09/xmldsig#"));
                      if (x509Data == null)
                      {
                          throw new Exception(string.Format("Unable to Parse keyInfo/X509Data from Wsdl Content, Url:{0}", wsdlUrl));
                      }
                      var x509Certificate = x509Data.Element(XName.Get("X509Certificate", "http://www.w3.org/2000/09/xmldsig#"));
                      if (x509Certificate == null)
                      {
                          throw new Exception(string.Format("Unable to Parse keyInfo/X509Data/x509Certificate from Wsdl Content, Url:{0}", wsdlUrl));
                      }
                      var encodedValue = x509Certificate.Value;
                  }
                  catch (Exception ex)
                  {
                      throw new Exception(string.Format("Unable to Parse Wsdl Content, Url:{0}, {1}", wsdlUrl, ex.Message), ex);
                  }
                  return encodedValue;
              }
    }
    END.
  }
}


NAV 2017 Phone client on Android type / edit problem

$
0
0
Hello guys,
Here all the details about issue I found few days ago:

NAV Version:
NAV 2017

Where:
Android universal (phone) app, Chrome browser (Samsung Internet application is OK) using .WebClient\phone.aspx link; Android version is 7.0. I tested with almost 10 devices and only 3 of them was OK. iOS devices are OK as also Samsung Internet browser.

Description:
When try typing or selecting an option(basically try to edit anything) in edit mode in all pages the application is not showing the entered values. It is inserting the value but the text box just stay white (not able to see anything) and no cursor is displayed. You can not understand what you have entered until you save the record and open in view mode. You can see in the attachment that the text is there just it is not visible. It is like some font or content issue on the phone. I tried Reset All Settings, played a lot with chrome browser settings but it didn't help. I did not found any similar issues in the net, just one guy was left a feedback on the Dynamics NAV application in Google play a feedback mentioning that problem and suggesting a Factory Reset, but I didn't try Factory Reset since it will delete all data on the phone and obviously it is not a solution.

e5a100xtcnbw.png



The phone app was working for almost a year already without problems. I noticed that problem few days ago.


Thanks in advance!

Kind Regards,
Nikolay

Error when renaming G/L account

$
0
0
Hello Everyone !

I was trying to rename a G/L account when I got this Error message:

nz5m3kbs10lx.jpg

The G/L account that I'm trying to rename is having lots of transactions. Is that a possible reason for the error mentioned above ? and how can we resolve it ?

It's Dynamics NAV 2016 version btw.

Thank you for your cooperation.
Best Regards

Upgrade NAV2018 Webclient

$
0
0
Hi,

Now that CU1 for NAV2018 has been released, I would like to upgrade all software. Server and RoleTailored client go without a problem, but I run into issues with the webclient. What I used to do is copy all files (except .config files) from the DVD to the directory where the client is installed. Restart IIS, and everything is fine. However, this does not work with NAV2018.

The first thing I found is that navsettings.json should not be copied, as it holds the settings on how to connect to the middletier. I'm not sure about the other .json files, but I did not copy them either, just to be sure. I get into the login screen (I'm using UserName authentication), but then there is the message "An error has occurred". I checked the applicationlog, and for sure, there is an error: It is pointing to the directory c:\inetpub\wwwroot\dynamicsNAV110\wwwroot\resources\extractedresources, and then wants to load the file "1033_11.0.19846.0_NavigationGroup_Home.png". However, that file is nowhere to be found. The file 1033_11.0.19394.0_NavigationGroup_Home.png is available, apparently from the former installation.

I could ofcourse rename all files with some commandline/powershell magic, but I would rather copy the files from the DVD. However, there, I cannot find them. Where are those files, or how can I create them?

Error Malformed URI is embedded as a hyperlink in the document when selecting excelsheet

$
0
0
Hi, I have a report where you can choose an Excel file to import. The Excel file contains several sheets. So the user has the possibility to select one of the sheets.
I use the function SelectSheetsName from the table 370 Excel Buffer.
The C/AL code XlWrkBkReader := XlWrkBkReader.Open(FileName) gives the following error:

A call to Microsoft.Dynamics.Nav.OpenXml.Spreadsheet.WorkbookReader.Open failed with this message: The Microsoft Excel workbook cannot be opened. This may be caused by one of the following reasons:
1. The path to the file is a web address. You must navigate to the file by using the Open File dialog box, or you can save the file locally and then open it.
2. The workbook is not saved in the Open XML file format. In Microsoft Excel, save the workbook as an Excel workbook (.xlsx file), and then try your request again.
The following error occurred: Invalid Hyperlink: Malformed URI is embedded as a hyperlink in the document..


The Excel file contains different kind of e-mail adresses on some other worksheets. Unfortunately it is not possible to delete these worksheets. The customer needs them.

Who has an idea how to solve this issue, by using other code, perhaps with an excel dotnet variable.

VSCode: Could not publish the package to the server

$
0
0
Hi all,
I've just started my first steps with development in vscode, but currently facing a problem with the deployment I can't get around.

I have a NAV 2018 instance available on a local server
I've installed vscode and the AL Language Extension, Version 0.12.15355
I've created the HelloWorld demo project from the AL!GO template
I was able to download symbols from my local server instance so the compiler does resolve references and does not show any compile errors anymore.

But when I finally try to deploy the demo extension to my local server using F5 or Ctrl+F5, I receive the following error:
"Error: File h:\Work\ALProjects\TestATO001\MyCompany_TestATO001_1.0.0.0.app does not exist".

Run Build Task (Ctrl+Shift+B) returns the message "No build Task to run found."
I assume there's a piece missing in my build and deployment procedure but I cannot locate the issue.

Any hints what's missing here ?

Many thanks in advance
AndrewT


My launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"type": "al",
"request": "launch",
"name": "NAV 2018 BASELINE",
"server": "http://MyLocalAPPServer",
"port": 9002,
"serverInstance": "EMEA-BASELINE-110-DE",
"tenant": "default",
"authentication": "Windows",
"startupObjectId": 22
}
]
}

My app.json file:
{
"id": "ba7bf685-bd53-442f-bf0e-3290ef57dd7e",
"name": "TestATO001",
"publisher": "MyCompany",
"brief": "",
"description": "",
"version": "1.0.0.0",
"compatibilityId": "1.0.0.0",
"privacyStatement": "",
"EULA": "",
"help": "",
"url": "",
"logo": "",
"capabilities": [],
"dependencies": [],
"screenshots": [],
"platform": "11.0.0.0",
"application": "11.0.0.0",
"idRange": {
"from": 50100,
"to": 50149
}
}

Wild card SSL Certificate

$
0
0
Hello,

Anyone can guide me how to use Wild card certificate for NAV USER PASSWORD setting ,webclient and Odata?

Thank you.

Report 2013 not shows all the data

$
0
0
This happends me sometimes, normally increasing the space for the variable in the layout its enought, but today not.

When I try to print a report with the Preview option I dont have any problem, but with the option Print -> PDF(for example) the report seems to skip some variable from report...

This is the report.
mv89m13j6uep.png


With the Preview Option
l6h2ndbiw2az.png


With the option (Print -> PDF) or (Preview -> print layout)
wfl6tlnmcuqd.png

tzt9iyi6ssfw.png

ku4uhbz5u09z.png

How can i use java to integrate with Microsoft dynamics nav to return json for a mobile application?

$
0
0
I want to achieve creating a custom mobile application for nav hr

TRANSFER OF FIXED ASSET TO VENDOR LOCATION

$
0
0
I WANT TO TRANSFER ONE FIXED ASSET TO VENDOR PLACE LOCATED IN THE OTHER STATE FOR REPAIRING PURPOSE. PLEASE SUGGEST ENTRIES

Using "FindNodes" function from CU 6224

$
0
0
hi everyone,
I'm having a small isuue using the "FindNodes" function.

I get an XML like this:

2ceowdceawsp.png

I have to get all the "depotCode" nodes in one list. I was firstly using
XMLDomMgmt.FindNodes(locautXmlDoc,'//labelResponse/consignment/consignmentLabelData/transitDepots/transitDepot/depotCode',xmlNodeList);

but I was loosing the node under "sortDepot". I tried to use
XMLDomMgmt.FindNodes(locautXmlDoc,'//labelResponse/consignment/consignmentLabelData/transitDepots/../depotCode',xmlNodeList);

But of course, I don't get anything, because there are no ".." nodes.
Is there any way to map together all the nodes under "transitDepot" and "sortDepot" ? They should be toghether, becasue i have to take them in order...

Thnak you very much

NAV2015 Debugger

$
0
0
When starting the debugger (page9504) I get this error message "Microsoft Dynamics NAV
Method 'Page9504.CodeViewera58a58AddInReady(No. of arguments: 0) with corresponding argument types.' not found.

If i connect to another database it works great - So it's not a installation issue

NAV2017 T36 Sell-To Customer Name unexpected behavior

$
0
0
Sell-to Customer Name - OnValidate()
VALIDATE("Sell-to Customer No.",Customer.GetCustNo("Sell-to Customer Name"));

Right, so now you can never change the customer name on an order on an invoice in case you want to use a share customer account, like "Cash & Carry" or "Staff Purchase" or "Webshop" because it is always interpreted as changing the Customer No.? Seriously, Microsoft?

Now I have to go and change the table behavior and the pages (because they are not showing the Customer No. anymore) back to NAV2017

Seriously. Did anyone think this through?

Split-NAVApplicationObjectFile & ObsoleteState

$
0
0
Hi

I've run the Split-NAVApplicationObjectFile on a text file containing all of the files from NAV2018CU1 (GB) and I get the following error:

WARNING: C:\NAV Releases\NAV2018\NAV2018CU1\NAV2018CU1 All Objects.txt (5105,65) ObsoleteState is not valid property for Field.
WARNING: C:\NAV Releases\NAV2018\NAV2018CU1\NAV2018CU1 All Objects.txt (7963,65) ObsoleteState is not valid property for Field.
WARNING: C:\NAV Releases\NAV2018\NAV2018CU1\NAV2018CU1 All Objects.txt (10635,65) ObsoleteState is not valid property for Field.

There's actually over 100 of them.

Does anyone know how to resolve this so I can extract all of the files. The missing tables include 18, 27 and 36 so are fairly important to me :-)

BTW, I've tried using -Force and it made no difference.

Cheers

Chris

Generate Azure Service Bus SAS Token

$
0
0
I'm trying to generate a SAS Token from Dynamics NAV 2018 using DotNet. I have a working code in PowerShell what I've been using for testing:
$epoch = Get-Date -Date "1970-01-01 00:00:00Z"
$epoch.ToUniversalTime() | Out-Null

$utcNow = Get-Date
$utcNow.ToUniversalTime() | Out-Null

$sinceEpoch = New-TimeSpan -Start $epoch -End $utcNow
$expiry = [System.Convert]::ToString([int32]$sinceEpoch.TotalSeconds + 3600)
$stringToSign = [System.Web.HttpUtility]::UrlEncode($resourceUri) + "`n" + $expiry
$hamcsha = New-Object System.Security.Cryptography.HMACSHA256
$hamcsha.Key = [Text.Encoding]::UTF8.GetBytes($key);
$signature = [System.Convert]::ToBase64String($hamcsha.ComputeHash([Text.Encoding]::UTF8.GetBytes($stringToSign)))
$token = [System.String]::Format([System.Globalization.CultureInfo]::InvariantCulture,"SharedAccessSignature sr={0}&sig={1}&se={2}&skn={3}",[System.Web.HttpUtility]::UrlEncode($resourceUri),[System.Web.HttpUtility]::UrlEncode($signature),$expiry,$keyName);

here is the C/AL code but I get (401) Unauthorized and the token looks a bit different
Epoch := CREATEDATETIME(DMY2DATE(1,1,1970),000000T);
SinceEpoch := ( CURRENTDATETIME - Epoch ) / 1000;
Expiry := Convert.ToString(ROUND((SinceEpoch + 3600),1,'<'));
StringToSign := HttpUtility.UrlEncode(AzureServiceBusQueue.URL) + Environment.NewLine + Expiry;
HMACSHA256 := HMACSHA256.HMACSHA256(Encoding.UTF8.GetBytes(AzureServiceBusQueue.Key));
Signature := Convert.ToBase64String(HMACSHA256.ComputeHash(Encoding.UTF8.GetBytes(StringToSign)));
Token := Convert.ToString(STRSUBSTNO('SharedAccessSignature sr=%1&sig=%2&se=%3&skn=%4',
                                  HttpUtility.UrlEncode(AzureServiceBusQueue.URL),
                                  HttpUtility.UrlEncode(Signature),
                                  Expiry,
                                  AzureServiceBusQueue."Key Name"),
                               CultureInfo.InvariantCulture);

the DotNet variables are:
AzureServiceBusQueue@1000000001 : Record 54000;
HttpUtility@1000000005 : DotNet "'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Web.HttpUtility";
HMACSHA256@1000000007 : DotNet "'mscorlib'.System.Security.Cryptography.HMACSHA256";
Convert@1000000008 : DotNet "'mscorlib'.System.Convert";
Encoding@1000000009 : DotNet "'mscorlib'.System.Text.Encoding";
CultureInfo@1000000012 : DotNet "'mscorlib'.System.Globalization.CultureInfo";
Environment@1000000014 : DotNet "'mscorlib'.System.Environment";

If I try the token generated by the C/AL code in the PowerShell script I get the same result : (401) Unauthorized
Any ideas?

Android Mobile Application: HOTFIX ENCLOSED

$
0
0
I've been working with Microsoft Support team (big shoutout to Mohamad Vajid and Duilio Tacconi who got me the fix to try same day) on this one.

Since the update for the Android App came out on December 11, version 2.5.19628, all our customers on Android phones are reporting that when ANY pages are open in Edit Mode, the text inside controls is invisible (looking blank). You cannot see the contents, not even while typing them. The text is THERE, as you can select it, copy and paste it. This occurs on a variety of Android devices.

(Screenshot on this thread, thanks Nikolay)

This affects NAV 2015, NAV 2016, and NAV 2017.

In updating the mobile application for newer Android, something in the CSS interpretation was no longer handling things quite correctly, so there is new CSS. The fix I tried and has worked is this:
1. Locate CSS files (Desktop.css, Phone.css, Tablet.css) in the Web Client folder. (Typically C:\Program Files\Microsoft Dynamics NAV\100\Web Client\Resources )

2. For every CSS file replace the following

OLD:
---
.android-multi-columns-layout .edit-container{-webkit-transform:translateZ(0);transform:translateZ(0)}

NEW
---
.android-multi-columns-layout .edit-container{-webkit-transform-style: preserve-3d;transform-style: preserve-3d;}

NOTE: No need to restart IIS (no need to iisreset).

I did have to close/reopen the NAV application on the Android device.

NAV on Android Phone

$
0
0
Hello,
I'm testing the phone app on Android (7.1.1 and 7.1.2) in combination with NAV 2017 CU11. I have a strange problem: when editing a page, like the customer page, all the entered information disappears. I have tested this on various phones with Android 7.1.1 and 7.1.2, and all have the same problem. I also tested this on a windows phone, and there it works fins (as expected :smile: )
I attached 2 print screens where the issue is shown
Is this some setting on the web client, IIS, NAV, Android, ... ?
I have surfed to the URL on the phone, and this gives the same result.

Any ideas?

itwhv66ulp2z.png
63oduztz2t35.png

Kind regards,
Andy

Dynamics Nav and Data Director Processor Thread Use

$
0
0
Hi,

Can anyone know how many Thread user for Dynamics Nav and Data Director

Regards

Error occurred while post consumption journal of BOM components

$
0
0
Hello guys,

Here's a serious issue for one of our customer that they've faced the error message when they tried to post consumption of components.

After checked by our side, the error came from data setup which they did not setup for the Inventory posting group of parent item(Output item).

We had explained this issues to the customer but they mentioned to the Navision 5.0 that they were able to post consumption of each BOM's components without setup for the Inventory posting group of parent item(Output item) but now they can't make it on latest Dynamics NAV version NAV 2017 (see error in attached) with same configuration and data.

They would like to know the reason why the error came from Consumption Journal not Output Journal screen and they would like to get some reference document from Microsoft to explain the reason and confident that after posted it will not effect to the G/L Account with the wrong costing later.

Is there any reference or document that can make them confident on this change? Please suggest.9yg386nuwxhq.jpg

Sending Email (Html Code) - using SMTP

$
0
0
Hello, We created a New report and wrote the attached Code to send Email certain data to one user.
6h4v8uja8cml.png

Attached is the SMTP setting on our NAV server.
xpi41dfpt0x9.png

However, we executed the report, we got the error
Microsoft Dynamics NAV

The SMTP mail system returned the following error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [KL1PR0601CA0015.apcprd06.prod.outlook.com]".

Viewing all 10032 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>