How to get context.type =COPY

371 Views Asked by At

I have a userEvent beforesubmitr script. I am trying to detect the context.type as COPY. But, I get the context as CREATE. Please help.

1

There are 1 best solutions below

0
Krypton On

COPY is not a valid context.type on the beforeSubmit() event. It is only valid during beforeLoad().

Compare the documentation for beforeLoad(context) and beforeSubmit(context). You will see COPY is not listed under beforesubmit. This makes sense if you think about it; the copying all happens immediately after you click the Copy button in the UI, before the new (copied) record is displayed. After that, it's a new record in its own right, so on beforeSubmit it will have a context.type of CREATE.