Got an "oh I wish I didn't need to solve this one"...
# suitescript
m
Got an "oh I wish I didn't need to solve this one" thing with a Suitelet. This tool allows us to put in percentage increases and decreases around item cost categories and then calculates a 'what if' scenario. Like "What if UPS raises their rates 5%?" and it spits out a before/after. The problem is one of the categories is Tariff increases/decreases. this is fine fireThe system is erroring out because the percentage value is not between 0 and 100. When you have a new 145% tariff on top of the previous 25% (170% was not on my bingo card), you have a 580% increase. What do I change in the script to handle percentage changes outside the 0-100 range? There doesn't appear to be a MIN/MAX tag I can use.
Copy code
var tariffRateChange = form.addField({
    id: 'custpage_tariffratechange',
    type: serverWidget.FieldType.FLOAT,
    label: 'Tariff Rate % Change',
    container: 'landedcostgroup'
});
I can't find anything in notes/posts, and the AI world is (so far poorly) suggesting a client script to validate (which may be the right direction, but the examples to date aren't directly relevant/useable.)
a
what's bounded by a range of 0-100? a field type in NS of datatype percent? just ... don't use a percent field use a float field... everything else is just... math.
m
Yeah, using float. Maybe (thinking out loud here) I put some % in later in the code to make it easier for users. I'll poke around at ripping that out if it's there. Thanks!