Anyone know a way to lookup a form internal id via...
# suitescript
s
Anyone know a way to lookup a form internal id via script if all you know is the transaction form's script id?
b
If you had the name, you could try getting the select options of the customform field on the transaction and find the matching select option's id
s
Found a really ugly work around 🙂
Ugh, it's a work around for a work around. Thanks NS.
Created a custom record type with one field (list/record: Transaction Form). Set the field's default value to the form I had created.
Then use record.create to grab the default field's value to get the form id
All because I need to package this up and have it work automatically on bundle install
b
If it helps, nobody likes the forms from a bundle anyways
s
It's a inactive form I'm bundling, hah
what a disaster
All stemmed from trying to get the applied credits on a bill payment via script
NetSuite only makes them available on the before load event (from UI only) or when you attempt to print the bill payment -- but only when printing using a form that uses advanced printing.
(ns makes the credits available in the before load print event in that case)
then, to make sure it always uses a form with advanced printing enabled, it required specifying a form on the render.transaction method, which lead me down this workaround for the inactive form...
b
I eventually recognized this as the desperate print the transaction to get to the credits workaround
s
yeah hah
b
although probably too late, could you simple have included the template instead of a form and used that template in a TemplateRenderer
s
The problem with that is that don't you have to load the record first to pass into the template renderer?
If you load the record to pass into the renderer, the special credit line lookup logic ns has behind the scenes never runs.
Not what I wanted to be doing at midnight, hah
b
this workaround is very weird
s
by far the worst I've had to do