This topic contains 3 replies, has 0 voices, and was last updated by chanarbon 7 years, 10 months ago.
-
AuthorPosts
-
December 19, 2016 at 8:42 pm #1387
irfansWe have customer records in NetSuite CRM module with additional custom records linked to the customer record. We have a custom field on customer record “customer status”.
Based on customer status we want to disable new custom record (in this case new service record) button. I am able to use beforeLoad script to disable button on main customer record but similar approach fails when I try to disable button associated with linked record.
/** * @NApiVersion 2.0 * @NScriptType UserEventScript */ define([“N/log”, “N/ui/serverWidget”], function(log,ui) { function disableNewCaseButton(context){ if (context.type == context.UserEventType.VIEW){ var customerStatus = context.newRecord.getValue({“fieldId” : “custentitycustomer_status”}); if (customerStatus !== 1){ var newButton = context.form.getButton({ id: ‘newrecrecmachcustrecordso_customer_name’ }) try{ newButton.isDisabled = true; } catch(e){ log.debug({ title : “error”, details: e }); } } return; } } return { beforeLoad: disableNewCaseButton } });
This is a cached copy. Click here to see the original post. -
December 20, 2016 at 8:43 am #1388
zackb22You could inject a jquery formula into an inline field on the form to have it not show the button. You can put in your SuiteScript and then find the value of the field on the page and remove it if it fits your criteria.
That button is on a sublist, so it may be hard to access normally with a script.
Keep in mind that the jquery injection is not supported officially by NetSuite.
-
December 26, 2016 at 12:25 am #1389
saenzmarianoHey guys, this is the wrong sub-forum for your question. You might find more replies if you move it to the SuiteScript sub-forum.
-
January 3, 2017 at 3:14 am #1390
chanarbon@irfans
Checking on your code, you are using SuiteScript 2.0 so better transfer the topic into the SuiteScript 2.0 sub-forum. Also here’s the list of buttons and button ids supported for SuiteScript object buttons (https://netsuite.custhelp.com/app/an.
-
AuthorPosts
You must be logged in to reply to this topic.