• Robert Koch 18
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I am testing a request to customize Signer 2 in my AddDocusignSigner apex class. The logic below works to add John Smith as Signer 2, so that the user John Smith gets an email sent to john.smith@testcompany.com. 

We got a request to keep the same email, but have the name of the CFO, Mary Jones in the Docusign envelope. 

So Signer 2 will have the name 'Mary Jones' and the email "john.smith@test company.com

I believe all that is needed is a slight change to lines 5 and 6 below. 

Can anyone help? Thank you!!!



1 public with sharing class AddDocusignSigner {
2
3   public static void addsigner(dsfs__DocuSign_Envelope__c[] newenvelope){
4
5 //Add John.
6 User cfouser = [select Id, Email, Name from User where Lastname ='Smith' and Firstname = 'John'];
7
8  dsfs__DocuSign_Envelope_Recipient__c nsign = new dsfs__DocuSign_Envelope_Recipient__c();
9  nsign.DSFS__DOCUSIGN_ENVELOPEID__C = newenvelope[0].Id;
10 nsign.DSFS__DSER_USERID__C = cfouser.Id;
11 nsign.DSFS__DOCUSIGN_RECIPIENT_ROLE__C = 'Customer 1';
12 nsign.DSFS__DOCUSIGN_SIGNATURE_NAME__C = cfouser.Name;
13  nsign.DSFS__DOCUSIGN_SIGNER_TYPE__C = 'Signer';
14  nsign.DSFS__ID_CHECK__C = FALSE;
15 nsign.DSFS__ROLENAME__C = 'Signer 2';
16  nsign.DSFS__ROUTING_ORDER__C = 2;
17 nsign.DSFS__SALESFORCE_RECIPIENT_TYPE__C = 'User';
 
Hello, I am running into a code coverage issue with one of my Apex classes. I cannot get the coverage for my class AddDocusignSigner over 53%. The 14 lines in bold below are the ones not covered. Any ideas?

public with sharing class AddDocusignSigner {

  public static void addsigner(dsfs__DocuSign_Envelope__c[] newenvelope){

    //Add Test.
    User cfouser = [select Id, Email, Name from User where Lastname ='Record' and Firstname = 'Test'];

    dsfs__DocuSign_Envelope_Recipient__c nsign = new dsfs__DocuSign_Envelope_Recipient__c();
    nsign.DSFS__DOCUSIGN_ENVELOPEID__C = newenvelope[0].Id;
    nsign.DSFS__DSER_USERID__C = cfouser.Id;
    nsign.DSFS__DOCUSIGN_RECIPIENT_ROLE__C = 'Customer 1';
    nsign.DSFS__DOCUSIGN_SIGNATURE_NAME__C = cfouser.Name;
    nsign.DSFS__DOCUSIGN_SIGNER_TYPE__C = 'Signer';
    nsign.DSFS__ID_CHECK__C = FALSE;
    nsign.DSFS__ROLENAME__C = 'Signer 2';
    nsign.DSFS__ROUTING_ORDER__C = 2;
    nsign.DSFS__SALESFORCE_RECIPIENT_TYPE__C = 'User';
    
    insert nsign;
        
        //Add the primary Opportunity Contact.
        if(newenvelope[0].dsfs__Source_Object__c != null){
          Key_Players_Influencers__c [] pUser = [select Id, Contact_Id__c, ContactName__c, Contact__c, Email__c from Key_Players_Influencers__c where Opportunity_ID__c =: newenvelope[0].dsfs__Source_Object__c and Is_Primary__c =: true];
            if(pUser.size() > 0){
                dsfs__DocuSign_Envelope_Recipient__c psign = new dsfs__DocuSign_Envelope_Recipient__c();
                psign.DSFS__DOCUSIGN_ENVELOPEID__C = newenvelope[0].Id;
                psign.dsfs__DSER_ContactID__c = pUser[0].Contact_Id__c;
                psign.DSFS__DOCUSIGN_RECIPIENT_ROLE__C = 'Customer 1';
                psign.DSFS__DOCUSIGN_SIGNATURE_NAME__C = pUser[0].ContactName__c;
                psign.DSFS__DOCUSIGN_SIGNER_TYPE__C = 'Signer';
                psign.DSFS__ID_CHECK__C = FALSE;
                psign.DSFS__ROLENAME__C = 'Signer 1';
                psign.DSFS__ROUTING_ORDER__C = 1;
                psign.DSFS__SALESFORCE_RECIPIENT_TYPE__C = 'Contact';
                psign.DSFS__ROLEVALUE__C = 1;
                psign.DSFS__LANGUAGECODE__C = 'en';
                psign.DSFS__LANGUAGE__C = 'English';
                
                insert psign
;     
            }
            
        }     
    }

    static testMethod void testAddDocusignSigner() {
        User cfouser2 = [select Id, Email, Name from User where Lastname ='Smith' and Firstname = 'John'];

        //New account.
        Account acct = new Account( 
            Name = 'Test Account 765',
            of_Licensed_Reps__c = 1,
            Finance_Region__c = 'Canada',
            Finance_Territory__c = 'National I',
            Total_Zarr__c = 100,
            Status__c = 'Active',
            Sales_Region__c = 'Midwest'
        );
        insert acct;

        //New contact.
        Contact con = new Contact(
            FirstName = 'Testing',
            LastName = '123',
            Email = 'testing123@awcomputing.com'
        );
        insert con;

        //New opportunity.
        Competing_Products__c CP = new Competing_Products__c(
            Name = 'None'
        );
        insert CP;

        Opportunity newFinOpp = new Opportunity(
            AccountId = acct.Id,
            Amount = 500.00,
            Name = 'Test Opp 1 - foo',
            Type = 'New Customer',
            CloseDate = date.today(),
            Are_Assets_Created__c = false,
            Finance_Approved__c = false,
            Competitor_s__c = 'none',
            Stage_4_Approved__c = date.valueOf('2011-03-01'),
            Competing_Product__c = CP.Id,                                    
            CurrencyIsoCode = 'USD',
            StageName = 'Demo'
        );
        insert newFinOpp;

        //New opportunity contact role.
        OpportunityContactRole oppContact = new OpportunityContactRole(
            ContactId = con.id,
            IsPrimary = true,
            OpportunityId = newFinOpp.id,
            Role = 'Power Sponsor'
        );
        insert oppContact;

        dsfs__DocuSign_Envelope__c nenv = new dsfs__DocuSign_Envelope__c();
        nenv.DSFS__SEND_REMINDER__C = FALSE;
        nenv.dsfs__Source_Object__c = newFinOpp.id;
        insert nenv;
    }
}
Where do I find the trigger that is updating Account type, when a new active Asset is created?
Hi Everyone,

I tried to Export the Records from Account object. I have many account records, but only 3 are able to extract.
I applied the filter condtion and then also tried, still same only same 3 records. Couldnayone please guide me what are the things need to be take care while extracting data.
Hello, I am running into a code coverage issue with one of my Apex classes. I cannot get the coverage for my class AddDocusignSigner over 53%. The 14 lines in bold below are the ones not covered. Any ideas?

public with sharing class AddDocusignSigner {

  public static void addsigner(dsfs__DocuSign_Envelope__c[] newenvelope){

    //Add Test.
    User cfouser = [select Id, Email, Name from User where Lastname ='Record' and Firstname = 'Test'];

    dsfs__DocuSign_Envelope_Recipient__c nsign = new dsfs__DocuSign_Envelope_Recipient__c();
    nsign.DSFS__DOCUSIGN_ENVELOPEID__C = newenvelope[0].Id;
    nsign.DSFS__DSER_USERID__C = cfouser.Id;
    nsign.DSFS__DOCUSIGN_RECIPIENT_ROLE__C = 'Customer 1';
    nsign.DSFS__DOCUSIGN_SIGNATURE_NAME__C = cfouser.Name;
    nsign.DSFS__DOCUSIGN_SIGNER_TYPE__C = 'Signer';
    nsign.DSFS__ID_CHECK__C = FALSE;
    nsign.DSFS__ROLENAME__C = 'Signer 2';
    nsign.DSFS__ROUTING_ORDER__C = 2;
    nsign.DSFS__SALESFORCE_RECIPIENT_TYPE__C = 'User';
    
    insert nsign;
        
        //Add the primary Opportunity Contact.
        if(newenvelope[0].dsfs__Source_Object__c != null){
          Key_Players_Influencers__c [] pUser = [select Id, Contact_Id__c, ContactName__c, Contact__c, Email__c from Key_Players_Influencers__c where Opportunity_ID__c =: newenvelope[0].dsfs__Source_Object__c and Is_Primary__c =: true];
            if(pUser.size() > 0){
                dsfs__DocuSign_Envelope_Recipient__c psign = new dsfs__DocuSign_Envelope_Recipient__c();
                psign.DSFS__DOCUSIGN_ENVELOPEID__C = newenvelope[0].Id;
                psign.dsfs__DSER_ContactID__c = pUser[0].Contact_Id__c;
                psign.DSFS__DOCUSIGN_RECIPIENT_ROLE__C = 'Customer 1';
                psign.DSFS__DOCUSIGN_SIGNATURE_NAME__C = pUser[0].ContactName__c;
                psign.DSFS__DOCUSIGN_SIGNER_TYPE__C = 'Signer';
                psign.DSFS__ID_CHECK__C = FALSE;
                psign.DSFS__ROLENAME__C = 'Signer 1';
                psign.DSFS__ROUTING_ORDER__C = 1;
                psign.DSFS__SALESFORCE_RECIPIENT_TYPE__C = 'Contact';
                psign.DSFS__ROLEVALUE__C = 1;
                psign.DSFS__LANGUAGECODE__C = 'en';
                psign.DSFS__LANGUAGE__C = 'English';
                
                insert psign
;     
            }
            
        }     
    }

    static testMethod void testAddDocusignSigner() {
        User cfouser2 = [select Id, Email, Name from User where Lastname ='Smith' and Firstname = 'John'];

        //New account.
        Account acct = new Account( 
            Name = 'Test Account 765',
            of_Licensed_Reps__c = 1,
            Finance_Region__c = 'Canada',
            Finance_Territory__c = 'National I',
            Total_Zarr__c = 100,
            Status__c = 'Active',
            Sales_Region__c = 'Midwest'
        );
        insert acct;

        //New contact.
        Contact con = new Contact(
            FirstName = 'Testing',
            LastName = '123',
            Email = 'testing123@awcomputing.com'
        );
        insert con;

        //New opportunity.
        Competing_Products__c CP = new Competing_Products__c(
            Name = 'None'
        );
        insert CP;

        Opportunity newFinOpp = new Opportunity(
            AccountId = acct.Id,
            Amount = 500.00,
            Name = 'Test Opp 1 - foo',
            Type = 'New Customer',
            CloseDate = date.today(),
            Are_Assets_Created__c = false,
            Finance_Approved__c = false,
            Competitor_s__c = 'none',
            Stage_4_Approved__c = date.valueOf('2011-03-01'),
            Competing_Product__c = CP.Id,                                    
            CurrencyIsoCode = 'USD',
            StageName = 'Demo'
        );
        insert newFinOpp;

        //New opportunity contact role.
        OpportunityContactRole oppContact = new OpportunityContactRole(
            ContactId = con.id,
            IsPrimary = true,
            OpportunityId = newFinOpp.id,
            Role = 'Power Sponsor'
        );
        insert oppContact;

        dsfs__DocuSign_Envelope__c nenv = new dsfs__DocuSign_Envelope__c();
        nenv.DSFS__SEND_REMINDER__C = FALSE;
        nenv.dsfs__Source_Object__c = newFinOpp.id;
        insert nenv;
    }
}
Where do I find the trigger that is updating Account type, when a new active Asset is created?