Highlighted

Same document to multiple people, for signatures (five people) on the same document in sequential order (not MegaSign)

New Here ,
May 07, 2018

Copy link to clipboard

Copied

Hi,

I hope you are all doing well, i have integrated the API in our own system (free version, will integrate it using enterprise account when the system starts working preoperly). I am trying to send the same document to multiple peoples for their signatures in the order (order of entering email). What i am experiencing is, when i do it using https://secure.na2.echosign.com/public/compose it works perfectly as i want to do it. But when i try to send the document using API, it does not send the document to multiple people instead it sends the document to only one person. Although i have entered five different emails. Here is the code for your better understanding. Please let me know how can i send the document in specified order to all the users, when first one signs the document it should send it to the next recipient but it does not send to next and shows that document has been signed.

function SendAgreementForSignature(context, p_accessToken, p_transientDocumentId) {

        var l_strEnteredEmails = document.getElementById('emails').value;

        if (l_strEnteredEmails != '') {

            var userEmails = [];

            l_strEnteredEmails = l_strEnteredEmails.split(',');

            var l_intCounter = 0;

            for (var i = 0; i < l_strEnteredEmails.length; i++) {

                if (l_strEnteredEmails.length > 5) {

                    userEmails[l_intCounter] = l_strEnteredEmails;

                    l_intCounter++;

                }

            }

            var transientDocumentId = p_transientDocumentId;

            //Initialize the Agreements API     

            var agreementsApi = new AdobeSignSdk.AgreementsApi(context);

            var agreementsModel = AdobeSignSdk.AgreementsModel;

            //Get recipient set info     

            //Create an array of recipients from list of email ids.     

            var recipientSetMemberInfos = [];

            for (var i = 0; i < userEmails.length; i++) {

                var recipientInfo = new agreementsModel.RecipientInfo();

                recipientInfo.setEmail(userEmails);

                recipientSetMemberInfos.push(recipientInfo);

            }

            //Create recipient set info     

            var recipientSetInfo = new agreementsModel.RecipientSetInfo();

            recipientSetInfo.setRecipientSetMemberInfos(recipientSetMemberInfos);

            recipientSetInfo.setRecipientSetRole(agreementsModel.RecipientSetInfo.RecipientSetRoleEnum.SIGNER);

            recipientSetInfo.setSigningOrder("SEQUENTIAL");

            recipientSetInfo.setRecipientSetName(" Recepients");

            var recipientSetInfos = [];

            recipientSetInfos.push(recipientSetInfo);

            //Get file info and create a list of file info     

            var fileInfo = new agreementsModel.FileInfo();

            fileInfo.setTransientDocumentId(transientDocumentId);

            //fileInfo.setLibraryDocumentName("[DEMO USE ONLY] Long Term Business Plan Approval");

            //Get file info and create a list of file info     

            var fileInfo2 = new agreementsModel.FileInfo();

            fileInfo2.setLibraryDocumentName("[DEMO USE ONLY] Long Term Business Plan Approval");

            var fileInfos = [];

            fileInfos.push(fileInfo);

            //var fieldinfo="mergeFieldInfo": [ {"fieldName": "firstName","defaultValue": "xxxx"}]

            //var a = { "mergeFieldInfo": [' + '{ "fieldName": "firstName", "defaultValue": "xxxx" }] };

            var aa = {

                "mergeFieldInfo": [{ "fieldName": "firstName", "defaultValue": "xxxx" }]

            };

            //Get document creation info     

            //Create document creation info from the file info object     

            var documentCreationInfo = new agreementsModel.DocumentCreationInfo();

            documentCreationInfo.setName("Long Term Business Plan Approval");

            documentCreationInfo.setFileInfos(fileInfos);

            documentCreationInfo.setRecipientSetInfos(recipientSetInfos);

            documentCreationInfo.setSignatureType(agreementsModel.DocumentCreationInfo.SignatureTypeEnum.ESIGN);

            documentCreationInfo.setSignatureFlow(agreementsModel.DocumentCreationInfo.SignatureFlowEnum.SENDER_SIGNATURE_NOT_REQUIRED);

            var a = documentCreationInfo.getFormFieldLayerTemplates();

            //var b = documentCreationInfo.getFormFields();

            //documentCreationInfo.formFieldLayerTemplates = "[DEMO USE ONLY] ";

            documentCreationInfo.setFormFieldLayerTemplates(fileInfo2);

            //documentCreationInfo.setMergeFieldInfo(aa);

         

            var a = documentCreationInfo.getFormFieldLayerTemplates();

        

         

            //Get agreement creation info     

            var agreementCreationInfo = new agreementsModel.AgreementCreationInfo();

            agreementCreationInfo.setDocumentCreationInfo(documentCreationInfo);

            var headerParams = { "accessToken": p_accessToken };

            //Make API call to create agreement     

            agreementsApi.createAgreement(headerParams, agreementCreationInfo)

                .then(function (agreementCreationResponse) {

                    //debugger;

                    //alert("Agreement created for Id " + agreementCreationResponse.getAgreementId());

                    alert("Agreement has been sent.");

                    checkStatusOfAgreement(p_accessToken);

                })

                .catch(function (apiError) {

                    console.log(apiError);

                });

        }

        else

            alert('Please enter Email(s).');

    }

Topics

Questions Need Help

Views

214

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Same document to multiple people, for signatures (five people) on the same document in sequential order (not MegaSign)

New Here ,
May 07, 2018

Copy link to clipboard

Copied

Hi,

I hope you are all doing well, i have integrated the API in our own system (free version, will integrate it using enterprise account when the system starts working preoperly). I am trying to send the same document to multiple peoples for their signatures in the order (order of entering email). What i am experiencing is, when i do it using https://secure.na2.echosign.com/public/compose it works perfectly as i want to do it. But when i try to send the document using API, it does not send the document to multiple people instead it sends the document to only one person. Although i have entered five different emails. Here is the code for your better understanding. Please let me know how can i send the document in specified order to all the users, when first one signs the document it should send it to the next recipient but it does not send to next and shows that document has been signed.

function SendAgreementForSignature(context, p_accessToken, p_transientDocumentId) {

        var l_strEnteredEmails = document.getElementById('emails').value;

        if (l_strEnteredEmails != '') {

            var userEmails = [];

            l_strEnteredEmails = l_strEnteredEmails.split(',');

            var l_intCounter = 0;

            for (var i = 0; i < l_strEnteredEmails.length; i++) {

                if (l_strEnteredEmails.length > 5) {

                    userEmails[l_intCounter] = l_strEnteredEmails;

                    l_intCounter++;

                }

            }

            var transientDocumentId = p_transientDocumentId;

            //Initialize the Agreements API     

            var agreementsApi = new AdobeSignSdk.AgreementsApi(context);

            var agreementsModel = AdobeSignSdk.AgreementsModel;

            //Get recipient set info     

            //Create an array of recipients from list of email ids.     

            var recipientSetMemberInfos = [];

            for (var i = 0; i < userEmails.length; i++) {

                var recipientInfo = new agreementsModel.RecipientInfo();

                recipientInfo.setEmail(userEmails);

                recipientSetMemberInfos.push(recipientInfo);

            }

            //Create recipient set info     

            var recipientSetInfo = new agreementsModel.RecipientSetInfo();

            recipientSetInfo.setRecipientSetMemberInfos(recipientSetMemberInfos);

            recipientSetInfo.setRecipientSetRole(agreementsModel.RecipientSetInfo.RecipientSetRoleEnum.SIGNER);

            recipientSetInfo.setSigningOrder("SEQUENTIAL");

            recipientSetInfo.setRecipientSetName(" Recepients");

            var recipientSetInfos = [];

            recipientSetInfos.push(recipientSetInfo);

            //Get file info and create a list of file info     

            var fileInfo = new agreementsModel.FileInfo();

            fileInfo.setTransientDocumentId(transientDocumentId);

            //fileInfo.setLibraryDocumentName("[DEMO USE ONLY] Long Term Business Plan Approval");

            //Get file info and create a list of file info     

            var fileInfo2 = new agreementsModel.FileInfo();

            fileInfo2.setLibraryDocumentName("[DEMO USE ONLY] Long Term Business Plan Approval");

            var fileInfos = [];

            fileInfos.push(fileInfo);

            //var fieldinfo="mergeFieldInfo": [ {"fieldName": "firstName","defaultValue": "xxxx"}]

            //var a = { "mergeFieldInfo": [' + '{ "fieldName": "firstName", "defaultValue": "xxxx" }] };

            var aa = {

                "mergeFieldInfo": [{ "fieldName": "firstName", "defaultValue": "xxxx" }]

            };

            //Get document creation info     

            //Create document creation info from the file info object     

            var documentCreationInfo = new agreementsModel.DocumentCreationInfo();

            documentCreationInfo.setName("Long Term Business Plan Approval");

            documentCreationInfo.setFileInfos(fileInfos);

            documentCreationInfo.setRecipientSetInfos(recipientSetInfos);

            documentCreationInfo.setSignatureType(agreementsModel.DocumentCreationInfo.SignatureTypeEnum.ESIGN);

            documentCreationInfo.setSignatureFlow(agreementsModel.DocumentCreationInfo.SignatureFlowEnum.SENDER_SIGNATURE_NOT_REQUIRED);

            var a = documentCreationInfo.getFormFieldLayerTemplates();

            //var b = documentCreationInfo.getFormFields();

            //documentCreationInfo.formFieldLayerTemplates = "[DEMO USE ONLY] ";

            documentCreationInfo.setFormFieldLayerTemplates(fileInfo2);

            //documentCreationInfo.setMergeFieldInfo(aa);

         

            var a = documentCreationInfo.getFormFieldLayerTemplates();

        

         

            //Get agreement creation info     

            var agreementCreationInfo = new agreementsModel.AgreementCreationInfo();

            agreementCreationInfo.setDocumentCreationInfo(documentCreationInfo);

            var headerParams = { "accessToken": p_accessToken };

            //Make API call to create agreement     

            agreementsApi.createAgreement(headerParams, agreementCreationInfo)

                .then(function (agreementCreationResponse) {

                    //debugger;

                    //alert("Agreement created for Id " + agreementCreationResponse.getAgreementId());

                    alert("Agreement has been sent.");

                    checkStatusOfAgreement(p_accessToken);

                })

                .catch(function (apiError) {

                    console.log(apiError);

                });

        }

        else

            alert('Please enter Email(s).');

    }

Topics

Questions Need Help

Views

215

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Have something to add?

Join the conversation