Question

I'm trying to find out how to run a script to edit a record before the it's actually called by the user. So far all events seem to be handled when there is some kind of interaction with the record.

This is to be able to automatically send emails with the customer's information upon creation.

Write into NS DB > Script updates user data and sends email > First view/edit is made.

Seems the previous admin managed using UE on beforeload, but that is not working anymore.

nlapiGetNewRecord().getId() --> returns an id not belonging to the record.

Any ideas how to trigger a script on creation?

Was it helpful?

Solution

Based on your requirement to send an e-mail on record creation, I don't see where the record editing takes place.

Though if you do want to edit the record just before it is created, you can use beforeSubmit(type) in a User Event script and have it run when type == "create".

Otherwise if no editing is needed, afterSubmit(type) in a User Event script and have it run when type == "create" should work just as well.

OTHER TIPS

If I understand your requirements, the editing code(assuming based on what you are saying that you are trying to edit the record that is created) should be written in a beforeRecordSubmit and the email sending should be done in afterRecordSubmit. This way you know the data you want to enter is written to the database correctly (brs) and the email is only sent if the record commits in the database correctly (afs).

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