You need to sign in to do that
Don't have an account?

need a help for test class
trigger tocallout on Opportunity (after insert, after update) { Set<id> accountids = new Set<id>(); for (Opportunity op : Trigger.new) { accountIds.add(op.AccountId); } Map<Id, Account> accountMap = new Map<Id, Account>([SELECT ia_crm__IntacctID__c FROM Account WHERE Id IN :accountIds]); String sName; for (Opportunity op : Trigger.new){ if(op.Account.ia_crm__IntacctID__c != null){ sName = accountMap.get(op.AccountId).ia_crm__IntacctID__c; } if (op.stagename == 'Contract Signed' && sName != null && (op.CC__c != null || op.Routing_Number__c != null)) { if (OpportunityTriggerHandlerclass.ShowRun == true) { OpportunityTriggerHandlerclasshandler = new OpportunityTriggerHandlerclass(); handler.sendCardToTP(op); } } } }
pls help for the test class...not able to cover..
sName = accountMap.get(op.AccountId).ia_crm__IntacctID__c;
{ if (OpportunityTriggerHandlerclass.ShowRun == true) { OpportunityTriggerHandlerclasshandler = new OpportunityTriggerHandlerclass(); handler.sendCardToTP(op); }
try the following code
All Answers
Insert a new Account and Opportunity and relate them by giving Account Id in the opportunity field "AccountId". Also, insert the field value of "ia_crm__IntacctID__c" so that it satisfies the If condition.
Hope it helps you.
To cover lines 12-14 you have to set Account.ia_crm__IntacctID__c field before you create an opportunity.
to the top of test method, where you're creating the account.Move the line
try the following code
field on Account ia_crm__Sync_With_Intacct__c = true (was false)
then this field ia_crm_Intacctid will get updated with the value.