Hi,
I have created an Inline HTML field on a customer record that shows a button which opens a new window and goes to a URL that includes the customer's tax ID. This allows the user to quickly check current company registration information.
Currently I have the DEFAULT VALUE of the field set to:
'<input type="button" value="Company Lookup" onclick="window.open(''https://websitegoeshere/View?id=' || {vatregnumber} || ''',''popUpWindow'',''width=1000,height=1200,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes'');">'
...and FORMULA is ticked. It looks messy because the inline HTML includes both double and single quotes, so I had to use double single quotes all over the place!
This works fine in view mode. In edit mode though, it only sources the value of {vatregnumber} when the record was last saved. If in edit mode the user changes this field (or enters a value for the first time) and then clicks the button, it inserts the previously saved value instead (which for a new customer record will be empty). As this 'check' is most useful when adding a new customer record, having it work is edit mode would be great.
I am using an Inline HTML field because it allows me to place the button right next to the applicable field, and it appears in both view and edit modes (unlike using a Custom Action).
Is there a way to source the value of a field while in edit mode, before the record has been saved? Either using JavaScript or NetSuite API? I tried using document.getElementById("vatregnumber") methods (including .textContent and .value) but they kept returning null...
Cheers