Corey Schwoebel
06/11/2021, 1:54 PMCorey Schwoebel
06/11/2021, 1:55 PMdefine(['N/search', 'N/record'],
function(s, r) {
function afterSubmit(context){
try {
var pm = context.newRecord.getValue({fieldId: 'paymentmethod'})
log.debug({title: 'payment #', details: pm})
if(!(pm == 110 || pm == 111 || pm == 109 || pm == 8)) {
return
}
} catch(e) {
log.debug({title: 'error', details: e})
return
}
try {
var ptId = context.newRecord.getValue({fieldId: 'custbody_ng_paytrace_data_ref'})
var recId = context.newRecord.getValue({
fieldId: 'id'
})
var ptLookup = s.lookupFields({
type: 'customrecord_ng_paytrace_ref',
id: ptId,
columns: ['custrecord_ng_ptr_approval_code']
})
var rl = r.load({type: r.Type.CUSTOMER_PAYMENT, id: recId})
rl.setValue({fieldId: 'authcode', value: String(ptLookup.custrecord_ng_ptr_approval_code)})
rl.save()
log.debug({title: 'Auth Code', details: context.newRecord.getValue({fieldId: 'authcode'})})
log.debug({title: 'paytrace record ID', details: ptId})
log.debug({title: 'Pay trace Authorization Code field value', details: ptLookup.custrecord_ng_ptr_approval_code})
log.debug({title: 'Payment Record ID', details: recId})
} catch (e) {
log.debug({title: 'error', details: e})
}
}
return{
afterSubmit: afterSubmit
}
})
Corey Schwoebel
06/11/2021, 1:55 PMbattk
06/11/2021, 1:59 PMbattk
06/11/2021, 2:01 PMbattk
06/11/2021, 2:01 PMCorey Schwoebel
06/11/2021, 2:03 PMbattk
06/11/2021, 2:07 PMbattk
06/11/2021, 2:08 PMCorey Schwoebel
06/11/2021, 2:08 PMbattk
06/11/2021, 2:10 PMCorey Schwoebel
06/11/2021, 2:17 PMCorey Schwoebel
06/11/2021, 2:58 PM