Search code examples
netsuitesuitescript

Is there a way to find out if current Netsuite record is a subrecord of another record inside suitescript?


The problem:
I'm working on client script (pageInit entry) for Inventory Detail record (id: inventorydetail), but I need this script to run ONLY when this record (inventorydetail) is being loaded from Item Receipt record (not Item Fulfillment or any other).

Is there a way to get 'super' record type during script execution or can I specify this logic (run for inventory detail in context of item receipt only) in Ntesuite UI?

Note:
Script will have to change (or at least set default) values inside inventory detail form before any user changes or, ideally, it should catch user changes and perform some actions. SuiteScript2.0 preferably.


Solution

  • I am not sure if NetSuite has an API for it. Will have to check. But if there is no NetSuite API we can achieve it through JavaScript DOM. You can use window.parent.location.path in which you will get the reference off from which record the subrecord has been opened.