Brendon Parker
03/03/2023, 9:06 PMafterSubmit(context) {
const statusPrevious = context.oldRecord?.getValue({ fieldId: "status" });
const statusNew = context.newRecord.getValue({ fieldId: "status" });
log.audit('afterSubmit', JSON.stringify({ statusPrevious, statusNew }));
}
statusPrevious
and statusNew
are the same value in the afterSubmit, even though I'm changing the fulfillment from Packed -> Shipped 🤔erictgrubaugh
03/03/2023, 9:44 PMJSON.stringify
an Object you pass to a log
method; it will do that automatically for you.Brendon Parker
03/03/2023, 9:44 PMBrendon Parker
03/03/2023, 9:45 PMoldRecord
const statusNew = context.newRecord.getValue({ fieldId: "shipstatus" });
const statusPrevious = context.newRecord.getValue({ fieldId: "originalshipstatus" });
erictgrubaugh
03/03/2023, 9:45 PMshipped
event type instead?Brendon Parker
03/03/2023, 9:46 PMoriginalshipstatus
isn't really documented that I can tell though. But holds the value I wanterictgrubaugh
03/03/2023, 9:47 PMcontext.type === context.UserEventType.SHIP
will get you the detection you needBrendon Parker
03/03/2023, 9:49 PMBrendon Parker
03/03/2023, 9:51 PM