The code is supposed to terminate if the UEType is...
# suitescript
k
The code is supposed to terminate if the UEType is not EDIT or not XEDIT, but it terminates even when I edit the record. The code works well if I remove
scriptContext.UserEventType.XEDIT
from the
if
statement. Can anyone help?
Copy code
function afterSubmit(scriptContext) {

        log.debug('Started', scriptContext.type);

        //if the event type is not EDIT, terminate the script
        if(scriptContext.type !== scriptContext.UserEventType.EDIT || scriptContext.type !== scriptContext.UserEventType.XEDIT){
            log.debug('Script terminated! Inappropriate type! See type!', scriptContext.type);
            return;
        }

        //get internal id of the current record
        var recId = scriptContext.newRecord.id;

        log.debug('Ended', recId);

    }
e
I think you want
&&
.
EDIT
is not
XEDIT
and vise versa
👍 1
k
Thank you!
e
Yes,
EDIT
is
NOT XEDIT
, therefore your
if
was always triggering
Boolean logic 😰
s
alternatively, you could move the conditional logic to a helper function
😍 1