So far, the only method that works appears to be a...
# suitescript
s
So far, the only method that works appears to be a Client script, however we want to default certain checkboxes, regardless of how they are created, whether via SuiteTalk, CSV, UI, or script. Every other field type can be defaulted to a value, but I have tried T, true, Y, and yes, and none of them have any effect on checkboxes
a
If the fields are created on the fly, meaning added to the form on beforeLoad, those fields are considered ghost fields, they are not real fields until you save the record, therefore other beforeLoad events would not be able to find them (if I remember correctly you can't use them in searches neither). You can try triggering this beforeLoad to default the fields as the last beforeLoad event in the execution stack but I think it would not work.
s
So, it’s a standard record and standard field (
customerdefault
on
billingaccount
). We want to be 100% sure it’s always unchecked. Sometimes, it gets checked automatically, though not consistently. I can set that value after pageInit in a client script, but in beforeLoad, setting it does not seem to have any effect.
s
Have you tried
false
s
Yes. I should add that I was just doing the T and true for testing to see if I could get it to change
a
beforeLoad should work specially with native fields... I would recommend to turn off anything else on that record and try your beforeLoad script, because anything else checking that box (Workflow) or Client Script is going to happen after the beforeLoad giving you the impression that your beforeLoad did not worked...
s
F / false don’t work either. It either checks itself, or doesn’t based on NetSuite’s whims.
we don’t have any other customizations (other than a client script) deployed on Billing Account
e
Is this during a
CREATE
event or an
EDIT
event?
s
during Create
🤔 1
j
Weird….
I wonder if some other Client logic is unticking it in certain cases?
(built in logic I mean)
I think step one is to see if you can discern the pattern for when it self-ticks
s
I don’t know. But, in our Client script pageInit, we have this:
context.currentRecord.setValue({ fieldId: 'customerdefault', value: false });
Which does work consistently
a
@jen That is a good call, some native fields trigger certain postsourcing events and also built-in client logic, so if that is the case @scottvonduhn your only option is a Client Script. You can test this by creating a custom checkbox field and test your beforeLoad script, if it always works, then you know there some NetSuite mambo chambo going on...
s
But the equivalent line in the UE beforeLoad does nothing:
context.newRecord.setValue({ fieldId: 'customerdefault', value: false });
j
mambo chambo
…..?
a
Mambo Jambo... my English(Spanglish) is all over the place...
j
the beforeLoad not working on
CREATE
is what leads me to believe something out of your control is happening afterwards
mumbo jumbo
I think?
I dunno
anyhow back to the topic at hand
a
message has been deleted
s
yep. and the problem there is we can’t rely upon the client script in non-UI contexts. though I guess the beforeSubmit will still be our backup / last hope
1
a
You can do a combination of Client Script only for the UI and then UE (beforeSubmit) for all other contexts
j
I like how the various spellings of mumbo/mambo-jumbo/jambo have obscured and confused this thread
meta
s
the bad thing abotu that check box, if the record is saved with it checked, it can never be unchecked later. And it has serious effects upon all manually created invoices, credit memos, and cash sales for that customer forever after
j
so I’m not familiar with this checkbox in particular, but is it only unticking itself when the customer already has a billingaccount set as default?
s
which is why we are so paranoid about a little check box. We ave had to abandon customer records we have used for years, and create new/duplicates ones, just because of it
j
like when this is an additional billingaccount?
presumably customer can only have one default billing account
s
The problem with it, it seems to offer no real advantage: if you create a new Subscription for a customer that has only one Billing Account, then it chooses that one automatically.
If you create a new Subscription for a customer with 2 or more Billing Accounts, then it chooses whichever is the default, however for our use case that will never be helpful, as there’s an equal chance we want it to be one of the others anyway
j
does NS force you to have exactly one billingaccount set to default for a customer?
s
But, if it gets checked, then SuiteBilling takes over for manually created transactions and messes with date fields, due dates, and revenue elements, and we can’t have that
no, you can have 1, 0, or many. And none have to be the default. But once one of them is the default, you can only clear is by setting a different billing account to be the default.
j
right right
so it seems the intent is to have 0 or 1 as default.
in your case, should be 0
(desired)
s
we basically never want any to be default, given that it confers no benefit to us, and only hurts us in many cases
j
yeah
I’m not much help….not even sure how to set those up in NS. Our NS is very atypical.
s
We’ve already gone the NS support route, and even NS PS and our ACS rep, and no one has any solution for us, other than to tell us that we should never be creating any invoices, credit, or cash sales manually if we have SuiteBilling. And, why would we dare do such a crazy and unexpected thing.
to be clear, they are suggesting creating a Subscription with a bunch of one-time fees, then run billing, every time we want to do a manual invoice. Then that Subscription lives on forever, doing nothing
and honestly, to me, that seems insane
j
agreed
s
Have you tried doing it in BeforeSubmit instead?
s
yes, and it does work there too. I guess I am just uncomfortable with it being checked the whole time, and then relying solely upon the beforeSubmit, especially since this one checkbox can essentially corrupt an entire customer for us.
and so, we actually have it being unset in three places: UE beforeLoad and beforeSubmit, and client script. But only the beforeSubmit and client script actually do anything, the beforeLoad doesn’t give an error, but has no real effect
We are very paranoid about this checkbox, with good reason