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.
Related
I'm hoping someone can help. I recently wrote a SuiteScript 2.0 project. The primary suitelet displays transaction/customer info in a sublist that has a SublistType of LIST. Right now we're displaying 750 records in the list at a time, but there can potentially be hundreds or even thousands of additional records, so the users want to have a Next and Previous button that will allow them to cycle to the next page of results.
The problem is that I cannot seem to update that sublist for the life of me. The fields on the sublist are all text fields except for one checkbox. Inside of a CLIENT SCRIPT, I've been trying things similar to the code below. (I removed all but one of the setCurrentSublistValue calls to shorten the code):
var currentRec = currentRecord.get();
currentRec.selectLine({
sublistId: 'custpage_studstatement',
line: 0
});
currentRec.setCurrentSublistValue({
sublistId: 'custpage_studstatement',
fieldId: 'custpage_show',
value: false
});
currentRec.commitLine({sublistId: 'custpage_studstatement'});
It will spin through all of the sublist items, but ONLY the checkbox gets updated. None of the text fields change, and no exceptions are thrown.
If I change the sublist to type EDITOR, I can update all of the fields on the line without a problem. It basically behaves they way I want it to. Also, if I change the FieldDisplayType on any of the text fields, I can then update those individual fields, but neither of those options are acceptable. We don't want the users to be able to edit those fields/lines like that. The LIST sublist is the one we want, but I'm beginning to think you cannot update LIST sublists from a client script, even though the docs suggest that you can. (although it's not definitive. The docs are a bit sketchy)
So I guess I'm mostly just looking for a high level answer, because I'm not sure I'm even approaching this correctly. If you have a custom sublist that is just a LIST, how would you add the ability to page through to the next set of results? Should updating that sublist be done in the client script? If so, how? Or should it be in the suitelet? And if so, how? (I've tried some various things in the suitelet as well, but I'll omit that to keep this from getting any longer) Thanks in advance
I am making a few assumptions here:
Your suitelet creates a custom page - it has a sublist. The sublist is a form.sublist. and inside it are fields, sublist.addfields.
What you can do is use sublist.setSublistValue and it can populate the whole sublist.
Now, It depends on how you obtain the values of your sublist - you can have additional fields in the body - the bodys will define a filter that filters this search. This will scale down results shown in the page a lot to achieve the result you have.
You can indeed have next and previous page - of which you have your search object, and your next page/previous page button will impact your results.getRange() function - instead of for example getRange({start:0 end:1000}) to be getRange({start:1000 end:2000}) greater and beyond that. (This isn't the only way, but how I imagine I would do it)
Either way, how you get your dataset - a search.create will be in your suitelet, the getRange will be in your suitelet. How you setSublistValue will be in your suitelet. How you create your buttons will be in the suitelet.
But, the function that the button triggers will be in your client script, loaded via form.clientScriptModulePath = './xxx.js'; Something like that. This client script can trigger scripts via url.resolveScript, and trigger the suitelet to add params. Passing some parameter to indicate which 'page' to load (first set of results..second set.. etc.)
Hope this will point you in the right direction!
You can not update the sublist in suitelet using Client Script and with sublist being LIST type.
You can create Next and Previous button and on click of these button you can again hit the suitelet url from ClientScript and passing the pagenumber parameter and displaying the sublist dataset in forward and backward direction depending upon the value of pagenumber.
For eg:- if you are displaying 750 pages at one time then the first time you press Next your pagenumber parameter will be 2 and you will show next 750 entries in the page.
Is there a way to access a custom sublist on a custom record via suitescript? I have a record that users will enter criteria into that will then populate a bom in the sublists section via a saved search. Is there a way to access this data? When I try to run currentRecord.getSublists(), it says that it is not a function.
Any help is appreciated. Thanks!
Just in case people still run into this issue, it's a matter of dynamic vs static records.
currentRecord in a User Event is both a static record and cannot be "saved" (i.e. if you want to make changes in an afterSubmit method).
You'll want to record.load in dynamic mode to get what you are looking for.
var linect = rec.getLineItemCount('recmachcustrecord');
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.
I am appending 20 images in form by using loop.when i am scrolling these images up and down i want selected image index so that i can view bigger size of selected image.
i used this form.append(image)
is there any method or way to get selected item index in form like in list there is getSelectedIndex.
plz help me and provide me gud solution ..
The APIs for javax.microedition.lcdui.Form don't provide a means to get the selected item index, most likely because it wasn't designed for that kind of use. For the use case as described in your question, the correct approach would be to use javax.microedition.lcdui.List. In addition to determining the selected item, List also provides other useful APIs such as setting a select screen command for the items in the list.
Quick question. I want to generate code with SPMetal that includes the UniqueId field (the field that has the GUID for the list item), but somehow in Visual Studio I end up with either:
A list without that field
A list that in theory has that field (UniqueIdUniqueId.. why is it named that way?), but when I try to run it, throws me a NullException.
I'm using Sharepoint 2010, VS 2010.
Can you point me in the right direction? I'm stalled right now. I would paste you the XML file I've been using as parameters to SPMetal, but my servers are down right now. I'll post it ASAP, but if anyone has the answer on how to generate a class that includes that particular field, I'd be thankful.
Thanks!
The solution was: use the "GUID" hidden field. Duh.
I think is no way to include 'UniqueId', because is not a part of any content type.
If this realy need to get 'UniqueId', try write SQuery, which get item by ID with one viewField (to maximize performance).