How to Customize the NetSuite Calculate Shipping Button - netsuite

How can I customize the Calculate Shipping button (the calculator icon) on Sales Orders under the Shipping tab? I've written my own app using the UPS API and I would like to fire that instead of the native NetSuite shipping calculator. So how can I make the Calculate Shipping button fire my custom code?

Sorry but there is no way to do that via API. You could hack it but probably more trouble than it's worth.
to make your custom calc work:
Associate it with a shipping method (or methods) that have flat rate of $0. If you don't use $0 then NS will re-apply the flate rate charge at various inopportune times.
when something changes trigger the API lookup OR
add a button on the SO form that you can click.
You can also add buttons various other ways with more or less degrees of control. One way is to include an inlinehtml field containing the html for a button and have a script show that when one of your associated methods is selected. I'd back that up with a save page client or before submit user event script to re-calc the value when needed.
When I've done this sort of thing I've made a hash of the shipping address and item ids and quantities and stored that as a body level field. Then you can re-calc the hash in a before submit event and call your API only when the hash has changed.

An another way would be to add a new button using
form.getSublist('item').addButton(name, label, script);
//button would be added in item sublist section
In your script parameter specify the onclick script, the onclick script would be a client side javascript in which you should be able to get SO lines and then fire a AJAX to your suitelet [even nlapiReuqstURL should work smoothly here] which in turn can make calls to your UPS APIs and fetch the rates from there.
Now, the challenge remains is getting rid of the natural calculate shipping button. Probably, you can make it a zero cost one or make the label of new button more appealing to click over the standard one.

Related

NetSuite modify packing slip URL

in netsuite how can I modify the URL below so that it can display packing slip based on multiple ID. as example I want new window to display packing slip for id= 366646 and id=361518 on the same window. is this possible?
https://system.netsuite.com/app/accounting/print/hotprint.nl?regular=T&sethotprinter=T&id=366646&label=Picking+Ticket&printtype=pickingticket&trantype=trnfrord&whence=&print=T
There is no way to print multiple picking tickets by default as the hotprint function can only process one ID at a time. You could do the following:
Build a suitelet that can handle both ID's and use the hotprint for each.
Merge the two resulting PDF's together and display that in a popup window.
I will dig around for an example code I did for multiple sales orders.

How can I trigger a NetSuite workflow on a Form Event (Client side event)

I want to trigger a NetSuite workflow when the user sets the value of a field, but I don't want to have them submit first. The Workflow state builder looks like it has useful options but I can't get it to work.
There's some useful looking blog posts around but a lot of them seem out of date.
Update - more info
My primary issue is this one: Restrict what customers an employee can see (NetSuite)
The hack I'm currently looking at is populating a custom Transaction Column Field that I've added to a custom Time Recording form. The idea is to load this field on the UI with only valid projects (not customers as well), and this I have been able to do.
The problem is I still (as far as I can tell) still need to populate the "Customer" field, which is mandatory; I'm also assuming that if I don't do that then any time that is recorded won't go against the project. I had thought that if the user selects the project they want then I can populate the customer field with that value. I hate this as an approach but I can't see how else to do it. I do have coding experience (including JavaScript) but haven't made the leap into SuiteScript yet.
You won't be able to do this in a Workflow, as they are currently limited to only work with body level fields and cannot modify Transaction Column Fields (aka sublists).
You should be able to achieve this with a Client Side Script though.
Source (Netsuite login required).
Sublist changes will be available for transactions in the 2018.1 release sometime in Feb/Mar.

update netsuite parent field via suitescript in view mode

I have scripts that react off of, for example, a client Recalc client event. For example, on my form I have a subtab that users may add or remove items from. Based on actions on this subtab (housing a child record of the parent) I would like a field on the parent to update (say to show a total from the children records).
As I was saying, these events seem to work fine if in edit mode but they do not work correctly in view mode. (even in view mode these child records have a "Delete" option at the end of each row in the subtab. This was provided by netsuite by default.
I wondered if anyone had any tips to best allow this parent field to update real time while in updating the subtab rows with the form in view mode.
Thanks.
You can make a custom field on the parent (header) whose value is determined by saved search. For instance, make a saved search that totals the line values by transaction. Be sure to make it filter by transaction in the Available Filters tab. Make the search public so everyone can use it.
Create the custom field that sources the total from the saved search. Make sure to uncheck the "Store Value" checkbox, as you don't want to store the data, you want to reference the search results. You do this on the Validation and Defaulting tab. You'll see a field for Saved Search there. Choose the search you created above.
As you remove/add/change lines on the transaction, the field updates accordingly. In essence, you don't need a single line of code to make this work - it's all in how you create the search and the custom field that references it.
I have a similar situation posted here.
The NetSuite team answered me by email, and it happens you can't really achieve this on the view mode: some API methods are not available. Their suggestion to my case (and I think it applies to yours too) was really to force a refresh on the whole page.
Of course, you can always achieve this accessing the DOM elements directly, but this isn't a best practice, as your code can stop working if these elements change on a version update.
I had the same problem, I'm not able to restrict on view or remove edit button. But, there was one alternative solution with workflows, you can deploy workflow on child record edit mode restrictions, then if the user clicks edit on view then the record will not be available to edit. This concern will apply to custom record as well.

Breaking down 1 calendar event into smaller events in SharePoint

I'm trying to create some sort of reservation system in SharePoint using a calendar list. It's been recommend to me to create events and add a column which allows a user to claim it. From there, claimed events would change color and only those who've claimed the event would have permission to unclaim the event.
This is what it would look like (see alternative option):
What I'd like to be able to do though, is instead of having to create three events like shown in the alternative option, creating 1 event (see original) and have that be broken down into 3 events or more, maybe using some form of drop down asking for intervals (ie. 15m, 30m, 1h). Based on the selected interval, it'd break the event accordingly.
A possible solution is in your main event you add another field named Interval.
The you design a workflow when you create the event that creates new events according to the interval specified using a while loop while incrementing the start time with your interval.
Those new events have a content type with a field named UserClaimed. you then associate another workflow to those new events that checks for that field and changes permissions on the event to only allow modifications of that event to the user specified.
This is the general idea, the implementation should not be that hard
just a thought -
I mean, the reason i think you want the events to pre-exist is so that users can easily create them in the correct time slot (rather than clicking the new item menu, which throws them away from the calendar view/context). Is that right?
If so, allow me to offer you this scenario:
If you are using KWizCom's Calendar Plus web part (yeah, I work for KWizCom...) it allows you to type in the event in the calendar itself directly.
Something simple like: "1pm-2:30pm Training meeting with Josh"
check the demo video here: http://www.kwizcom.com/sharepoint-add-ons/sharepoint-calendar-plus-web-part/overview/
Also, drag and drop events in the calendar to move them easily, and it also supports color coding events based on categories (meta data, views, sources, etc.).
The one thing you will need to develop is the unique meeting logic, and owner permissions.
meaning, an event handler that does not accept 2 meetings at the same time for the same room (define the unique resource field, if any), and the logic that allows only the person who created an event to edit or delete it.
ping me, I can help with the event handler - perhaps we can add this to our product, this is actually a cool idea. my work mail is shai at kwizcom dot com

online Crm 2011 Dialog Workflow Issue - Response Type

I need to create a new Proccess with Dialog (new Feature in Crm 5.0) which calls a CRM Query, returns a list of Customers, and after selecting the customers we want to use, I call a plugin which then prints the invoices for the Selected Customers. The plugin is programmed and working and also the dialog is created and the entire solution is working perfectly. But only for one Customer :(.
And this is the Issue. When you create a CRM Query in Online Crm 2011, you get 4 options as Response Type:
1.Single Line ( Text Box),
2.List of Options ( Radio Buttons), where only one can be selected,
3.Picklist (DropDown), where also only one item can be selected and
4.Multiline ( Multiline TextBox)
And in my case none of these is not working, because I cannot select more Customers from these Response Types. It works only for one Customer :(
How to solve this issue? What are the options here, maybe a custom User Interface for the Dialog, or what?
What I need is a List of Checkboxes with the Customer Name, and then I can select more then one Customer for the invoicing proccess.
Do I need to take another route in order to achieve this, or will the Dialogs do the job? Or can I create a Custom Response type which renders multiple selectable Checkboxes? If yes, then how can I create a Custom Response Type?
Any suggestion would be apreciated.
Thanks
I don't think the Dialog feature will do what you need (checkbox list selection). Another option would be to add a button on the ribbon, perhaps called Create Invoices, that launches a pop-up window (custom HTML web resource). This pop-up window could simply ask "Are you sure?" or it could even include some custom parameters for the Invoice generation. Upon confirmation, it would use some JavaScript to talk to the ODATA endpoint to update a flag on each of these Customer records that would fire your plugin.
This way, a user could browse to a list of Customers, use the built-in checkbox to check off as many as they like, then click the Create Invoices button.
If you are good with HTML and JavaScript, probably the hardest part of this will be learning how to add a new Ribbon button. It isn't the easiest to learn, but there are plenty of resources out there to help.

Resources