This topic contains 4 replies, has 0 voices, and was last updated by Olivier Gagnon NC 7 years, 10 months ago.
-
AuthorPosts
-
January 4, 2017 at 8:40 am #5636
RafeHello and Happy New Year. I am hoping to fins some help on something where I cannot find much dodumentation on. I am trying to write a user event script with the following code. It is returning null in both before submit and after submit deployments. However it works perfectly fine on a client scripts. Can anybody offer an idea regarding what I am doing wrong?
var pairedTrx = nlapiGetFieldValue(‘intercotransaction’);
nlapiLogExecution(‘debug’,’pairedTrx’,pairedTrx);// returns null for user event scripts
This is a cached copy. Click here to see the original post. -
January 4, 2017 at 9:12 am #5637
erictgrubaughWhat record type is your script deployed on? On which event is this code running (Before Load, Before/After Submit)?
Rafe replied on 01/04/2017, 09:30 AM: I have tried both before and after submit. I’m not sure that before submit would work for me on ‘Create’.
-
January 4, 2017 at 9:19 am #5638
Vesku1980In user event script you have to use nlapiLoadRecord.
var rec = nlapiLoadRecord(‘salesorder’,1); – loads sales order with internalid 1.
Load wanted field :
var dataInField = rec.getFieldValue(‘intercotransaction’);
Vesku
erictgrubaugh replied on 01/04/2017, 01:03 PM: This is true when you need to load data from a different record. When you are retrieving data from the record on which your User Event is deployed, you should not need to load the record.
-
January 4, 2017 at 9:34 am #5639
RafeThanks for your responses! In addition to loading the sales order, which I will likely need to do in the end, I was able to use as well in my aftersubmit function:
var pairedTrx = nlapiLookupField(‘salesorder’,soID,’intercotransac tion’);
-
January 5, 2017 at 5:41 am #5640
Olivier Gagnon NCAfter Submit is not longer truly after submit. NetSuite made some changes (likely to optimize performance while sacrificing correctness). So you often have the case of values being returned incorrectly in after submit scripts when doing local getFieldValue type calls (both in SS1.0 and 2.0). The solution is typically to load the record you are on just to be able to see correct values.
-
AuthorPosts
You must be logged in to reply to this topic.