Tip 17: Setting Checkbox in Suitescript 2.0

Hello Friends,

I am exploring Suitescript 2.0 recently and learning new things day by day and I believe I should share it with you all who are also learning Suitescript 2.0.

There are some features which either you won’t get it in document or its wrong in Developer Guide of Suitescript 2.0

Even though its mentioned that in Suitescript 2.0 Checkbox value returns true/false rather than “T”/”F” unlike in Suitescript 1.0, but remember, when you will set Checkbox value use “T”/”F” not true/false.

var fldObj = form.addField({
                    id: ‘custpage_fld_chkbox’,
                    type: serverWidget.FieldType.CHECKBOX,
                    label: ‘Extracting Account?’,
                    container : ‘custpage_tab1’
});
fldObj.defaultValue = ‘T’;

Hope this small tip will save your time and effort.

I will keep on adding tip on Suitescript 2.0

Happy Coding 🙂

 

Tip 10: Did you get an error “One or more cc emails are not valid” while running workflow in Netsuite??

While working on a requirement for sending email using workflow, I got an error

One or more cc emails are not valid.

I searched it in SuiteScript Error, but nothing helped.

Setting of CC field:

My requirement was to send email to cc emails which will be dynamic depending upon what user selects. So, I set the CC field(in Send Email action of workflow) value as internal ID of a field({custbody_cc_emails}), which holds multiple emails separated by comma.

When do I get the error:

While testing, I got to know that, I get the error, when user doesn’t select any email for CC. So custbody_cc_emails field is blank.

How to overcome the error:

I never get error on sending email, when the CC field is blank. They why error is coming, when the custbody_cc_emails field value is blank. It should simply carry the null value to CC field in Send Email action.

The Reason is still unknown to me.

But I found the way to get rid of that error, as User may or may not select the CC field({custbody_cc_emails}) in Transaction record. So we need the workflow to be worked in both the situations.

My Approach:

I have updated the Send Email action by setting condition formula as {custbody_cc_emails} is not null.

In this case CC field value is {custbody_cc_emails}.

I have created another Send Email Action, where I set the condition formula as {custbody_cc_emails} is null and left the CC field in Action as blank.

In this way, 1st Send Email action will be executed, when “custbody_cc_emails” field is not blank, and 2nd Send Email action will be executed when “custbody_cc_emails” field is blank.

Isn’t it cool 🙂

Thanks,

Asha

Tip 8: How to set dynamic CC field value in Workflow SendEmail action in Netsuite

Recently I got a very interesting requirement from one of my client.

Requirement:

User will create a Sales Order record, email will be sent to customer’s multiple contacts through workflow.

Existing Feature:

Netsuite provides a CC textbox field in Send Email action in workflow where you don’t have option to select any field.

Then how to fetch it???

After exploring in different ways I got a solution for it which I like to share with you all.

Solution:

Create a “Text Area” field let’s say “Contact Emails(custbody_contact_emails)” in Sales Order record and populate the Contact’s emails with comma(“,”) separated.

Contact Emails

In the Send Email action of workflow, set that custom field id ({custbody_contact_emails}) in the CC field  and save the state.

cc

Now execute the workflow and check, email is sent to the CC emails too 🙂 🙂

Isn’t it simple???

Thanks,

Asha

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

Tip 1 – How an Inactive workflow still sends email?

Some days back, I got an issue from client –

Getting emails even after deactivating the workflow which is responsible to send email.

Basically the workflow contains multiple states which include actions and transitions, where in each state, action is responsible to send email and transition responsible to delay 30 days to go to next state to send next email, and states are in loop.

So flow is like:

workflow_repeat_state

I have checked all possible cases, which may lead to send email, but all seems to be correct.

Workflow – Inactive checkbox is checked, Release Status is ‘Not Running’.

Then what caused the workflow running?

While searching possible solutions from Suite Answers, saw two simple sentences which brought my smile back.

Please note that setting a Workflow status to Inactive prevents further workflow initiation. However it does not cancel any record instances that are already in the workflow.

Link – https://netsuite.custhelp.com/app/answers/detail/a_id/32672/kw/workflow inactive

So, the workflow has been initiated already which contains states in loop. So even though new workflow istance is not initiated, but existing workflow instance causes sending emails.

Then how to stop that?

There may be two possible solutions:

  • You can delete any of transitions to break the loop.

  • Or if you don’t want to delete any transition for future purpose, you and inactivate the actions to prevent sending emails, even though transitions make flow of states within workflow.

Thanks to SuiteAnswers, got the root cause of the issue, really appreciated :)…..