Tip 4 – Show Item textbox in saved search filter to allow user to enter Item name in Netsuite

We all are familiar with adding filters in Saved search, so that we can dynamically see the report by using those filters manually.

Recently I have a requirement, where user wants to have something like this:

A saved search needs to done where user will see which item is sold to which customer in a date range.

But as user is having more than 1000 items, he wants to enter the item name in stead of searching that particular item in dropdown.

Typing text in the dropdown is not going to be working……then what to do….. 😦

So after trying different methods….I got a very nice and easy solution….. 🙂

Procedure:

Step 1:

Create a saved search of Transaction type say “Track Item who and when sold”.

Step 2:

In Criteria -> Standard Filter:

Type: Sales Order

Formula(Text): select Item in Field and formula ‘starts with’ enter any string which will be set as default select every time you open the saved search. Let’s say “ai” is your default string to be passed.

filter_tip1

Step 3:

Select all the columns that you need to be displayed.

Step 4:

Open Available Filter and

1st enter Date Created in Filter -> select Show in Filter region.

Then enter Formula(Text) in Filter – > select Show in Filter region -> Add a label (Enter Item).

filter_tip2

Now click save & Run to see the result.

You must seeing all the Sales Order with customer Name who bought the item whose Name starts with ‘ai’/’AI’.

Now you can enter any name and hit outside the textbox, and new set of results will be displayed.

filter_tip3

Now 3 things need to be kept in mind:

Note 1:

Don’t forget to add Formula(Text) with field name(here its “Item”) and its default formula in Criteria filter, because in Available Filter you can’t choose field in Formula(Text), so you have to do that here.

Note 2:

Don’t click enter when you are inside the textbox(here its Enter Item textbox), else a csv file will be generated for each result set.

Hoping this will definitely save your time…… 🙂

Thanks,

Asha

Advertisements

Tip 3: Use dynamic value while sending email using email template in Netsuite and attach the email to record

Isn’t it a common requirement to use recipient’s name in an email?????…

Of course… YES….

So in Netsuite, when we use email template, we can set some standard field which represents the recipient’s name.

But when we have a requirement to use only First Name of the recipient(say customer’s first name) to greet in the email, we can’t use any standard field available in email template.

So here comes a simple solution to this: 🙂

In the email temple use any name(in CAPITAL letter) prefixed with NL like NLCUSTOMERFIRSTNAME whereever you want to replace with dynamic name.

Now in script write something like this:


function SendEmailToCustomer (recipientEmail, customerFullName, customerId) {
//Get Customer First Name
var firstName = (customerFullName.indexOf(‘ ‘) != -1) ?   customerFullName.split(‘ ‘)[0] : customerFullName;

//create object that contains mapping of custom tag to value & insert a value for Non-Native Tag “NLCUSTOMERFIRSTNAME
var dynamicReplaceParam = new Array();
dynamicReplaceParam[‘NLCUSTOMERFIRSTNAME ‘] = firstName;

//Merge with Email template with Job Applicant record
var emailMergeObj = nlapiMergeRecord(emailTemplateID, ‘customer’, customerId, null, null, dynamicReplaceParam);

/*Send Email using Values from merged object
merged objects’ getName() will return Subject you set on the Email template record
merged objects’ getValue() will returned Message body that has all dynamic values replaced by merge process*/
nlapiSendEmail(sender, recipientEmail, emailMergeObj.getName(), emailMergeObj.getValue(), null, null, null, null);
}


customerId, you can use to attach the email to Customer Record.

Important:

A small note to add: If you want to add the email to recipient’s record, then add InternalID of a single entity in recipient, so that it will automatically attached to the entity record. For more details refer SuiteScript Developer Guide –  “nlapiSendEmail(author, recipient, subject, body, cc, bcc, records,
attachments, notifySenderOnBounce, internalOnly)”

Please share your thoughts if you have something interesting to say related to this….

Thanks

Asha