You need to sign in to do that
Don't have an account?
Akash Garg 2
want test class for trigger
Hi
I want to write a test class to increase code coverage for below mention trigger.
Can anyone help.
I want to write a test class to increase code coverage for below mention trigger.
Can anyone help.
trigger paymenttermUpdate on Account (after update) { set<Id> acctIds = new set<Id>(); map<Id, Account> mapAccount = new map<Id, Account>(); list<Payment_Terms__c> listContact = new list<Payment_Terms__c>(); for(Account acct : trigger.new) { acctIds.add(acct.Id); mapAccount.put(acct.Id, acct); } listContact = [SELECT Name, Payment_Terms__c,Account__c FROM Payment_Terms__c WHERE Account__c IN : acctIds]; if(listContact.size() > 0) { for(Payment_Terms__c con : listContact) { con.Name = mapAccount.get(con.Account__c).Payment_Term_on_account_picklist__c; con.Payment_Terms__c = mapAccount.get(con.Account__c).Payment_Term_on_account_picklist__c; } update listContact; } }
Try something like this.Let us know of this works.
I considered the Payment_Terms__c field as a text field on Payment_Terms__c object.
All Answers
Try something like this.Let us know of this works.
I considered the Payment_Terms__c field as a text field on Payment_Terms__c object.
you are saviour.
It works perfect