I didn't find any documentation on advanced customization.
I need to customize Sales Order in a more advanced way than basic customization offered in UI Customization Menu.
For example, add some sublists under Item section with a relation one to many between Item and Messages (1), or add a new button to display a new page to create a messages record page linked with the selected item (2).
Thank you!
Explicative Screenshot
NetSuite's current API does not accommodate the use of custom buttons inside sublists (unless you are using the native REFRESH or MARKALL button within a custom Suitelet).
An alternative solution to bridge the gap between the item record and the message record you want to create, why not do the following:
First, create a SUITELET which opens as a CHILD window of the current window on FIELDCHANGE of the item.
Second, add a basic TEXTAREA field and include the SUBMIT button to the suitelet.
On SUBMIT of the Suitelet, ccreate a new message record, attaching it to the current sales order.
Lastly - ensure the Suitelet closes itself.
Note: This solution will only work on EDIT of a sales order. It will not work on CREATE because no order ID would exist at the time you submit a message. (You need the order ID to attach the message to).
I hope this suggestion is clear.
You can do your customization on BeforeLoad in a UserEvent script : you can access the current form from the context and do somethings like adding buttons, sublists, hiding fields...
You can not add a button, but you can add a link pointing to a Suitelet where you can execute your actions. As an example, I created a sublist with a View link that points out to the line's custom record:
To define the field:
var idField = appStepsSublist.addField({
id: 'id',
type: serverWidget.FieldType.URL,
label: 'View'
});
idField.linkText = 'View';
To set Value :
var viewUrl = url.resolveRecord({
recordType: 'customrecord_nab_approval_step',
recordId: appStep.id,
isEditMode: false
});
usedSublist.setSublistValue({
id: 'id',
line: index,
value: viewUrl
});
In your case, you can use the URL module to get a Suitelet link and append to it the needed data from your current line.
Related
I'm writing a Chrome Extension and I need to add an item the context menu when right clicking a requester on the Mturk HIT Groups window. I've read how to add context menus but nothing seems to apply to adding an additional context item to an existing menu or how to connect that menu to my addition. Can someone point me to some documentation on how to accomplish that? TIA.
After a little more research I came up with this code:
chrome.contextMenus.create({
id: "autoselectid",
title: "Auto Select",
contexts: ["browser_action"],
parentId: parentid
});
This doesn't work as I get the error:
Unchecked runtime.lastError: Cannot find menu item with id 2037286881
Since I can't find that error in my context, I don't know where to go from here.
I don't know anything about MTurk but to add an new item to an already existing context menu you have to use chrome.contextMenus.create passing a new id and optionally the parentId as parameters (if that new item is nested inside another)
I want to display some read only URL in STRAPI collection page.
let's say I am at
/admin/plugins/content-manager/collectionType/application::my-public-form.my-public-form/1
now I have one field that need to display URL like this
https://myurl/1
is there is any way to get current url i.e. /admin/plugins/content-manager/collectionType/application::my-public-form.my-public-form/1
and in field I display https://myurl/1
This is going to be a lengthy answer, but let me try to simplify as much as possible.
Explanation:
To achieve this you need to simply create a field in the collection type and mark it as non-editable in the admin interface. This will make it a read-only property. Next, we need to override the afterFindOne from the lifecycle hooks of the model so that when it fetches the entry from the db, we can pre-populate the url for that particular entry, so that it's displayed in the read-only field in the UI.
Implementation:
Let's assume we are creating a collection-type called Student, which some basic field like first_name, last_name, dob and student_url. We are going to make the student_url field read-only in the following way:
Create the collection type Student as show in the screenshot.
Visit the newly created collection-type in the content-manager, click on Create new entry button, and then click on Configure view in the right hand panel.
Click on the small pencil icon which is besides the student_url field to open a popup, and then set the Editable property to False and click Finish.
At this point you're almost done, the only thing left to do is set the lifecycle hook to populate the student_url field when it's fetched from the database so that it's displayed correctly in our UI.
Create a lifecycles.js file in your model folder.
// src/api/student/content-types/student/lifecycles.js
module.exports = {
afterFindOne(event) {
const { result } = event;
// You can easily change this line to `/admin/plugins/content-manager/collectionType/application::my-public-form.my-public-form/${result.id}` in your project.
if (result) result.student_url = `https://example.com/${result.id}`;
},
};
And that's it. Now create an entry in the admin UI with the rest of editable fields and see entry being populated automatically with the student_url. Cheers!
I have been trying to get a alert in Netsuite for view mode but can't get it for customer record.
Though when I tried to get the alert for the edit record then I got it but I want it for view.
I tried client script, user event script and also workflow. But all support only for edit. Can I get the alert by any means for the view record option.
Thanks
Gladiator
One workaround that I've done is to add a custom field of type 'Inline HTML' to the customer form. Then during the beforeLoad event you can check if type == 'view' and update the custom field's value with the HTML that is needed to display the alert.
Basically form.setScript used to work with SS1 but there was no (not hacked) API access to Netsuite's alerts
SS2.0 gives nice access to the alert system but it doesn't load in view mode unless you take a supported action (clicking a button)
See this answer for a sample with SS2 that loads your script and shows an integrated alert.
SS2.0 Display Message on Record
Thanks Mike, Michoel and Bknights.
Here is the solution to the problem.
Create an inline html field on the customer form.
Since the field does not store value nlapiSetFieldValue for before load function works absolutely fine.
Below is the snippet of the working code.
function before_load(type)
{
if (type == 'view')
{
var pass_value = "<html><body><script type='text/javascript'>window.alert('Hello World!!!')</script></body></html>";
nlapiSetFieldValue("custentity25", pass_value); //custentity25 is the id of Inline HTML field we created
}
}
Note : The "" used should be different then the one used in the HTML code which is ''. If same are used then there will be an error.
You need to use a User Event Script, and in the before load event, set a Client Script via form.setScript(). In your "injected" Client Script, you can display the alert.
Hi fellow netsuite gurus,
My custom page hosts a parent record and in it i have a item sub list in a Child record. The problem happens when user tries to edit the line items by clicking on standard edit/remove buttons available on line items in edit mode. I have tried unchecking "Allow child record edit" and "Show Remove" options in the child record settings. but for logical reasons in our program, we cannot uncheck these options. So now the question is:
Has anyone figured out how to hide these buttons using client side code or any other setup feature?
Here's a suggestion:
Edit the record:
In Child Records subtab, do not select a tab for the child records to hide it
Create a saved search:
Check AVAILABLE AS SUBLIST VIEW.
In Results subtab, set OUTPUT TYPE as Result.
In Available Filters subtab, add the child record's field link to the parent record.
Edit the record, add the search as sublist view.
View the record and check the list, there should be no edit nor remove links.
How can I disable editing of the sublist using Suitescript user event (before load) in netsuite?
I also need to disable the inline editing.
Thank you.
You don't really need to disable editing before load, because no one can interact with sub-lists at this point. Sub-lists are like linked to the main record which means they load as the main record object loads, so the best way to prevent them from being edited is on the DOM.. which means making a form script or client-script (form preferably).
-If you know which form is used by the record go to it, else go to the record and look for "customize form" on the upper-right menu on the blue area.
-Then click on custom code.
-Add a script for "Validate Line Function" to prevent that line from being edited.
-Use the NetSuite example as a base, to prevent the line from editing you just have to return false.
function sampleValidateLine(type)
{
if ( (nlapiGetCurrentLineItemValue('item', 'custcol_service_item') == true) &&
(!nlapiGetCurrentLineItemText('item', 'custcol_service_rep')) )
{
alert("You must choose a Service Rep for this service item.");
return false;
}
return true;
}
Ideally in NetSuite you would restrict this based on permissions. For custom records, you can disable inline editing, and you can disable child record editing. The help documentation has this to say about it:
Check the Allow Child Record Editing box to allow records of this type
to be edited directly when they display as child records in a sublist
on a parent record.
https://system.netsuite.com/app/help/helpcenter.nl?topic=CARD_-29 see item 14.
You can also use form object to achieve the same. See sample code below:-
var form = scriptContext.form;
var serviceItemColumn = form.getSublist({id: 'timeitem'}).getField({id: 'item'});
serviceItemColumn.updateDisplayType({ displayType : 'disabled' })