SuiteScript 2.0 Intellisense create search filter - suitescript

I'm just starting out with suitescript, and I was wondering how to get the intellisense to work in suitescript 2.0 on creating a saved search.
I know this is easy to do on the netsuite UI but I would like to learn how to do it in Suitescript. Here is example code below. I'm trying to use ctrl + space to show options on the Customer type. I've tried adding ['N/record'] and it gave me options on records.Type.(here were the options) but I can't get it to give me anything inside the filter single quotes.
define(['N/search'],
function(search) {
var MYsearch = search.create({
type: search.Type.CUSTOMER,
title: 'My Customer search',
filters: ['', '', ''] // here is where i want intellisense
})
as a side question: Does anyone know a good place for suitescript 2.0 questions and answers? stackoverflow seems to be lacking. I'm assuming because it's pretty much brand new.
(I know of all the tutorials on the help center and SuiteAnswers)
Thanks for the help!
UPDATE: It looks like Netsuite 2.0 doesn't like Internal IDs... hope that helps.

I usually just create an array for filters, and another for columns, then add my filters to that array like sovar arrFilters = [];
arrFilters.push(search.createFilter({
name: 'mainline',
operator: search.Operator.IS,
values: ['F']
}));
arrFilters.push(search.createFilter({
name: 'trandate',
operator: search.Operator.WITHIN,
values: 'lastMonth',
}));
var arrColumns = [];
// invoiceid
arrColumns.push(search.createColumn({
name: 'internalid',
join: 'appliedtotransaction'
}));
Then you can just use your
search.create({
type: search.Type.VENDOR_PAYMENT,
filters: arrFilters,
columns: arrColumns
});

Hope this helps.
Download the latest SuiteCloud Developer IDE or the Eclipse Mars version (just make sure you have downloaded SuiteCloud plugin SuiteCloud IDE - http://system.netsuite.com/download/ide/update_e4). With this IDE, you will be able to have API code assist for SuiteScript 1.0. However, there is other setup to enable it for SuiteScript 2.0. Also, this will enable you to have intellesense for native fields.
Then if you want to include custom fields/columns, setup your master password at main menu >Netsuite>Master Password>.
Get the list of your accounts from the production, sandbox, and beta environment. Do this at main menu >Netsuite>Manage Account>. If you will be added to a new customer account later, you need to add it manually by doing this step again to reflect it.
Now, you need to connect your project folder to NetSuite account. But first, check the project setting by right clicking to the project folder>NetSuite>Change Project Settings>. Then, make sure you will be using the correct account.
Then log-in to the account by right clicking the project folder >NetSuite>Log in to Project Account>. Once successfully logged-in.
Finally, right click again the project folder >NetSuite>Sync Script IDs from Account>. Follow the instructions and select record type and fields.

Related

How can I use 'selectedPanel` in storybook?

I noticed a property in Storybooks Options Docs called selectedPanel which I assume will allow me to pre-select an addon panel.
I'm unclear on how to use it. The example is:
options: { selectedPanel: 'storybook/a11y/panel' }
What I don't understand is where the 'storybook/a11y/panel' string comes from. What if I want to preselect the 'Source' panel?
For anyone looking to default to the knobs panel: selectedPanel: 'storybookjs/knobs/panel' appears to work!
I've encountered the same issue and managed to find out that the panelId can at least be found in the addon's register source code step. For example, I wanted to open Readme tab for certain stories.
I ended up finding the id of the panel in registerWithPanelTitle.js, and then using it with the storiesOf API like this:
.addParameters({
options: { selectedPanel: 'REACT_STORYBOOK/readme/panel' },
})
For a11y, it can be found in constants.ts.
Although, I've searched for those in the distributed node_modules versions in my case.
P.S. If you want to reorder the panels for all of the stories globally, the list that the addons are imported in handles it.
I was using the #storybook/addons-essential in main.js and simply added #storybook/addon-controls to the front of the addons array option, like so:
module.exports = {
addons: ['#storybook/addon-controls', '#storybook/addon-essentials'],
...
}
This puts the controls tab first, which is auto-selected.

How to open a record on a subgrid using easyrepro?

https://github.com/Microsoft/EasyRepro/issues/178
Hi all,
I am using dynamics365 version 9.x
Using EasyRepro I can navigate into an account via the global search and then also use the xrmBrowser.Entity.ClickSubgridAddButton("foobar"); function to create a new record of that 'foobar' type. By doing this I know I am accessing the correct subgrid on the account record.
My question is....which function would I use to simply open up the record I have created. I have tried SelectSubgridLookup but I don't think that is the function I am looking for.
From the image you can see I have created the 'bonno bonno' contact but I cannot open the record using EasyRepro. any help would be greatly appreciated! :)
https://github.com/Microsoft/EasyRepro/issues/178
Hello #darthtang - sorry for the delayed reply to your post here. From reviewing, it appears this is a feature gap and needs to be enhanced.
While not ideal, if you wanted to open the record, you could try the following instead:
xrmBrowser.Entity.ClickSubgridGridViewButton(subgridName)
This should take you to the 'Associated View' via Related Navigation. From here, you could call:
optional:
xrmbrowser.Related.Search(contactrecordname);
xrmBrowser.Related.OpenGridRow(#)
At this point, you could then switch back to perform actions on the opened Contact entity record:
xrmBrowser.Entity.SomeMethod();
Please let me know if this set of steps help you with your scenario. I've added a feature enhancement to the backlog to allow opening of a record from a subgrid on a form.

Meteor how to save templates in mongo

I want to give my users the possibility to create document templates (contracts, emails, etc.)
The best option I figured out would be to store these document templates in mongo (maybe I'm wrong...)
I've been searching for a couple of hours now but I can't figure out how to render these document template with their data context.
Example:
Template stored in Mongo: "Dear {{firstname}}"
data context: {firstname: "Tom"}
On Tom's website, He should read: "Dear Tom"
How can I do this?
EDIT
After some researches, I discovered a package called spacebars-compiler that brings the option to compile to the client:
meteor add spacebars-compiler
I then tried something like this:
Template.doctypesList.rendered = ->
content = "<div>" + this.data.content + "</div>"
template = Spacebars.compile content
rendered = UI.dynamic(template,{name:"nicolas"})
UI.insert(rendered, $(this).closest(".widget-body"))
but it doesn't work.
the template gets compiled but then, I don't know how to interpret it with its data context and to send it back to the web page.
EDIT 2
I'm getting closer thanks to Tom.
This is what I did:
Template.doctypesList.rendered = ->
content = this.data.content
console.log content
templateName = "template_#{this.data._id}"
Template.__define__(templateName, () -> content)
rendered = UI.renderWithData(eval("Template.#{templateName}"),{name:"nicolas"})
UI.insert(rendered, $("#content_" + this.data._id).get(0))
This works excepted the fact that the name is not injected into the template. UI.renderWithData renders the template but without the data context...
The thing your are missing is the call to (undocumented!) Template.__define__ which requires the template name (pick something unique and clever) as the first argument and the render function which you get from your space bars compiler. When it is done you can use {{> UI.dynamic}} as #Slava suggested.
There is also another way to do it, by using UI.Component API, but I guess it's pretty unstable at the moment, so maybe I will skip this, at least for now.
Use UI.dynamic: https://www.discovermeteor.com/blog/blaze-dynamic-template-includes/
It is fairly new and didn't make its way to docs for some reason.
There are few ways to achieve what you want, but I would do it like this:
You're probably already using underscore.js, if not Meteor has core package for it.
You could use underscore templates (http://underscorejs.org/#template) like this:
var templateString = 'Dear <%= firstname %>'
and later compile it using
_.template(templateString, {firstname: "Tom"})
to get Dear Tom.
Of course you can store templateString in MongoDB in the meantime.
You can set delimiters to whatever you want, <%= %> is just the default.
Compiled template is essentially htmljs notation Meteor uses (or so I suppose) and it uses Template.template_name.lookup to render correct data. Check in console if Template.template_name.lookup("data_helper")() returns the correct data.
I recently had to solve this exact (or similar) problem of compiling templates client side. You need to make sure the order of things is like this:
Compiled template is present on client
Template data is present (verify with Template.template_name.lookup("data_name")() )
Render the template on page now
To compile the template, as #apendua have suggested, use (this is how I use it and it works for me)
Template.__define__(name, eval(Spacebars.compile(
newHtml, {
isTemplate: true,
sourceName: 'Template "' + name + '"'
}
)));
After this you need to make sure the data you want to render in template is available before you actually render the template on page. This is what I use for rendering template on page:
UI.DomRange.insert(UI.render(Template.template_name).dom, document.body);
Although my use case for rendering templates client side is somewhat different (my task was to live update the changed template overriding meteor's hot code push), but this worked best among different methods of rendering the template.
You can check my very early stage package which does this here: https://github.com/channikhabra/meteor-live-update/blob/master/js/live-update.js
I am fairly new to real-world programming so my code might be ugly, but may be it'll give you some pointers to solve your problem. (If you find me doing something stupid in there, or see something which is better done some other way, please feel free to drop a comment. That's the only way I get feedback for improvement as I am new and essentially code alone sitting in my dark corner).

Component will not delete

I'm doing a bit tidy of the Content Manager and have a component that won't delete (not the same as my other question).
When I try to delete the component in question I get the following error
(8004032D) This item is in use.
Unable to delete Component (tcm:4-65020).
UtilitiesBL.AssertItemCanBeDeleted
UtilitiesBL.AssertItemCanBeDeleted
ComponentBL.Delete
Component.Delete
Request.Delete
When I use the Where Used tool on the component I get no results in the "Used In" tab, one result in the "Uses" tab, the "Blueprint Hierachy" shows it is not localized in any of my three child publications and no results in the "Published To" tab.
I have had a look in the Content Manager database to see if I can spot what is going wrong but not really found anything.
Any ideas?
Thanks in advance.
It looks like the Where Used tool in R5.3 isn't working correctly. The component in question is used in 15000 other components. I found this by using the TOM API directly.
var componentID = "tcm:4-65020";
TDS.TDSE tdse = new TDS.TDSE();
var component = (TDS.Component)tdse.GetObject(componentID, TDSDefines.EnumOpenMode.OpenModeView);
var whereUsedString = component .Info.GetListUsingItems();
Now comes the task of deleting all these links...

SqlProfileProvider - can you use Profile.GetProfile() in a project?

I am attempting to use the SqlProfileProvider in an application and can't seem to use it the way I want to. I would like to be able to simply call up a profile like this:
Profile p = Profile.GetProfile("naspinski");
p.Organization = "new_org";
but I can't seem to find the correct way to use the GetProfile() that I seem to see scattered around the net. Is there a way to grab, read and modify profiles?
I am using it in MVC 3 and will not be actually logging in as the specific user, this will be pulling users from the db that are specified. Thank you.
To retrieve the profile:
var profile = ProfileBase.Create(HttpContext.Profile.UserName, true);
And here's the MSDN documentation. And a nice blog post about custom profiles.

Resources