Hi all. There may be a strange question, but maybe...
# suitescript
d
Hi all. There may be a strange question, but maybe someone knows if it is possible to distinct BeforeSubmit context from AfterSubmit context in the runtime? Maybe there are any fields or functions present in one and missing from another?
b
This sounds weird
Why do you need this
d
I want to write a universal logger that would know how to format logs for different types of scripts
If there is another way to identify a triggering function, that will also work
Didn't find anything in N/runtime
b
dont think so
the weird solution is throwing an error and parsing the stack
d
Yes, also think about that. 🙂
e
This is a little weird but probably you can identify that only in the creation of a record, due that in a before submit the internal Id does not exist yet. For the rest of scenarios that is not possible. You might need to pass a parameter from the event you would call your logger
d
N/error object works perfectly! Don't even need to throw it. Thanks everyone!
✔️ 1