- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2016 03:33 AM
Hi,
i want to create docusign envelope from servicenow rest message.i'am attaching file to the rest message and sending request.below is my request.
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"emailBlurb": "Email Blurb",
"emailSubject": "Please sign",
"documents": [
{
"name": "Mutual_NDA.pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"deliveryMethod": "Email",
"routingOrder": "1",
"recipientId": "1",
"name": "Rajenddra Prasad Darshanam",
"email": "xxxxxxxxxxxx@gmail.com"
}
]
},
"status": "sent",
"messageLock": "true"
}
--AAA
Content-Type: application/pdf
Content-Disposition: file; documentId="1"
<documents removed>
--AAA--
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2016 03:19 AM
HI all,
fixed the issue by providing file as base64 bits as base64 formart.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 04:07 AM
Dear Ankur,
I have used REST API's.
for login url: 'https://demo.docusign.net/restapi/v2/login_information'
i have create a REST Message with the above url.
my REST Message Name is : loginDocusign
called the REST Message using below script.
var r = new sn_ws.RESTMessageV2('global.loginDocusign', 'get');
r.setStringParameter('accept', acceptType);
r.setStringParameter('authorization', authorizationToken);
r.setStringParameter('contentType', contentType);
var response = r.execute();
var responseBody = response.getBody();
created POST REST Message by using envelop url.
call that REST Message using below script by setting the base64 bits to request.
var createEnvelope = new sn_ws.RESTMessageV2('global.creatAndSendEnvelop', 'post');
createEnvelope.setStringParameter('email', emailId);
createEnvelope.setStringParameter('contentType', 'multipart/form-data;boundary=AAA');
createEnvelope.setStringParameter('accountId', accountId);
createEnvelope.setStringParameter('endPoint', createEnvelopeEndPoint);
createEnvelope.setStringParameter('authorization', authorizationToken);
createEnvelope.setStringParameter('name', name);
createEnvelope.setStringParameter('accept', acceptType);
createEnvelope.setStringParameter('emailBody', emailBody);
createEnvelope.setStringParameter('docByteCode', fileContent); // file content is the base64 bits, i have converted .pdf file into base64 in online.
var createEnvelopeResponse = createEnvelope.execute();
now it will send the docusign email with document.
after signing and approval, docusign send an email, ii have given instance email as cc and copied the document to our table record.
Thanks,
Rajendra Prasad Darshanam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 04:27 AM
Hi Rajendra,
Can you share the end point for sending the document and how you are getting the token and sending in the later end point.
Also once the document is sent over, we need not do anything?
Are there any steps after that
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 06:22 AM
Hi Ankur,
create envelop endpoint :https://demo.docusign.net/restapi/v2/accounts/accountId/envelops
we can get token using this
if you dont want do any thing dont mention sign tabs, user will receive email from docusign.
Regards,
Rajendra Prasad Darshanam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 06:55 AM
Thanks Rajendra Prasad,
I will proceed in that direction and let you know if any issues.
1) First Get Token if using OAuth
2) Use this access token in header and send request with base64 encoded data of file
3) Document will be sent along with link to recipient so that user can digitally sign that
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2017 07:14 AM
Hi Rajendra,
I was able to get the access token,
now i am trying to send the document, but it is showing following error
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "
}
I have attached a txt file to ServiceNow table record and using following code to get the base64 encoded data.
var gr = new GlideRecord('sys_attachment');
gr.addQuery('sys_id', '7c93b74b4f2a3200fc11fa218110c74e'); // sys_id of attachment record which has the .txt file
gr.query();
if (gr.next()){
var StringUtil = new GlideStringUtil();
var sa = new GlideSysAttachment();
var binData = sa.getBytes(gr);
var encData = StringUtil.base64Encode(binData);
gs.print(encData);
}
The value in variable encData is placed in the Request Body as follows:
{
"emailSubject": "Please sign the document",
"documents": [
{
"name": "SampleFile.txt",
"documentId": "1",
"documentBase64" : "[cG9zdERhdGE=]"
}
],
"recipients": {
"signers": [
{
"deliveryMethod": "Email",
"routingOrder": "1",
"recipientId": "1",
"name": "Ankur Bawiskar",
"email": "testuser@example.com"
}
]
},
"status": "sent",
"messageLock": "true"
}
Can you help me in this?
How did you generate the base64 data which is to be sent over in Request Body
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader