i have a MR script to apply customer refund from credit memo. Below is my reduce function
function reduce(context){
var parsedValues = JSON.parse(context.values[0]);
log.debug('parsedValues',parsedValues);
var parsedValuesCreditMemoInternalId = parsedValues.values['GROUP(internalid.transaction)'].value;
var parsedValuesCustomerID = parsedValues.values['GROUP(internalid)'].value;
log.debug('parsedValuesCustomer',parsedValuesCustomerID);
log.debug('parsedValuesCreditMemoInternalId',parsedValuesCreditMemoInternalId);
var rec = currentRecord.get();
log.debug('rec',rec);
var refundRecord = record.create({
type : record.Type.CUSTOMER_REFUND,
defaultValues : {
customer : parsedValuesCustomerID
}
});
log.debug('refundRecord',refundRecord);
/*refundRecord.setSublistValue({
sublistId : 'apply',
fieldId : 'apply',
value : true,
line : 0
});*/
var refundRecordID = refundRecord.save();
log.debug('refundRecordID',refundRecordID);
var refundRecordLineCount = refundRecord.getLineCount({sublistId: 'apply'});
log.debug('refundRecordLineCount',refundRecordLineCount);
}
In this i am not able to get the log, meaning it is not creating a record.But i can do it manually. what could be the reason?