Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
BillingCalloutService :-------------------------------------public class BillingCalloutService { @future(callout = true) public static void callBillingService(String projectRef, Decimal billingAmount){ ServiceCredentials__c srvcCrd = ServiceCredentials__c.getValues('BillingServiceCredential'); BillingServiceProxy.project projectInst = new BillingServiceProxy.project(); projectInst.username = srvcCrd.Username__c; projectInst.password = srvcCrd.Password__c; projectInst.billAmount = billingAmount; BillingServiceProxy.InvoicesPortSoap11 invPortSoapInst = new BillingServiceProxy.InvoicesPortSoap11(); String response = invPortSoapInst.billProject(projectInst); List lstOfProjects = new List(); if(response != null && response.equalsIgnoreCase('OK')){ List lstOfPrjts = [SELECT Status__c FROM Project__c WHERE ProjectRef__c = :projectRef]; for(Project__c prjt : lstOfPrjts){ prjt.Status__c = 'Billed'; lstOfProjects.add(prjt); } UPDATE lstOfProjects; } }}ProjectTrigger :-----------------------------trigger ProjectTrigger on Project__c (after update) { if(Trigger.isAfter && Trigger.isUpdate){ for(Project__c prjt : Trigger.new){ if(prjt.Status__c != null && prjt.Status__c.equals('Billable')){ BillingCalloutService.callBillingService(prjt.ProjectRef__c, prjt.Billable_Amount__c); } } }}
BillingCalloutService :-
------------------------------------
public class BillingCalloutService {
@future(callout = true)
public static void callBillingService(String projectRef, Decimal billingAmount){
ServiceCredentials__c srvcCrd = ServiceCredentials__c.getValues('BillingServiceCredential');
BillingServiceProxy.project projectInst = new BillingServiceProxy.project();
projectInst.username = srvcCrd.Username__c;
projectInst.password = srvcCrd.Password__c;
projectInst.billAmount = billingAmount;
BillingServiceProxy.InvoicesPortSoap11 invPortSoapInst = new BillingServiceProxy.InvoicesPortSoap11();
String response = invPortSoapInst.billProject(projectInst);
List lstOfProjects = new List();
if(response != null && response.equalsIgnoreCase('OK')){
List lstOfPrjts = [SELECT Status__c FROM Project__c WHERE ProjectRef__c = :projectRef];
for(Project__c prjt : lstOfPrjts){
prjt.Status__c = 'Billed';
lstOfProjects.add(prjt);
}
UPDATE lstOfProjects;
}
}
}
ProjectTrigger :-
----------------------------
trigger ProjectTrigger on Project__c (after update) {
if(Trigger.isAfter && Trigger.isUpdate){
for(Project__c prjt : Trigger.new){
if(prjt.Status__c != null && prjt.Status__c.equals('Billable')){
BillingCalloutService.callBillingService(prjt.ProjectRef__c, prjt.Billable_Amount__c);
}
}
}
}