Hello, Unable to set Custom form on Customer recor...
# suitescript
d
Hello, Unable to set Custom form on Customer record
Copy code
var createCustomer = record.create({
                type: record.Type.CUSTOMER,
                isDynamic: false,
                defaultValue: null
            });
            createCustomer.setValue({
                fieldId: 'email',
                value: context.email
            });
           createCustomer.setValue({
                fieldId: 'customform',
                value: "6"
            });
b
that looks right, assuming you are saving it down the line
can you set and save the form in the ui?
m
Since you're creating a new record, I'd recommend using the defaultValue option for
customform
instead of setValue:
Copy code
var createCustomer = record.create({
    type: record.Type.CUSTOMER,
    isDynamic: false,
    defaultValue: {customform: 6}
});
Assuming, of course, that 6 is a valid value for that field on Customer records.
d
Thanks @battk @MTNathan
@MTNathan Not working 😞
var createCustomer = record.create({ type: record.Type.CUSTOMER, isDynamic: false, defaultValue: {customform: 6} });```
Copy code
[{"value":"5","text":"XXX- Coaching Customer"},{"value":"6","text":"XXX- Data Services Customer"},{"value":"7","text":"XXXIntercompany Customer Form"},{"value":"-2","text":"Standard Customer Form"},{"value":"-8","text":"Standard Lead Form"}]
b
you dont put xxx- in the form name if you want it to be chosen
if you can't set the form in the ui, its likely the account has a customization that prevent setting that form
m
Is it throwing an error or showing a different form when you load the record after the script runs? If it's the latter, perhaps that form is not set to
Store Form With Record
on the form setup page.
b
or the form simply isnt setup to be stored
d
XXX is just i put in chat to hide our firm name
I was able to set the form via UI. showing a different form when I load the record after the script runs.
@MTNathan
m
In that case, check the form setup - there's a checkbox on the right side for
Store Form With Record
- if that's unchecked, it won't necessarily use that form next time you load the record. I believe it uses the preferred form the for record type but I don't know for certain; in our account I always make sure to check that box.
b
like @MTNathan said earlier, check if the store form is set
d
Yeah checking
it is checked already
From UI I am able to set but not from script
@MTNathan you use "6" or id here
custform_4_4487041_304
m
'6'
works but not
6
? Oh NetSuite...
d
'6'
is also not working for me.
😞
m
Huh, in that case it's hard to say why it's not working, the code doesn't appear to have any problems. My only other thought is that there may be another script overwriting the custom form or doing a redirect on beforeLoad of the record - does the url have a
cf
parameter when the record loads with a different form?
d
Let me check
No
cf
parameter. The record I modified via UI is still showing correct form.
so beforeLoad no script executing.
m
Odd. Unfortunately, I'm out of ideas at this point - you may want to get in touch with NetSuite support in case they're able to track down what's happening on their end.
d
@MTNathan does this anything do here ?
message has been deleted
m
That looks like it's just for the field help (that pops up when you click the field label). I haven't actually used that option since it was introduced but I'm pretty sure that's what that is, and I can't imagine that would affect the form itself.
d
ok @MTNathan @battk I think it was with subsidary settings we had I had set the customform at the end of customer save code and it did work for me Thanks for the help anyways 🙂 Really happy to have you guys really helpful.
👍 1