I have a Customer Deposit record. when i click Apply button on that record, a Deposit Application record is created and opened. If i click Save on that Deposit Application record, a Journal record should be created. which script type should i take?
n
Nathan L
04/04/2023, 1:49 PM
Probably a user event script.
v
vennila ramasamy
04/04/2023, 1:52 PM
afterSubmit?
n
Nathan L
04/04/2023, 1:52 PM
What is it youre trying to do
Nathan L
04/04/2023, 1:52 PM
oh create the journal?
Nathan L
04/04/2023, 1:56 PM
So you have two options right. Before and After Submit.
Depending on what you are wanting the final outcome to be kind of dictates what you want to use.
Generally speaking the way i look at it is
beforeSubmit: If the Journal absolutely has to be created when the DA is created or else the DA is invalid. That way they DA doesn't get committed to the database if something errors out or doesnt work.
afterSubmit: Proabably the best bet. You want to most likely make sure all the user input is saved and committed to the DB first. Then create your journal
Nathan L
04/04/2023, 1:56 PM
tl;dr probably afterSubmit unless there are special circumstances