0
votes

I have few questions related to NetSuite:

  1. On the NetSuite help page, the User Event scripts are stated to execute on servers.

    In that case if a record is updated in NetSuite indirectly*, it should still trigger the User Event script associated with it, right?

    *By indirectly I mean a user does not navigate to the record in a browser and clicks on Edit and Save. An example usecase would be, when a customer payment is made against an Invoice, it updates the Amount due on the Invoice automatically. But it does not trigger the UserEvent Script deployed on the Invoice.

    Please let me know if my understanding is correct. Also, could you please give me a way to execute a script when a record is updated both directly and indirectly.

  2. Is there a way to execute a script (make a REST call) when a File is uploaded. I am not able to see it under script deployments for User Event scripts.

Thanks in advance!

2

2 Answers

0
votes

The event type that you mentioned, it will not trigger a user event script. Just like the user event script deployed on sales order, it will not be executed when the sales order got fulfilled. Based on my experience changes on the status of a transaction caused by creating another transaction will not trigger UE script. You can deploy a UE script too on Customer Payment record that would process the invoice that is being paid.

File record is not yet supported in SuiteScript. When I say not supported, you cannot deploy a script to it.

0
votes

1) This is correct yes. You can however select "Execute in commerce context" on your UE script, which means the script will be triggered if a Sales Order is created from outside of NetSuite, on a web store for instance - which is integrated with the NetSuite account.

2) Don't you want to send the file from NetSuite, rather than polling for it from a different system?

You will then need to first load the record as follows in your script(SuiteScript 2.0):

var curRec = scriptContext.newRecord;

curRec = record.load({
    type: record.Type.PURCHASE_ORDER,
    id: curRec.id,
    isDynamic: false
});

curRec will contain all detail of the record.