The basic scenario was simple. A client needed to pass an invoice number as a parameter to an internal web page connected to an imaging system. Clicking the GoTo would open a web browser, pass a URL with the embedded parameter and an invoice image would open.
When using Smartlist Builder there is a button to create a GoTo. Clicking the button opens the GoTo window. The Plus (+) button creates a new GoTo and one option is to open a webpage. So far so good.
Clicking the Open Webpage option lets you set a description to appear and a enter a URL. To just open a web page, that's all that needs to be setup. Clicking the plus sign allows the assignment of parameters. This useful for sending search strings to say Bing or Google and in our example, an imaging website.
The parameter gets a name that is actually passed as part of the parameter string. The parameter can only be 30 characters long. In addition, you select a table and field from the Smartlist to pass. Multiple parameters can be added by clicking plus.
For the first parameter, GP Actually passes the website, a question mark (?) to indicate a parameter, the parameter name, an equal sign and the field value from the select field in the Smartlist.
For example, a Bing search for Dynamics GP would look like this:
URL: http://www.bing.com/search
parameter: q
smartlist field value: Dynamics GP
The GoTo would put it together like this: http://www.bing.com/search?q=Dynamics GP
For basic queries this works great, but what if the parameter is more than 30 characters? What if the parameter you're passing needs to be in the middle of a parameter string? Don't worry, there's a way around this.
The secret is to create a calculation and pass the calculated result ot the GoTo. My client had a very long parameter string with the invoice number at the end so here is what I did:
- I grabbed the entire parameter string AFTER the first equal sign (=). I would need that for the parameter later.
- Created a calculation in Smarlist builder using the calculation button and pasted the parameter string in as a calculation with single quotes around it for SQL.
- Then I added a plus sign (+) and selected the invoice number from the available fields at the right. This gave me almost the entire parameter string. The calculation looked like this:
- Finally I created a new GoTo with the parameter information before the equal sign as my parameter name and selected the calculated field instead of the invoice number as the field to append to the end.
As we worked with this for a few days we learned a couple of things. The invoice number passed through the calculation could also be passed as a second parameter instead of being embedded in the calculation. The only real benefit is clarity.
Secondly, the Smarlist field being passed as a parameter needs to be included as a key field in table. We missed this the first time. The Smarlist was built off a single view and didn't need a key field except to satisfy Smarltist Builder so Batch Number had been randomly picked as the key field.
Consequently, until we added Invoice Number as a key field, Smartlist Builder was passing as parameter an invoice from the batch that included that invoice number, but not necessarily the right invoice number. It was occassionally right and often wrong. Including Invoice Number as a key field in the Smartlist solved this problem.