Hi guys!

This week I went through a really interesting problem, one of my clients was tired of having to use the recalculate button in Quotes and Orders, so he asked if we could automatize that process.

After several weeks of analysis, thousands of papers in the bin and millions of coffees… I came up with a solution, to be honest it was 1 hour, 1 coffee and 1 paper but I need to let them think that it was really complicated 😉

I saw that when the users click on the recalculate button, the form reloads, so I added a new product to a Quote and I press F5 to see what happens. Good News it got recalculated, so the only thing I needed to do was to refresh the Quote Form when something happens in the quote products.

My first approach was to create a JavaScript in the Quote Product Form to refresh the parent window (The Quote Form) on Save of the product.

Something like this:

This easy script worked perfectly when I added a new product line to the Quote or when I modified a product line. But when I deleted the line, the Quote form was not refreshed. That was a problem!!

So I went back to the critical moments of coffee, pen and paper, after doing a deep search using Bing (J) I found the following blog:


It was the perfect solution so I quickly implemented it and tested….but it didn’t work….

The code was failing in the following line when loading the form:

function ContactLoad()
var grid = document.getElementById(“ExamResults”);
grid.attachEvent(“onrefresh”, ReLoadContact);
function ReLoadContact()

Grid was always null so it couldn’t attached anything. That was weird, because I saw the same solutions in different blogs. Until I realised the obvious, the solution was correct but out of date.

In Roll Up 5, Microsoft made some changes to the way the sub grids load in the form, I investigated that and I found that the grid was null because the control was not loaded yet.

So what is the solution?? PATIENCE!

Let’s make it wait a little bit and see what happens 😉 This is the final solution for the problem, tested with Roll Up 10:

Hope it solves someone’s life 😉