isNewRecord doesn't work on catalog forms?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 08:22 AM
The below doesn't appear to work on any of my catalog items. My alert is always caught indicating that it doesn't see my new form loads as a new form. Is there a different way to check for a new record on a catalog item?
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.isNewRecord()) {
g_form.setValue('qty', '1');
}
else {
alert('caught here');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 08:32 AM
Hi Eric,
All seems to be perfect as far as script is concerned. Check if UI Type for Client script is set to Both.
Also, you below snippet with added alerts
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.isNewRecord()) {
alert('Setting quantity as 1');
g_form.setValue('qty', '1');
}
else {
alert('caught here');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 08:38 AM
Hi Jaspal,
The UI type is set to All. I added the alert inside but the only alert caught is the one saying it isn't caught as a new record. When I remove the set QTY from within those brackets, it works.
I just can't get it to detect that it is a new record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 08:44 AM
Could you confirm the table the Client script is working on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 08:44 AM
The function returns null instead of true/false on a catalog item.
What's the ultimate goal here? Could you do something like if qty = null set it?