There currently is a bug in the latest version of Sitecore ranging from around version 7.2 to 8.0 Update-4 (rev. 150621) with regards to the query string parameter on internal links using a link field.

linkfield1

If you have chosen an item and entered something into the query string field and then try to retrieve the URL from code, you will not get the wanted result.

var linkField = (LinkField) Sitecore.Context.Item.Fields["Link"];
linkField.GetFriendlyUrl(); // http://yoursite.com/?product%3D123

When you save the link Sitecore will actually URL encode the query string value which in this case replaces = with %3D and it no longer works as expected. You can see this by looking at the raw value of the field.

linkfield2

Workarounds

The simple workaround is to just edit the raw value yourself to the correct value. However, it is a bit annoying and your editors may not be so technically inclined. If you contact Sitecore Support, though, they will be able to provide you with a fix which consists of a DLL and a minor change in the core database.

I’m told the bug was fixed in Sitecore 7.1 Update-1 (rev. 140130) but has not yet been implemented in Sitecore 8 for some reason but hopefully they will do that soon.