我这两年来一直在通过RestAPI添加收件人,但现在遇到这个问题大约一个星期了。我请求那里的任何人,请尝试通过触发器通过restapi为进程中的信封添加收件人。我在触发器处理程序中的api调用看起来像
public static void functionName(string envelopeId)
{
string UserId = 'userId';
string Password = 'password';
string AccountId = 'accountId';
string IntegratorKey = 'Ikey';
string Endpoint = 'https://demo.docusign.net/restapi/v2/';
String myBody;
myBody = '{"signers": [{"signInEachLocation": "false","name": "Check1","email": "test@email.com","recipientId": "5","requireIdLookup": "false","routingOrder": "5","roleName": "role1"}, {"signInEachLocation": "false","name": "Check2","email": "email@email.com","recipientId": "6","requireIdLookup": "false","routingOrder": "6","roleName": "role2"}]}';
HttpRequest request = new HttpRequest();
request.setEndpoint(Endpoint +'/accounts/'+AccountId+'/envelopes/'+envelopeId+'/recipients/');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json');
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+UserId+'</Username><Password>'+Password+'</Password><IntegratorKey>'+IntegratorKey+'</IntegratorKey></DocuSignCredentials>');
request.setHeader('Accept', 'application/json');
request.setBody(myBody);
HttpResponse reqResponse = (new Http()).send(request);
system.debug(reqResponse.getBody());
}
最初,正在发送信封用于路由订单1,3,4,7,10。在路由订单3到达之后,我正在调用api以按照上面的正文添加收件人。对于第一个添加的recipientId 5,当信封到达recipientId 5的路由号码时,我收到2个电子邮件通知,一次签署文档(通常只有一个)。我检查了我的调试日志,一切看起来都很完美,但我无法找出问题的原因。那么我的结局还是来自Docusign的错误?
道歉,如果我在任何地方都错了。
更新
好的,这就是我对这个问题的看法。创建收件人时会发送一封电子邮件通知(即使信封未达到此收件人的路由顺序),当信封到达路由订单时,也会再次发送相同的电子邮件。虽然后者只是应该发生,但为什么我在收件人创建的时候收到电子邮件呢?