Is there is a way to not display the `remove` field on a custom sublist when in view mode only?

Is there is a way to not display the `remove` field on a custom sublist when in view mode only? It causes issues since User Event scripts don’t run in View mode

Rookie Asked on September 12, 2019 in SuiteScript.
Add Comment
5 Answer(s)

Alternatively – if you make your field mandatory- then you can’t remove it. Clicking on it does nothing. Then you can workflow the field as not mandatory while viewing the child record in edit mode.

Advanced Answered on September 12, 2019.
Add Comment

I’m only aware of the hacky way – inspect element to get the Remove <a> id – should be something like remove1href. Then using an inline html field modify the dom on load to set that element display to none.

 

Also see @dbarnett answer. My suggestion is for standard records – i.e contact/customer.

Rookie Answered on September 12, 2019.
Add Comment

Is this implemented via parent-child custom records? If so, there is an checkbox option on the custom record definition “Show Remove Link” which will accomplish this.

Intermediate Answered on September 12, 2019.

So I tried this, but the problem is that this removes the ability to allow child record editing and deleting even when in edit mode.

on September 12, 2019.
Add Comment

Yes, it can be done by manipulating DOM. I did the same several years ago using Mutation Observer to modify the HTML when the paginated data is served by NetSuite because it refreshes the table everytime. I believe that the data is being served in same fashion. You need to inject the client script via userevent’s beforeload trigger to remove the links column. You must also need to take care the cross-browser behavior of DOM manipulation. I hope this may help you.

Rookie Answered on September 12, 2019.
Add Comment

Sharing this if anyone else is looking for a solution. Was able to do it via User Event > BeforeLoad:

var hideFld = form.addField({
                        id:’custpage_hide_buttons’,
                        label:’not shown – hidden’,
                        type: serverWidget.FieldType.INLINEHTML
                    });
//for every element you want to hide, modify the scr += line
 var scr = “”;
// On Edit Mode, inspect element to get ID of the Remove button.

  scr += ‘jQuery(“#recmachcustrecord_id_remove”).hide();’;
// On View Mode
scr += `jQuery(‘a:contains(“Remove”)’).hide();`;
//push the script into the field so that it fires and does its handy work
hideFld.defaultValue = “<script>jQuery(function($){require([], function(){” + scr + “;})})</script>”;
Rookie Answered on April 5, 2022.

Will this solution work if a sublist has more than 25 lines i.e. paginated data and select the 2nd page and switching the pages under sublist?

on April 5, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor