- 10 Oct 2024
- 4 Minutes to read
- DarkLight
- PDF
Creating a Transaction for a Sender
- Updated on 10 Oct 2024
- 4 Minutes to read
- DarkLight
- PDF
Java SDK
To download the full code sample see our Code Share site.
When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.
The following code will do this:
DocumentPackage pkg1 = PackageBuilder.newPackageNamed("Create on behalf of sender - " + System.currentTimeMillis())
.withSigner(SignerBuilder.newSignerWithEmail("signer1@example.com" )
.withFirstName("John")
.withLastName("Smith"))
.withDocument(DocumentBuilder.newDocumentWithName("document 1")
.fromFile("your_file_path")
.withSignature(SignatureBuilder.signatureFor("signer1@example.com")
.onPage(0)
.atPosition(100, 100)
.withSize(250, 75)))
.withSenderInfo(SenderInfoBuilder.newSenderInfo("your_sender_email"))
.withVisibility(Visibility.ACCOUNT) //only works for templates
.build();
Note that you do not need to add the new Sender as a recipient.
Once you have done this, create the transaction or template. The following code will do this:
PackageId packageId = eslClient.createPackageOneStep(pkg1); //package creation
PackageId templateId = eslClient.getTemplateService().createTemplate(pkg1); //template creation
Results
Once you have created your transaction or template, note the following:
In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.
.NET SDK
To download the full code sample see our Code Share site.
When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.
The following code will do this:
DocumentPackage pkg = PackageBuilder.NewPackageNamed("Create on behalf of sender - " + System.DateTime.Now)
.WithSigner(SignerBuilder.NewSignerWithEmail("signer1@example.com")
.WithFirstName("John")
.WithLastName("Smith"))
.WithDocument(DocumentBuilder.NewDocumentNamed("document 1")
.FromFile("your_file_path")
.WithSignature(SignatureBuilder.SignatureFor("signer1@example.com")
.OnPage(0)
.AtPosition(100, 100)
.WithSize(250, 75)))
.WithSenderInfo(SenderInfoBuilder.NewSenderInfo("your_sender_email"))
.WithVisibility(Visibility.ACCOUNT) //only works for templates
.Build();
Note that you do not need to add the new Sender as a recipient.
Once you have done this, create the transaction or template. The following code will do this:
PackageId packageId = eslClient.CreatePackageOneStep(pkg); //package creation
PackageId templateId = eslClient.CreateTemplate(pkg); //template creation
Results
Once you have created your transaction or template, note the following:
In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.
REST API
To download the full code sample see our Code Share site.
When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.
The following request below shows you how to build your package JSON in order to assign a new package sender/owner:
HTTP Request
POST /api/packages
HTTP Headers
Authorization: Basic api_key
Accept: application/json
Content-Type: application/json
Request Payload
{
"status": "DRAFT",
"description": "A test transaction for 'sender on behalf of sender'",
"language": "en",
"type": "PACKAGE",
"name": "Sender On Behalf Of Sender",
"sender": {
"email": "your_sender_email"
}
}
Response Payload
{
"id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="
}
To create a template on behalf of your sender, use the following payload, with same API as shown above:
{
"status": "DRAFT",
"description": "A test transaction for 'sender on behalf of sender'",
"language": "en",
"type": "TEMPLATE",
"visibility":"ACCOUNT",
"name": "Sender On Behalf Of Sender",
"sender": {
"email": "your_sender_email"
}
}
In this example a minimalist transaction or template was created. If you added a Roles node during this process you do not need to explicitly add the new Sender as a recipient.
Results
Once you have created your transaction or template, note the following:
In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.