How to hide manage attachments button on record producer

Deepthi25
Giga Expert

HI,

Can you please suggest how to remove edit buton for only 1 record producer.

For this I am trying on load client script as follow, but it is not working can any suggest on this.

function onLoad() {

document.getElementById('header_add_attachment').style.display = 'none';

}

And I need to give "Add attachments" link/button on middle of form and when I click that link/button it shouls be able to upload 1 file and save it in "ATTACHMENTS" table.

Thanks

1 ACCEPTED SOLUTION

Hi Radhika,



It should be


function onLoad() {


  g_form.disableAttachments()


}



View solution in original post

14 REPLIES 14

Deepthi25
Giga Expert

Hi Pradeep & Harsh,



Both worked thanks a lot for both 🙂



Any idea that Ican keep a link/button in middle of form and save that attchment in "attachment" table


Thanks Radhika for the update.


Please refer below link on how you can add attachment as button. However please make sure that your client script doesn't conflict with this.


Create a custom attachment button for your service catalog


Adding attachment button to service catalog request


Worked thanks a lot


Awesome.


Would you marking response as correct and close the loop.


function onSubmit() {


  //var cat_id = gel('sysparm_item_guid').value;   g_form.getParameter("sysparm_item_guid")


  var cat_id =g_form.getParameter("sysparm_item_guid");


  var gr = new GlideRecord("sys_attachment");


  gr.addQuery("table_name", "u_supporting_document_submission_request");


  gr.addQuery("table_sys_id", cat_id);


  gr.query();


  if (!gr.next()) {


  alert("You must attach a file to submit.");


  return false;


  }


}




Hi pradeep,


I have written this code for onsubmit to do attachment mandatory, but after have choosen attachment also aert is remaining same.it is not going to submit the form.