Joe St. Clair
11/19/2021, 2:15 PMmightyd3
11/19/2021, 3:06 PMJoe St. Clair
11/19/2021, 3:07 PMmightyd3
11/19/2021, 3:07 PMmightyd3
11/19/2021, 3:08 PMJoe St. Clair
11/19/2021, 3:10 PMmightyd3
11/19/2021, 3:11 PMmightyd3
11/19/2021, 3:12 PMJoe St. Clair
11/19/2021, 3:12 PMmightyd3
11/19/2021, 3:12 PMmightyd3
11/19/2021, 3:13 PMmightyd3
11/19/2021, 3:13 PMmightyd3
11/19/2021, 3:13 PMstalbert
11/19/2021, 3:18 PMmightyd3
11/19/2021, 3:18 PMmightyd3
11/19/2021, 3:19 PMmightyd3
11/19/2021, 3:19 PMJoe St. Clair
11/19/2021, 3:28 PMstalbert
11/19/2021, 4:05 PMmightyd3
11/19/2021, 4:08 PMmightyd3
11/19/2021, 5:00 PMstalbert
11/19/2021, 5:04 PMfind function do you mean Array.find()?stalbert
11/19/2021, 5:06 PMmightyd3
11/19/2021, 5:07 PMstalbert
11/19/2021, 5:08 PMnew 🙂mightyd3
11/19/2021, 5:08 PMstalbert
11/19/2021, 5:09 PMJoe St. Clair
11/19/2021, 5:10 PMfunction afterSubmit(context) {
RemainingUnitUsageLogger.logRemainingUsage("shiphawk_update_fulfillment", "ON START")
log.debug({ title: "afterSubmit", details: context });
if (!isEventValid(context)) {
return
}
const fulfillmentId = context.newRecord.getValue({ fieldId: 'id' });
const orderId = context.newRecord.getValue({ fieldId: 'createdfrom' });
let fulfillment;
if (context.type == context.UserEventType.DELETE) {
fulfillment = new ItemFulfillment(context.newRecord);
if (fulfillment.settings.isSyncIFAsOrders) {
fulfillment.asOrder.delete();
} else if (orderId) {
deleteRequest(orderId, fulfillmentId, runtime.accountId);
}
return;
};
fulfillment = ItemFulfillment.find(fulfillmentId);
fulfillment.sync();
};Joe St. Clair
11/19/2021, 5:11 PMstalbert
11/19/2021, 5:22 PMnew ItemFulfillment(context.newRecord) looks just like NFT, but obviously they have something else going on there (i.e. NFT has no .find() on the ItemFulfillment class). The code doens't tell us what .find() does in that case. Maybe they have ItemFulfillment extends Array?stalbert
11/19/2021, 5:23 PMItemFulfillmentbattk
11/19/2021, 5:24 PMstalbert
11/19/2021, 5:26 PMfind is a static method then it's the internals of that which is likely blowing up.Joe St. Clair
11/19/2021, 5:26 PMstalbert
11/19/2021, 5:28 PMItemFulfillment.find() you could learn more by inspecting it.Joe St. Clair
11/19/2021, 5:42 PMstalbert
11/19/2021, 5:58 PMCounterEntry() somewhere which will fail (and should) if CounterEntry is a class.stalbert
11/19/2021, 5:59 PMstalbert
11/19/2021, 6:00 PMJoe St. Clair
11/19/2021, 8:43 PM