we want to be able to set automated when to if to ...
# suitescript
s
we want to be able to set automated when to if to charge for shipping on the sales order levelĀ if above 2000 don't charge if below charge. this needs to be set by customer or group as some customers a grandfathered in to always receive free shipping
b
have you tried a user event script or client script?
s
i was asking if this is somehting that is scriptable and do i do this on the IF or invocie
b
you need to identify when you want this to occur
usually its too late to update the invoice or item fulfillment since the customer has seen the price from the sales order
s
in this case, the customer only sees the invoice when we bill it
i wish i could save it on the costumer record
b
there are lots of ways to do this
you can use different shipping item for different customers
you can use promotions
you can simply change the shipping cost field
there are different accounting impacts to each, so you should make sure what your accounting requirements are
s
I spoke to the accounting team they want that the shipping cost button they have in the UI on the item fuilment should be auto clicked
b
buttons usually dont translate well to suitescript
you can try things like unsetting the
shippingcost
field or unsetting
shippingcostoverridden
s
I assume that button gets you the rate for integrated shipping is there a way to trigger that?
Copy code
onclick="Shipping.calculateRates();return false;"
b
Tends to happen automatically, which is why i recommended unsetting the shippingcost and the field used to tell if the shipping cost has been overwritten
s
shippingcost:"0.00" shippingcostoverridden:"T"
that is the default you mean set it to false ?
b
Setting shippingcostoverridden to T means that the user changed the shipping coat
Which indicates to netsuite to not overwrite the users input
You want to unset the shippingcost field (usually using null or the empty string) and you want netsuite to overwrite it
s
do you mean in a case where i want to charge shipping and add it to the invocie ?
b
In the case you want to do the equivalent of clicking the shipping calculator button
s
shippingcostoverridden do you use --
Copy code
false  "false" or "F"
b
The reasonable answers are usually false or "F"
Most commonly false in ss2
s
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(["N/record"], function (record) {
  function beforeSubmit(scriptContext) {
    var rec = scriptContext.newRecord;
    // var rec = context.currentRecord;

    var shipp = rec.setValue({
      fieldId: "shippingcostoverridden",
      value: false,
    });
    var cost = rec.setValue({
      fieldId: "shippingcost",
      value: null,
    });

  }
  return {
    beforeSubmit: beforeSubmit,
  };
});
i seem to be missing something
b
You can try things like changing the order of the fields, or perhaps trying after submit instead
But my warning originally stands, buttons dont translate to suitescript well
s
so far no luck on any of the ideas
b
the more dangerous options are doing things that change the shipping cost in the ui
like changing the quantity of the item