RE: 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

Azi Rookie Asked on September 12, 2019 in SuiteScript.
Add Comment
5 Answers

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.