This topic contains 9 replies, has 0 voices, and was last updated by j.j 6 years, 6 months ago.
-
AuthorPosts
-
May 4, 2018 at 10:23 am #17953
karennHello,
On the Inventory Item form we have a button to view an image of the item. In order to do this we need the itemid. Everything works great in Edit mode but in View mode the itemid is undefined for the currentRecord. Not sure why. Why can’t we get that value in view mode?
function onclick_ViewImage() {
var itmRec = currentRecord.get();
var recid = itmRec.id;
var rectype = itmRec.type;
var itemid = itmRec.getValue({fieldId: ‘itemid’ });
… more code here
}
Thanks,
Karen
This is a cached copy. Click here to see the original post. -
May 4, 2018 at 11:32 am #17954
khultquistIn your script you are using two different ways to get the idvar recid = itmRec.id;
and
var itemid = itmRec.getValue({fieldId: ‘itemid’ });
I suspect the first one works but not the second one, is that right? I use a Chrome Extension called NetSuite Field Explorer that is really helpful for finding the actual variable name.
-
May 4, 2018 at 11:44 am #17955
karennthe first one gets the internal id of the record correctly. The second where I try to get the itemid field is undefined. I have tried other fields and they also came back undefined when using getValue in View mode for the currentRecord
-
May 4, 2018 at 12:51 pm #17956
khultquistwhat about using itmRec.itemid instead
Code:
function onclick_ViewImage() {
var itmRec = currentRecord.get();
var recid = itmRec.id;
var rectype = itmRec.type;var itemid = itmRec.itemid;
… more code here
} -
May 4, 2018 at 1:02 pm #17957
karennundefined in view and edit mode
-
May 7, 2018 at 5:10 pm #17958
pcutlerIf you need a work-around, you could try using one line of SuiteScript 1.0 in your script as follows:
Code:
window.nlapiGetRecordId() -
May 9, 2018 at 6:20 am #17959
karennIf anyone else ever has an issue with this it appears you cannot just use the currentRecord.get() to get any data from the record in view mode. Instead you have to actually load the record.
-
May 14, 2018 at 1:37 pm #17960
rchouksey@twoscompany.comIt Looks like this is correct.. “If anyone else ever has an issue with this it appears you cannot just use the currentRecord.get() to get any data from the record in view mode. Instead you have to actually load the record.
”but can anyone explain why it’s like this?
-
May 16, 2018 at 9:20 am #17961
benvanderbeekJust an attempt at an explanation – maybe in view mode, the record is not considered to have been loaded from a script perspective, since it’s only being displayed. Not a great explanation, but that’s my first guess.
-
May 16, 2018 at 11:10 pm #17962
j.ji too had similar experience, in view mode the currentRecord only id and type are supported, rest of the fields are undefined. seems strange and should be available in view mode. imagine having the record in front of you but unable to read. seems like a design flaw. i understand not able to write but atleast read operation should be supported. what is the point of currentrecord if you have to load it again
-
AuthorPosts
You must be logged in to reply to this topic.