Giter Site home page Giter Site logo

code-examples-apex's People

Contributors

aaronwds avatar meihds avatar paigesrossi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-examples-apex's Issues

I have written a trigger, But it send Duplicate mail

`trigger ContractConversion on Contract (before update) {
for(Contract con : trigger.new) {
if(con.Status == '03 - Email to Customer') {
sendEnvelope.sendEnvelopeMethod(con.accountId,con.ContractNumber);

    }
}

}

public class sendEnvelope {

@future(callout=true)
//add comments about source
public static void sendEnvelopeMethod(Id accountId,string ContractNumber) {

	Final String templateGuid = '7635114e-743a-418f-ba6a-1d95a9d51b89';
 	//TemplateId contains the DocuSign Id of the DocuSign Template
	Final dfsle.UUID TemplateId = dfsle.UUID.parse(templateGuid);

	Account account = [SELECT Id FROM Account WHERE Id = :accountId
		LIMIT 1
	];

	// Create an empty envelope with Account Id as the source Id
	dfsle.Envelope envelope = dfsle.EnvelopeService.getEmptyEnvelope(
    	new dfsle.Entity(account.Id));
    
	
	//Find your contact to add
	Contact Contact = [SELECT AccountId, Name, Email FROM Contact
    	WHERE accountId = :accountId
    	LIMIT 1
	];
    
	//use the Recipient.fromSource method to create the Recipient
	dfsle.Recipient Recipient = dfsle.Recipient.fromSource(
    	Contact.Name, // Recipient name
    	Contact.Email, // Recipient email
    	null, //Optional phone number
    	'Customer', //Role Name. Specify the exact role name from template
    	//source object for the Recipient - Account
    	new dfsle.Entity(Contact.Id));
  

	

	//add Recipient to the Envelope
	envelope = envelope.withRecipients (
		new List<dfsle.Recipient> { Recipient });

	//create a new document for the Envelope
	dfsle.Document myDocument = dfsle.Document.fromTemplate(
	TemplateId, // templateId in dfsle.UUID format
	'E-Signature Email Template Contract'); // name of the template

	//add document to the Envelope
	envelope = envelope.withDocuments(
    	new List<dfsle.Document> { myDocument });
    // Send the envelope. 
	envelope = dfsle.EnvelopeService.sendEnvelope(
    	envelope, // The envelope to send
    	true); // Send now parameter not actually part of this method.
}

}

docusign

`

Line: 3957, Column: 1 dfsle.APIException: The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line.

Hi,

I am getting this issue while sending the following code - Please help

Id mySourceId = 'myObjectId'; // The ID of the initiating Salesforce object
String templateId = 'myTemplateId'; // The ID of the DocuSign template

    // Create an empty envelope
    dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(
    new dfsle.Entity(mySourceId));
    // The initiating Salesforce entity

    // Use myEnvelope for later 
    // We will use a Salesforce contact record as a Recipient here
    Contact myContact = [SELECT Id, Name, Email FROM Contact LIMIT 1];

    //use the Recipient.fromSource method to create the Recipient
    dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(
        myContact.Name, // Recipient name
        '[email protected]', // Recipient email
        null, // Optional phone number
        'Signer 1', // Role Name. Specify the exact role name from template
        new dfsle.Entity(myContact.Id)); // Source object for the recipient

    // Add a recipient to the envelope
    myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient });

    // myTemplateId contains the DocuSign Id of the DocuSign Template
    dfsle.UUID myTemplateId = dfsle.UUID.parse(templateId);

    // create a new document for the Envelope
    dfsle.Document myDocument = dfsle.Document.fromTemplate(
        myTemplateId, // Template Id in dfsle.UUID format
        'myTemplate'); // Name of the template

    //add document to the envelope
    myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });

    // Send the envelope
    myEnvelope = dfsle.EnvelopeService.sendEnvelope(
        myEnvelope, // The envelope to send
        true); // True to send the envelope now

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.