解决方法:使用Apex Trigger在PO Receipt创建时更新与MDG相关的字段,并将结果传递给Ariba供应商。示例代码如下:
trigger updatePOReceipt on PO_Receipt__c (after insert) {
List aribaVendorsToUpdate = new List();
for (PO_Receipt__c receipt : Trigger.new) {
Id aribaVendorId = receipt.Ariba_Vendor__c;
Ariba_Vendor__c aribaVendorToUpdate = new Ariba_Vendor__c();
aribaVendorToUpdate.Id = aribaVendorId;
aribaVendorToUpdate.Ariba_PO_Receipt_Email__c = receipt.Email_Field__c;
aribaVendorsToUpdate.add(aribaVendorToUpdate);
}
try {
update aribaVendorsToUpdate;
} catch (DmlException e) {
System.debug('An error occurred: ' + e.getMessage());
}
}