Hi Palle Arentoft, Thank you for your suggestion. I will surely contact LS.
↧
Forum Post: RE: Kitchen display monitor setup for NAV2013R2
↧
Forum Post: RE: Kitchen display monitor setup for NAV2013R2
Hi Damjan, Thank you for your support. can you please suggest where can i get a copy of Display Station application ? Regards Nayan
↧
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
Hello, Program looks Ok. only you need to check if the filter is correct at line4 i.e., ImpDetails.SETRANGE(ImpDetails."No.","No."); ,"No." check if there is a value in debugger. Also, Make sure that the record variables are not Temporary. Rgs, Sami Mohammed.
↧
Forum Post: RE: Kitchen display monitor setup for NAV2013R2
Again, you have to contact LS retail - You can get instant help using their own portal https://portal.lsretail.com
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
Hello, there are several potential issues in your code These two lines might stop your code: ImpDetails.TESTFIELD("Global Dimension 3 Code"); ImpDetails.TESTFIELD("Budget Name (Accrued Budget)"); is ImpDetails."Request Amount" a flowfield then you need to calculate it. And finally your long IF THEN ELSE IF .... its not a bug - but you should REALLY take a look at CASE-sentences you code becomes way easier to read. the sentence IF Commits.FINDLAST THEN makes no sense at all EIther you should change it to IF Commits.FINDLAST THEN ; or change your code so the next line is always executed ( ImpDetails.RESET;) <-- this line is only executed if a record in commits exists. Also a general refactoring of your code should be done.
↧
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
The imprest tables contains two tables: ImpDetails (Variable) = Imprest details ("No." is the primary key) and ImpHeader = Imprest Header ("No." is the primary key). There is a value in during debugger.
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
The problem is between line 34 to 52
↧
Blog Post: Tips & Tricks: Going full screen with control add-ins in BC150
Long time no see here, for I don’t know which time. That’s how it is these days, life kicks in, work kicks in, stuff kicks in, and then time flies and months go between posts here. I am currently delivering my “Developing Control Add-ins using AL language” workshop at the first pre-conf day of NAV TechDays 2019, and while my group is busy developing their control add-in, I decided to answer the question I got five minutes ago: “can we please have this piece of code”? So, here it goes. This little trick will allow you to go full screen with your control add-in in BC150. Having a full-screen control add-in is not something that you can do with just setting properties on your controladdin object, but it’s absolutely possible. Also, this is not something you can only do with BC150 – as a matter of fact you can do it in every single version of the Business Central or Dynamics NAV web client (or tablet, or phone client for that matter). However, every single client and every single version has a different overall HTML structure, so this particular trick applies to BC150. It may work on 140, it may work on 160 in the future, but it also may not. The principle is the same, though: you hide unnecessary screen elements, and you make your control add-in iframe element full width and full height, and that’s it. This is what your controladdin object must declare: And then, this is what your control add-in initialization JavaScript code should do (typically you’d put this into your startup script): function initialize() { function fill(frame) { if (!frame) return; frame.style.position = "fixed"; frame.style.width = "100vw"; frame.style.height = "100vh"; frame.style.margin = "0"; frame.style.border = "0"; frame.style.padding = "0"; frame.style.top = "0"; frame.style.left = "0"; frame.ownerDocument.querySelector("div.nav-bar-area-box").style.display = "none"; frame.ownerDocument.querySelector("div.ms-nav-layout-head").style.display = "none"; } window.top.document.getElementById("product-menu-bar").style.display = "none"; fill(window.frameElement); fill(window.frameElement.ownerDocument && window.frameElement.ownerDocument.defaultView && window.frameElement.ownerDocument.defaultView.frameElement); } And that’s it. Good luck full-screening! Read this post at its original location at http://vjeko.com/tips-tricks-going-full-screen-with-control-add-ins-in-bc150/ , or visit the original blog at http://vjeko.com . 5e33c5f6cb90c441bd1f23d5b9eeca34 The post Tips & Tricks: Going full screen with control add-ins in BC150 appeared first on Vjeko.com .
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
what is about 2 line - "IF Commits.FINDLAST THEN ; " next, "Commits."Entry No" := Commits."Entry No" + 1;" - if you have INIT, the 1 value for Entry No. will be 0 next, instead of "ImpDetails.TESTFIELD("Global Dimension 3 Code"), ImpDetails.TESTFIELD("Budget Name (Accrued Budget)");" and "ImpDetails.TESTFIELD("Account No");" - use the filtering and you can avoid the run-time errors P.S. it is fast overview (the code a little strange) and if you don't solve the till evening, I will try to rewrite code
↧
↧
Forum Post: RE: Transferfields command using with multiple linked tables
it is not the same for code - you use "another instance"
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
I appreciate your reply. When I debugged, CommitReg2."Budget Balance" is equal to zero. Let me rewrite the code and get back to you. Thanks.
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
After I rearrange the code. The code did not get the last value but did the below commitReg2.RESET; commitReg2.SETFILTER("Account No",ImpDetails."Account No"); commitReg2.SETFILTER("Department Code",ImpDetails."Global Dimension 3 Code"); commitReg2.SETFILTER("Budget Name (Accrued Budget)",ImpDetails."Budget Name (Accrued Budget)"); commitReg2.SETRANGE("Property Code",ImpDetails."Budget Dimension 2 Code"); //IF commitReg2.COUNT = 0 THEN BEGIN IF commitReg2.ISEMPTY THEN BEGIN GLBudget.RESET; GLBudget.SETRANGE("G/L Account No.",ImpDetails."Account No"); GLBudget.SETRANGE("Budget Dimension 1 Code",ImpDetails."Global Dimension 3 Code"); //Name: IB, Date: 07/07/2019 GLBudget.SETRANGE("Budget Dimension 2 Code",ImpDetails."Budget Dimension 2 Code"); //Name: IB, Date: 07/07/2019 GLBudget.SETRANGE("Budget Name",ImpDetails."Budget Name (Accrued Budget)"); //Name: IB, Date: 07/22/2019 GLBudget.CALCSUMS(Amount); Commits."Budget Balance" := GLBudget.Amount - ImpDetails."Request Amount"; END instead of this code IF commitReg2.FINDLAST THEN Commits."Budget Balance" := commitReg2."Budget Balance" - ImpDetails."Request Amount";
↧
Blog Post: Microsoft.Dynamics.NAV.InvokeExtensibilityMethod
Now that you are done through this mouthful of the title, you may recognize that it’s the method you invoke when you want to run a control add-in trigger in AL from JavaScript. There is nothing new about this method itself, it’s just that most people aren’t aware of full power of this method, and they are using this method in a very inefficient way. In this blog, I want to show you what this method can do for you that you may have not been aware of. And I hope I get you to change your habits. The syntax is this: Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(name, args[, skipIfBusy[, callback]]); It takes at minimum two arguments, and this is what most people invoke it. Obviously, name is the name of the event as declared in the controladdin object that you also must implement as a trigger inside the usercontrol in the page that uses it. Also, args is the array of arguments you want to pass to AL. Imagine this is how you declare your event: event SayHello(FirstName: Text; LastName: Text); Then from JavaScript you would invoke it like this: Microsoft.Dynamics.NAV.InvokeExtensibilityMethod("SayHello", ["John", "Doe"]); So far, very simple, obvious, and easy. But here we get to the biggest mistake most people do when invoking the Microsoft.Dynamics.NAV.InvokeExtensibilityMethod method. They invoke it directly. The reason why it’s a mistake is because most often you’ll want to synchronize the invocations between JavaScript and AL as much as you can, and this method – as anything in JavaScript that invokes stuff outside JavaScript – is asynchronous. If you have this: Microsoft.Dynamics.NAV.InvokeExtensibilityMethod("SayHello", ["John", "Doe"]); alert("You see me immediately"); … you will see the “You see me immediately” message before AL even gets a chance to start executing. Yes, you can take advantage of more arguments here to make it behave differently. So, let’s take a look at the remaining two arguments. The skipIfBusy argument tells the control add-in JavaScript runtime to not even invoke your event in AL if the NST session is currently busy doing something else. If you omit it, the skipIfBusy parameter defaults to false so it means your AL event will be raised, and if AL is already busy, it will be raised as soon as AL stops being busy. The callback argument, though, is where cool stuff happens. This arguments is of function type (you can imply as much from its name), and it is invoked as soon as AL has finished doing whatever you just made it busy with. So, if you want some JavaScript code to happen after the SayHello event completes its work, you can do it like this: Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( "SayHello", ["John", "Doe"], false, function() { alert("You see me after SayHello finished running in AL"); }); However, that’s not really the most beautiful way of writing JavaScript. That’s how you would write it in late 1990’s, we are now nearly a quarter century ahead. Let’s write some at least tiny little bit less outdated JavaScript, and let’s introduce Promises . Promises are objects which allow you to synchronize asynchronous calls in a syntactically less offensive way than callbacks. Let’s take a look at why promises are superior to callbacks. Imagine you want to structure your code nicely, and you don’t want to just call your extensibility methods out of a blue, so you decide to wrap your call into a function, like this: function sayHello(first, last, callback) { Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( "SayHello", [first, last], false, callback); } // Invoking the function sayHello("John", "Doe", function() { alert("You see me after SayHello finished running in AL"); }); The syntax of the sayHello invocation is not really that easy to follow. However, we could translate the entire example to promises: function sayHello(first, last) { return new Promise(resolve => Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( "SayHello", [first, last], false, resolve)); } // Invoking the function sayHello("John", "Doe") .then(() => alert("You see me after SayHello finished running in AL")); … and suddenly it becomes more readable. (Okay, a part of it being more readable is that I used arrow functions , but that’s because they are both supported at the same language level of JavaScript, and if your browser supports Promises, it will support arrow functions too, and if it doesn’t support Promises, it won’t support arrow functions either). Apart from this readability benefit, there is another, far bigger benefit of wrapping your Microsoft.Dynamics.NAV.InvokeExtensibilityMethod invocations into promise-returning wrapper functions: it’s the fact that all promises are awaitable in JavaScript. In newer versions of JavaScript (EcmaScript 2017 and newer) there is a concept of async functions . Async functions perform some asynchronous work, and you can await on them to make your code look and behave as if it were synchronous. For example, if you have a function declared as this: async function somethingAsync() { // Do some asynchronous work } … then you can invoke it like this: await somethingAsync(); alert("This won’t execute before somethingAsync completes its async work"); Cool thing about async/await is that it’s nothing more than syntactic sugar for Promises. Every async function implicitly returns a Promise, and you can invoke it either with await syntax, or with .then() syntax. Cosenquently, if a function explicitly returns a Promise, you can await on it as if it were declared as async. In short, in our earlier example, we could easily do this: function sayHello(first, last) { return new Promise(resolve => Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( "SayHello", [first, last], false, resolve)); } // Invoking the function await sayHello("John", "Doe"); alert("You see me after SayHello finished running in AL"); … and it would have exactly the same meaning as the earlier example, except that this time it’s far more readable. At this stage, our sayHello function is a handy asynchronous wrapper around Microsoft.Dynamics.NAV.InvokeExtensibilityMethod method invocation, but we can do better than that. Instead of having to write wrappers for every single event declared in your controladdin object, you could write something like this: function getALEventHandler(eventName, skipIfBusy) { return (…args) => new Promise(resolve => Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( eventName, args, skipIfBusy, resolve)); } When you have that, you can use it like this: // Obtain a reference to an asynchronous event invocation wrapper var sayHello = getALEventHandler("SayHello", false); // … and then use it as an asynchronous function await sayHello("John", "Doe"); alert("You see me after SayHello finished running in AL"); Cool, isn’t it? You now not only never have to write that wordy Microsoft.Dynamics.NAV.InvokeExtensibilityMethod ever again (and risk making typos), you also have it fully synchronizable using the await syntax. But we can get even cooler – way cooler – than that. Hold my beer. You know already that event invocations in AL are void , or that they cannot ever return a value. Your JavaScript cannot invoke AL and have AL return a value to it, that’s just not how AL/JavaScript integration works. At the heart it’s because it’s all asynchronous, but at the end of it, it’s just because Microsoft never cared enough to make it fully synchronized through an abstraction layer that could make it possible. Now that we’ve got it to an awaitable stage, let’s take it to another level by allowing AL to actually return values to your JavaScript wrappers. Imagine that you declare this event in your controlladdin: event GetCustomer(No: Code[10]); You pass a customer number to it, and you want it to return a JSON object containing your customer record information by its primary key. Ideally, you’ll want to invoke it like this: var cust = await getCustomer("10000"); Of course, that won’t work, because your GetCustomer trigger in AL – once you implement it in a page – cannot return values. You’d have to have a method declared in your controladdin object and then implement that method in the global scope in JavaScript, where you can pass the result of this operation, something you’d declare like this: procedure GetCustomerResult(Cust: JsonObject); However, implementing it as a separate function in your JavaScript would require some acrobatics to allow you to retain your await getCustomer() syntax. But this is only true if you take the traditional approach of implementing methods as global-scope-level functions in one of your scripts. In JavaScript, you can implement methods on the fly, so let’s do it. Let’s start with the statement that the GetCustomerResult function should be available in JavaScript only during the invocation of GetResult event in AL, and invoking it outside of such invocation would be a bug, and should not be allowed. When you do it like this, then you can write your code in such a way that you create this function in JavaScript just before you invoke the AL event, and you delete this function immediately when AL returns the result, something like this: function getALEventHandler(eventName, skipIfBusy) { return (...args) => new Promise(resolve => { var result; var eventResult = `${eventName}Result`; window[eventResult] = alresult => { result = alresult; delete window[eventResult]; }; Microsoft.Dynamics.NAV.InvokeExtensibilityMethod( eventName, args, skipIfBusy, () => resolve(result)); }); } You can then do something like this: // Obtain a reference to an asynchronous event invocation wrapper var getCustomer = getALEventHandler("GetCustomer", false); // … and then use it as an asynchronous function var cust = await getCustomer("10000"); alert( Your customer record is ${JSON.stringify(cust)} ); How cool is this? There is an even further level of awesomeness you can add to your event invocations, and it has to do with the skipIfBusy argument, but that’s a topic for a future blog post, I think you have enough to chew on for now. And I know that at this stage, invoking Microsoft.Dynamics.NAV.InvokeExtensibilityMethod directly, instead of through a pattern such as this, seems very stone age. Read this post at its original location at http://vjeko.com/microsoft-dynamics-nav-invokeextensibilitymethod/ , or visit the original blog at http://vjeko.com . 5e33c5f6cb90c441bd1f23d5b9eeca34 The post Microsoft.Dynamics.NAV.InvokeExtensibilityMethod appeared first on Vjeko.com .
↧
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
Sorry, but I don't understand what last value you want to find. Just use the code here and inform the line, where do you want to find this value? + Exclude any Testfield lines by using the IF .. THEN .. ELSE Commits.RESET; IF Commits.FINDLAST THEN CommitsEntryNo := Commits."Entry No" + 1 ELSE CommitsEntryNo := 1; ImpDetails.RESET; ImpDetails.SETRANGE(ImpDetails."No.","No."); IF ImpDetails.FINDSET THEN BEGIN REPEAT Commits.INIT; Commits."Entry No" := CommitsEntryNo; CommitsEntryNo += 1; Commits."Document No" := ImpDetails."No."; Commits."Beneficiary Name" := Payee; ImpDetails.TESTFIELD("Global Dimension 3 Code"); //??? check & change it moving to Filter-part ImpDetails.TESTFIELD("Budget Name (Accrued Budget)"); //??? check & change it moving to Filter-part Commits."Department Code" := ImpDetails."Global Dimension 3 Code"; IF ImpDetails."Request Amount" <> 0 THEN Commits.Amount := ImpDetails."Request Amount"; //Start: Check for the account no ImpDetails.TESTFIELD("Account No"); Commits."Account No" := ImpDetails."Account No"; Commits.Expenses := ImpDetails.Expense; //Start: Check Budget Dimension 2 Code = Property Code is not equal to empty IF (ImpDetails."New Type" = ImpDetails."New Type"::"Capex Codes") THEN ImpDetails.TESTFIELD("Budget Dimension 2 Code"); Commits."Property Code" := ImpDetails."Budget Dimension 2 Code"; //Name:IB Date:07/07/2019 Commits."Budget Name" := Rec."Budget Name (Accrued Budget)"; //End: Check // commute budget balance commitReg2.RESET; commitReg2.SETFILTER("Account No",ImpDetails."Account No"); commitReg2.SETFILTER("Department Code",ImpDetails."Global Dimension 3 Code"); commitReg2.SETFILTER("Budget Name (Accrued Budget)",ImpDetails."Budget Name (Accrued Budget)"); commitReg2.SETRANGE("Property Code",ImpDetails."Budget Dimension 2 Code"); IF commitReg2.FINDLAST THEN Commits."Budget Balance" := commitReg2."Budget Balance" - ImpDetails."Request Amount" ELSE BEGIN GLBudget.RESET; GLBudget.SETRANGE("G/L Account No.",ImpDetails."Account No"); GLBudget.SETRANGE("Budget Dimension 1 Code",ImpDetails."Global Dimension 3 Code"); //Name: IB, Date: 07/07/2019 GLBudget.SETRANGE("Budget Dimension 2 Code",ImpDetails."Budget Dimension 2 Code"); //Name: IB, Date: 07/07/2019 GLBudget.SETRANGE("Budget Name",ImpDetails."Budget Name (Accrued Budget)"); //Name: IB, Date: 07/22/2019 GLBudget.CALCSUMS(Amount); Commits."Budget Balance" := GLBudget.Amount - ImpDetails."Request Amount"; END; CASE "Advance Type" OF "Advance Type"::"Touring Advance" : Commits.Purpose := COPYSTR("Purpose/ Destination",1,100) "Advance Type"::"Cash/Purchase Advance" : Commits.Purpose := COPYSTR("Purpose of Request",1,100) "Advance Type"::Imprest : Commits.Purpose := COPYSTR("Purpose of Request1",1,100) "Advance Type"::"Payment Request" : Commits.Purpose := COPYSTR("Purpose of Request2",1,100) "Advance Type"::"Staff Claim" : Commits.Purpose := COPYSTR("Purpose of Request3",1,100); END; Commits.INSERT(TRUE); UNTIL ImpDetails.NEXT = 0;
↧
Forum Post: RE: Error while viewing Statistics of Sales Order in BC on Cloud
Could it be Invoice Discount being triggered and trying to creat the additional order line?
↧
Forum Post: RE: Supply Planning - Prioritization from multiple sources
Using Stock Keeping Units you can only define whether to supply through purchase or transfer. So it cannot be transfer if possible to supply, or else purchase. I would suggest always to transfer from RED to BLUE and also to use transfer from VENDOR to RED when there is demand.
↧
Forum Post: Error on upgrade NAV2016 CUM3 to 365BC SPRING CUM4
I am trying to upgrade a NAV2016 *** 3 database to 365BC Spring *** 4 database. I follow the MS description as found here, https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/upgrading-the-data#UploadLicense Everything works fine until Task 11, Synchronization. It runs for a short while and then ends with the following error: "Sync-NAVTenant : A dead connection cannot be brought back to the livings" Database size is 85GB. It should not be a SQL command timeout because I increased it. I have tried the process on four different machines and get the same result. Using SQL Server 2014. The NAV2016 database works fine and operational. I can compile all objects and synchronize before I start the upgrade.(I have attached screenshot with here) Do you have any ideas?
↧
↧
Forum Post: RE: Error on upgrade NAV2016 CUM3 to 365BC SPRING CUM4
Have you changed the SQL Command Timout from 00:30:00 to 23:59:59 on the servicetier? (I have had the same error but changing it to 23:59:59 solved it for me)
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
I appreciate you but the CommitsReg gave zero when I debugged it. It was given budget balance This code is not working and it meant to check the last budget balance commitReg2.RESET; commitReg2.SETFILTER("Account No",ImpDetails."Account No"); commitReg2.SETFILTER("Department Code",ImpDetails."Global Dimension 3 Code"); commitReg2.SETFILTER("Budget Name (Accrued Budget)",ImpDetails."Budget Name (Accrued Budget)"); commitReg2.SETRANGE("Property Code",ImpDetails."Budget Dimension 2 Code"); IF commitReg2.FINDLAST THEN Commits."Budget Balance" := commitReg2."Budget Balance" - ImpDetails."Request Amount" Thanks
↧
Forum Post: RE: How to get the last value in a table in dynamics nav
Again, you never answered is the "Budget Balance"-field a FIeldClass = FlowField ?? If so you ned to do a CALCFIELDS("Budget Balance" )
↧