Reading a NetSuite Item Fulfillment's shipcarrier field using suitescript 2.x - netsuite

I have a script which loads an item fulfillment record and from there I am trying to read the "shipcarrier" field. This is a field that is shown on the IF page and if I put the &xml=t in the browser URL I can also see the value (such as Fed Ex or whatever). The issue is, I am struggling with how to get that with the script I am writing. I have noticed it does not appear to be in the schema browser but given that the UI shows it (and the help text shows 'shipcarrier'. I would think there is some kind of way to read it even if it is not as simple as using getText() on the fulfillment record. I have also seen some mention on other posts about it being set but again I don't seem to be able to read it and also .getFields() does not give it back either.

You can get that value using the search module and the lookupfields method.
var fieldLookUp = search.lookupFields({
type: search.Type.ITEM_FULFILLMENT,
id: param_itemful_id,
columns: ['shipcarrier']
});

Related

NetSuite: Emulate Global Search

I'm curious if anyone has come across this question before.
I've been asked a few times if there is a way to emulate the Global Search functionality into another field.
I'm guessing Inline HTML, potentially triggered by Client Script, but I don't know where to start.
Anyone worked with the Global Search before?
N/search has a search.global method that returns a search result with columns: name, result, info1, info2 (and id and recordType) It has a promise method that allows use in a client script.
It's all up to you how you display the results though.
depending on what you are trying to do another search like operation but more focused is the field.getSelectOptions method. This lets you do a contains, is or startswith search for a matching value for a field. Great if are trying to script a transaction field where the normal select list could be 100k long.

Google analytics Site search is not working as expected

I just started using Google analytics for my website. I found that, enabling site search for a site is very easy as mentioned below,
But my site doesn't have the search term in the query string, instead it is part of the url as mentioned below,
https://mydomian.net/search#q=boxtest18
for some internal reason i cannot modify the code to append search term as querystring to url.
This article explained how to configure site search in GA, if Site Search Term Is Present in the URL: NOT As Query Parameter (Single Term).
When i tried, it doesn't seem working.
Below is my filter configuration.
What i'm doing wrong here?
Can i use the filter for this kind of url?
Is my regular expression correct?
Help me out here.
As Michele mentioned you may append the hash when the query is visible in url hash;
gtag('config', 'GA_TRACKING_ID', {
'page_path': location.pathname + location.hash
});
though if you are using requests (ajax or any restful api) you should manually trigger a page view as a virtual page.
pagePath = location.pathname
gtag('config', 'GA_TRACKING_ID', {page_path: pagePath + '?gender=' + request.gender });
// or if using analytics.js
ga('send', 'pageview', pagePath + '?gender=' + request.gender);
For more info, here is the help section for sending posts
https://support.google.com/analytics/answer/1012264?hl=en#Post
Pageview Request Object
You may use these to manually trigger a page view for a virtual page. If you are looking to use analytics.js (ga()) please refer to this documentation
gtag('config', 'GA_MEASUREMENT_ID', {
'page_title' : 'homepage',
'page_path': '/home'
});
Parameter name Value type Required Description
page_title string No The page's title.
page_location string No The page's URL.
page_path string No The path portion of location. This value
must start with a slash (/) character.
For more info, here is the official documentation
https://developers.google.com/analytics/devguides/collection/gtagjs/pages
Event Request Object
I am adding this section for completeness
You may use these to trigger a tracking event. If you are looking to use analytics.js (ga()) please refer to this documentation
gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
action is the string that will appear as the event action in Google Analytics Event reports.
category is the string that will appear as the event category.
label (optional) is the string that will appear as the event label.
value (optional) is a non-negative integer that will appear as the event value.
For more info, here is the official documentation
https://developers.google.com/analytics/devguides/collection/gtagjs/events
In Google Analytics the URL paths that are passed to GA with your Pageview hits are stripped of these fragments.
You can update the data before sending it to Analytics (track pageviews).
gtag('config', 'GA_TRACKING_ID', {
'page_path': location.pathname + location.hash
});
Or you can use Google Tag Manager to get the fragment, more info here: https://www.simoahava.com/gtm-tips/track-url-fragments-as-pageviews/
Then you can handle it as you like or replace the # to the ? with a filter.
After digging into Google analytics and Google tag manager i found the solution. Solution was very easy in my case.
For every search, search term was updating in the url fragment. In the below case, i searched for boxtest18 and url updated like below.
https://mydomian.net/search#q=boxtest18
For this, i had crerated a Tag in Google tag manager and triggered it on history change event. That resovled my problem.
Here are the steps.
In google tag manager i have added new tag and filled highlighted info.
Fragment value is a variable which i created.
For the new tag i have created the triggering event as shown below.
And make sure you have the tracking code script and Google tag manager script in your web page. That's it. Hope it helps someone.

How does a Gmail message Id or ThreadId map to the new Gmail UI?

Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:
What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?
Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.
--
If I view a draft message in the new Gmail UI, the URI is something like this:
https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF
I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.
Previously, one could do this:
https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d
where the value of "compose" is the Id.
How can the same thing be accomplished in the new UI?
I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.
Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74
This code includes an encode and decode function which should work for Gmail-format query parameters.
Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this:
thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.
Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.
Thanks to #frank-szilinski - he pointed out that the old format is now translated. I.e. this now works again:
https://mail.google.com/mail/ca/u/1/#drafts/1661237c4db71ace
It doesn't seem to work when the Gmail tab isn't already open, however.
Building on #kremonte gist, and #chris-wood comments, I made a rails gem that correctly creates the open-the-draft-inside-gmail URL.
It's here - https://github.com/GoodMeasuresLLC/gmail_compose_encoder
It's for the use case of "my code created a draft (prepopulated with some text, of course) and now I want to open the draft in compose mode so that my user can review it before hitting "send".
How to get the URL for a draft
If, for example you use a list request from which you get your draft objects:
{
"id": string,
"message": {
object (Message)
}
}
You can take this id and put it into a URL in this format:
mail.google.com/mail/#inbox?compose=[id]
Eg.
mail.google.com/mail/#inbox?compose=3doinm3d08932d
This will open up GMail with the relevant draft open.
I was struggling because I wanted it to work with multiple accounts. However the authuser parameter did not help.
Inserting the email address instead of the integer after the u/ component solved the problem.
https://mail.google.com/mail/u/{email_address}/#drafts?compose={message_id}
The message id is the one provided by the API.

NetSuite sublist

I am having a problem finding out an id of a sublist. I am using SuiteScript 1.0. For instance, I need to list the components of an assembly item record, how do I find out the list id and the "type and field name to use in the nlapiGetCurrentLineItemValue or nlapiGetCurrentLineItemValue methods. What I am looking for is how now and in the future when presented with a sublist, do I go about finding the ids of the objects needed. I have internal ids turned on but that does not help in the sublist view. What is the best way to get this information when I need it? thanks for any help you may give.
You can use nlapiGetAllLineItems() to get an array of all the sublists. You may need to load the record first and do record.getAllLineItems()
I have found the most useful method for figuring out internalids is to run nlapiLoadRecord(..) in your Browser Console and examine the resulting object. Another trick is the add &xml=T to the end of the URL of the record, which displays the record in XML format. NetSuite also documents most of the internalids in the Records Browser.
In this case you use console in Google Chrome. Open the Specific Assembly Item Record page and Press F12 and select console.After give following code
nlapiLoadRecord('assemblyitem', 90088(id for specific record));
after show result in console. Select linefields and Item. Now it show the fields of sublist. If You have any doubt let me know.

Passing form data to another form via url in lotus

I am working on a new web app in lotus/domino. I am newer to lotus/domino programming, so forgive me for not knowing something simple.
What I am trying to do is display a table of information, with one of the columns containing a link. The link is formatted like [http://server/app.nsf/form?openform&ideaNum=1&var2=foo2]
How can I retrieve the information from the url, to get information from a view or a document?
So far I have tried to access the query string in the webQueryOpen event, but lotus runs the agent before the DOM writes to the browser, the query_string isn't available.
I am not sure how else to get information from one form to another in lotus.
Thanks for the help.
-Kris
If you're passing multiple params in the query_string, you can get Domino to do a bit more of the work for you. There's an Function command - UrlQueryString - that can format the params into a list, delimiting at the "&".
E.g. server/app.nsf/form?openform&ideaNum=1&var2=foo2
becomes a list:
openform
ideaNum=1
var2=foo2
To use it, on the destination form create a multi-value text field called something like "QryStringList".
Set it to be computed when composed, and set it's value to #UrlQueryString.
In your WebQueryOpen agent, you can access the params as doc.QryStringList(0), docQryStringList(1) and so on, if you're using Lotusscript.
I'm fairly sure I put this together using info from the IBM/ldd forum, but the exact source is lost in the mists of time and memory, so apologies if I've copied someone's post.
Just as a follow up, I found that you are able to specify an on form variable named the same as QUERY_STRING. The variable is actually a reserved term for Lotus, so Lotus pre-fetches the variable before running the information out the browser.
Due to the pre-fetching, you are able to access the url information during the webQueryOpen event.
I hope this helps someone else looking for the same type of functionality.
-Kris

Resources