Account


Earned badges

Achievement: Latest Unlocked

Topic Started

Topics
Hi , I have created package and adding document from Salesforce. The document is in Spanish language.
Hello, I want to download document which is attached to package. I have package Id. String response = sdk.createPackage(pkg,blobMap); This above function is returning me package id.
Hi, I am using APEX SDK.

Replies Created

Reply to: Getting Authorization Error

0 votes
Yes. I have given URL in remote setting, I ave attached screenshot of the remote settings and complete code. I am calling function as below: ESignLiveExamples e = new ESignLiveExamples(); Datetime GMTDate = Datetime.newInstanceGmt(2018,6,1,12,1,5); ESignLiveExamples.createPackageWithDocumentsExample('TestSample', false, 'SamplepackageDescription', GMTDate, 'Test Email Message');

Attachments

Reply to: Getting Authorization Error

0 votes
Here is the complete code: /** * Class Name: ESignLiveExamples.cls * * Class containing examples for using the SDK */ public with sharing class ESignLiveExamples { public ESignLiveExamples(){} /** * Example method for creating a package without any documents */ public static String createPackageExample() { ESignLiveSDK sdk = new ESignLiveSDK(); // Set up the example package ESignLiveAPIObjects.Package_x pkg = new ESignLiveAPIObjects.Package_x(); pkg.name = 'Test Package Name'; pkg.autocomplete = true; pkg.description = 'Sample Description'; pkg.due = System.now().addDays(7); pkg.emailMessage = 'Sample email message'; // Call the SDK method and get the packageId which is returned from the SDK method String packageId = sdk.createPackage(pkg); // Print the packageId to console System.debug('=> Response from createPackageExample: ' + packageId); return packageId; } /** * Example method for creating a package with a document */ public static void createPackageWithDocumentsExample(String packageName, Boolean autocomplete, String packageDescription, DateTime packageDue, String emailMessage) { ESignLiveSDK sdk = new ESignLiveSDK(); // Set up the example package and Document data ESignLiveAPIObjects.Package_x pkg = new ESignLiveAPIObjects.Package_x(); Map blobMap = new Map(); Blob b1 = Blob.valueOf('testDocumentOne'); BLob b2 = Blob.valueOf('test'); blobMap.put('testDocumentOne', b1); blobMap.put('testDocumentTwo', b2); pkg.name = packageName; pkg.autocomplete = autocomplete; pkg.description = packageDescription; ESignLiveAPIObjects.ExtractAnchor ea = new ESignLiveAPIObjects.ExtractAnchor(); ea.text = 'testDocumentOne'; ea.index = 0; ea.width = 150; ea.height = 40; ea.anchorPoint = ESignLiveAPIObjects.AnchorPoint.TOPRIGHT; ea.characterIndex = 12; ea.leftOffset = -20; ea.topOffset = -60; ESignLiveAPIObjects.Field f1 = new ESignLiveAPIObjects.Field(); f1.type = 'SIGNATURE'; f1.page = 0; f1.extract = false; f1.left = 0; f1.subtype = 'FULLNAME'; f1.top = 0; f1.extractAnchor = ea; ESignLiveAPIObjects.ExtractAnchor ea1 = new ESignLiveAPIObjects.ExtractAnchor(); ea1.text = 'testDocumentOne'; ea1.index = 0; ea1.width = 150; ea1.height = 40; ea1.anchorPoint = ESignLiveAPIObjects.AnchorPoint.BOTTOMRIGHT; ea1.characterIndex = 12; ea1.leftOffset = -40; ea1.topOffset = 0; ESignLiveAPIObjects.Field f2 = new ESignLiveAPIObjects.Field(); f2.type = 'INPUT'; f2.page = 0; f2.extract = false; f2.left = 0; f2.subtype = 'LABEL'; f2.binding = '{approval.signed}'; f2.top = 0; f2.extractAnchor = ea1; // Create request List challenges = new List(); ESignLiveAPIObjects.Delivery delivery = new ESignLiveAPIObjects.Delivery(); delivery.email = true; delivery.provider = true; ESignLiveAPIObjects.Auth auth = new ESignLiveAPIObjects.Auth(); auth.challenges = challenges; auth.scheme = ESignLiveAPIObjects.AuthScheme.NONE; ESignLiveAPIObjects.Signer signer = new ESignLiveAPIObjects.Signer(); signer.auth = auth; signer.delivery = delivery; signer.firstName = 'firstName'; signer.lastName = 'lastName'; signer.email = '[email protected]'; signer.name = 'firstNamelastName'; List signers = new List(); signers.add(signer); ESignLiveAPIObjects.Role role = new ESignLiveAPIObjects.Role(); role.signers = signers; role.reassign = true; role.name = 'firstNamelastName'; role.id = 'firstNamelastName'; role.type = 'SIGNER'; ESignLiveAPIObjects.Approval approval1 = new ESignLiveAPIObjects.Approval(); approval1.role = 'firstNamelastName'; approval1.fields = new List {f1,f2}; ESignLiveAPIObjects.Document doc1 = new ESignLiveAPIObjects.Document(); doc1.name = 'testDocumentOne'; doc1.approvals = new List {approval1}; ESignLiveAPIObjects.Document doc2 = new ESignLiveAPIObjects.Document(); doc2.name = 'testDocumentTwo'; pkg.documents = new List {doc1,doc2}; pkg.roles = new List {role}; // Call the SDK method and get the packageId which is returned from the SDK method String response = sdk.createPackage(pkg,blobMap); // Print the packageId to console System.debug('=> Response from createPackageWithDocumentsExample: ' + response); if (response != null && response != '') { signDocuments(response); } } private static void signDocuments(String response) { HttpRequest request = new HttpRequest(); request.setEndpoint('https://sandbox.esignlive.com/api/packages/' + response + '/documents/signed_documents'); request.setBody('{"documents": [{"id": "testDocumentOneid","name": "testDocumentOne"}]}'); request.setMethod('POST'); request.setHeader('Authorization', 'Basic ' + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=='); request.setHeader('Content-type', 'application/json'); request.setHeader('Accept', 'application/json'); HttpResponse res = (new Http()).send(request); system.debug('3=== ' + res.getbody()); } }

Reply to: Getting Authorization Error

0 votes
Yes. I have added API Key and URL in the Custom settings. Name : Main Endpoint : https://sandbox.e-signlive.com/api API Key :- I have taken from my EsignLive Sandbox. My Account -> Admin->Integration->API Key. I have taken API key from and added in salesforce. But in Esiglive Sandbox Callback URL is not given. It is empty.

Reply to: Getting Authorization Error

0 votes
Hello, Thank you. You help is much appreciated. I am facing same issue while calling Signed Document function in createDocumentsExample after calling createPackage function it is returning package id. Based on the response i am calling below fucntion private static void signDocuments(String response) { HttpRequest request = new HttpRequest(); request.setEndpoint('https://sandbox.esignlive.com/api/packages/' + response + '/documents/signed_documents'); request.setBody('{"documents": [{"id": "testDocumentOneid","name": "testDocumentOne"}]}'); request.setMethod('POST'); request.setHeader('Authorization', 'Basic ' + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=='); request.setHeader('Content-type', 'application/json'); request.setHeader('Accept', 'application/json'); HttpResponse res = (new Http()).send(request); system.debug('3=== ' + res.getbody()); } But after send request i am getting below error: 17:21:09:637 USER_DEBUG [290]|DEBUG|3=== {"messageKey":"error.unauthorised.noSession","code":401,"message":"Failed to retrieve Session","name":"Unauthorized"}

Reply to: Retrieving documentId

0 votes
Hello, I have created document with document Id as shown below: ESignLiveAPIObjects.Document doc1 = new ESignLiveAPIObjects.Document(); doc1.name = 'testDocumentOne'; doc1.id='Id1'; String response = sdk.createPackage(pkg,blobMap); Blob sample = downloadDocumentExample(response,'Id1'); But i am getting below error: ESignLiveRESTAPIHelper.ESignLiveRestAPIHelperException: Error obtaining signed eSignLive document: 500 - Internal Server Error - {"messageKey":"error.internal.default","technical":"[#b9a220a3-d344-4758-969f-a7176104bb52]","message":"Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.","code":500,"name":"Unhandled Server Error"} I am not able to download document. Please help.

Subscriptions

Topics Replies Freshness Views Users
Hi , I have created package and adding document from Salesforce. The document is in Spanish language.
2 5 years 10 months ago 311
Profile picture for user mwilliams
Hello, I want to download document which is attached to package. I have package Id. String response = sdk.createPackage(pkg,blobMap); This above function is returning me package id.
5 6 years 1 month ago 142
Profile picture for user harishaidary
Hi, I am using APEX SDK.
8 6 years 1 month ago 169
Profile picture for user harishaidary

Code Share

This user has not submitted any code shares.

Subscriptions Release Notes

This user is not subscribed to any release notes.