This topic contains 6 replies, has 0 voices, and was last updated by Olivier Gagnon NC 7 years, 9 months ago.
-
AuthorPosts
-
December 9, 2016 at 3:47 pm #1409
amccauslandI’m writing a SuiteScript 2.0 Scheduled Script to copy data from some (but not all) Items in a Sales Order over to a new Custom record type.
The trouble is with the “rate” column on Sales Order : Item sublist.
If I use:
var lineCount = salesOrder.getLineCount({ sublistId: ‘item’ });
for (var i = 0; i This is a cached copy. Click here to see the original post.
-
December 9, 2016 at 4:29 pm #1410
saenzmarianoHi Aaron, this is the wrong forum topic for that question.
-
December 12, 2016 at 7:04 am #1411
Olivier Gagnon NCSo, sidestepping most of this and just answering the easy point: there is a search column for rate. It’s programmatic ID is ‘rate’. It is called ‘Item Rate’ if you are using the UI.
-
December 12, 2016 at 7:10 am #1412
Olivier Gagnon NCOhh, sorry, I see what you mean now.
Yeah, looks like NS is dropping the info that this is a percentage.
I would look at a solution where you divide the discount amount by the amount of the line above to determine the effective percentage. Looks like there is a flaw there where NS fails to capture the percentage anywhere else.
-
December 30, 2016 at 9:08 am #1413
fjannelleGood morning,
I faced the same issue with using getValue to obtain ‘discountrate’ in 2.0.
It is broken. Your observations are accurate (getValue, getText). There is no other hidden field allowing us to know if it is % or $. No formatter. Nothing. As you mentioned, using a sourced field produces the same result. One note, using a 2.0 client-side script produces the same undesired result. Only the 1.0 functions return the % or $.
Here is what I did to work around it:
1. Create custom transaction body field of type Freeform Text, display type = hidden (main tab)
2. Create 1.0 user event before submit script (triggered on create, edit, copy). Script simply copies ‘discountrate’ value in hidden freeform text field
3. 2.0 script now references the custom field instead of the ‘discountrate’
Two keys:
1. Script at step 2 needs to be 1.0
2. Script at step 2 MUST be triggered BEFORE regular script (you can change the order via Scripted Records). This is if your script is a user event script on the same record. In your case since it is a scheduled script you will be fine.
Two problems:
1. Unnecessary processing. getValue should work in 2.0. No viable workaround. This adds 1 ‘unnecessary’ script.
2. Does not apply to past transactions, only moving forward
An alternative would be to rebuild your scheduled script as 1.0 (which is far from ideal).
I am planning to file a defect. If you already did let me know the # and I will attach my findings.
Thank you.
Best regards,
-
February 16, 2017 at 12:11 pm #1414
amccauslandfjannelle,
I am unable to find a Defect about this. I thought there would be one but it seems it was treated only as a Case.
I am in favor of filing a Defect, so please do so. It appears you have at least as deep an awareness of the details of the problem as I do, if not more.
-
February 16, 2017 at 12:37 pm #1415
Olivier Gagnon NCWe have this as Defect 367714
-
AuthorPosts
You must be logged in to reply to this topic.