Question

I could swear this worked a few versions back, but now it doesn't seem to.

My script creats a new Customer record, and I have a User Event (After Submit) deployed on the Customer record.

I've tried setting the record mode to be dynamic - even tried setting the sourcing to true, however, I can't seem to get the User Event to trigger after I create the record.

Here's a sample of what my script looks like, as you can see, it's quite simple:

var customerRecord = nlapiCreateRecord("customer", {recordmode: "dynamic"});
customerRecord.setFieldValue("companyname", "test company");

nlapiSubmitRecord(customerRecord, true, false);
Was it helpful?

Solution

From the NetSuite Help page titled What are User Event Scripts?:

User event scripts cannot be executed by other user event scripts. You can, however, execute a user event script from a call within a NetSuite scheduled script, a portlet script, or a Suitelet.

I am not sure if this is due to a recent release or not, but this could be why it is no longer working.

OTHER TIPS

Is the script that is creating the Customer record a User Event script also? If yes, then a User Event script cannot trigger another User Event script. NetSuite does not allow this.

You are right, I am also facing the same problem. After so many trials I find out that you cannot trigger user event from another user event. And 1 more thing, you can also not trigger any workflow attached to the record from user event.

You can not trigger a User Event Script from a user event script, but you can call a Suitelet within your User Event Script that you can use to trigger the other User Event Script to run.

This is shown here: https://videohub.oracle.com/media/SuiteScript+2.0+%26gtB+User+Event+Script+to+Trigger+another+User+Event+Script+using+Suitelet/1_vgt8ud6n

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top