+ Start a Discussion
vasu yadavvasu yadav 

Test class code for below trigger?

Hi,

Could you please post the test class code for below mentioned trigger. I have tried but i am facing some issue.

public class SalesForceToProductViaTrigger {
    @future(callout=true)
    public static void SendCustomer(Id recordId){
        Account acc;
        string queryString='select Id,Name';
        Map<String,SObjectField> fmap=Schema.SObjectType.Account.fields.getMap();
        DescribeFieldResult f;
        for(SObjectField field:fmap.values()){
            f=field.getDescribe();
            if(f.isCustom()){
                queryString+=','+f.getName();
            }
        }
        queryString+=' from Account where id=\''+recordId+'\'';
        acc=(Account)Database.query(queryString)[0];
        //SalesForceToProduct.SendCustomer(acc);
        SalesForceToProduct.SendCustomerNew(acc);
    }
    @future
    public static void updateIsUpdateToFalse(Id recordId){
        update new Account(id=recordId,DTCisUpdateFromWebService__c=false);
    }

Thanks in advance
Vasu

}
Sandeep WaliaSandeep Walia
Hi Vasu,

Does't inserting an Account record and passing it's id in the function parameter provides code coverage?
If no then can you please share your test class code?

Hope this helps,
Sandeep