Error Merging fields from Dynamics CRM workflow - dynamics-crm

I am trying to merge fields using Docusign for Dynamics. I have signed up for Sandbox Docusign and using with dynamics 365 CRM.
When I try to write a workflow to merge field using template , I receive following error. In docusign Template is perfect . Any help appreciated.
[DocuSignIntegration: DocuSign.DSIntegrationActivity.GetSignatures]
[DocuSignIntegration: DocuSign.DSIntegrationActivity.GetSignatures]
Calling endpoint https://partner.docusign.net/partners/msdynamics/api/GetSignatures
POST data: t=L%2BUL0dVaJKrxG7jPjGXtUacp4FfMOWprKbw6ML9qcvvUX76oVsfPu3hJ0sk3wbfc7SK6nQXcw44eGuum1P%2Fea2wlZxitPj%2Bas%2B52vVlmOq4%3D&baseUrl=https%3A%2F%2Fdemo.docusign.net&accountId=6b76af6b-6663-4b1b-aea4-6fedb0b159bf&uid=c20189f4-73d3-4298-8065-36e04a089458&refreshToken=AQABAAAAAAAm-06blBE1TpVMil8KPQ41Qy0jKUb0TMSdpFJKrCmxKKQWM9NCQTqtV3LKgZLnb47f-NnmSMgL2ssfXvlpw_9jcKLy7n_c-AmQhLjKXynoUgkUYt3-5ZeMaggxr7yT7Td1CeBVYQ4mV68t8TT-Eb5kbwcglNW-u5UuStp1KEKrVrePjq__n3PnTq9tMCBoUxCiIobg4Xj-aSSNeoH9UappzpFqhHjs8a1tv7JyJaDxJfEED8R2i_bXb6D54gPqDiZDhKBfiIBg29JgwReIIZeqWQytBnuQ-Mlitlmvw5LSHVgHA6CS6OFpvT36cIpjgejbakshREilAMbSt8U2kpOZ1MV9O89H7qkSJs_XGh02uPHptjiGPcdAkaKIL39HPNoTLz24EKXFmPB9i8X596LKBu7pil6D4QfL5nPSnoFWVDCvQE7Ot0wm9O6xM1ku6r9z2pd5XrcRLYwDZZ-tQQkxdwxIimh74ipC-eeslVJN1APC2WlC1rXROD4Z3TBBS3pMZcTS8VeCgQMn4TwF9FerJjSr-rS1yBJcftPGcbqqL9Hn9NDYJmc8Id0fV_d4H9kq86SBKq11XlXeZ0r8iSTHhTV2vtheNSV1QOvFPC_PWnk7u_rXjNu2ZCipgHVaLEgU3jfnXVUHnt0Qg7wwNqxPB8fVoR4DGxiwDx-myVdhUjVKfWMzUjwNt8vy3aqh9n7dsAnHszm8x_stv2p4MP1R9YPyqW4x3NsBnHASa6iST7ejSx155voSCWjNIIi4XnSUtrRHAydlZLhVZSM4ElwWqTYkf5gHNtArAyFlIv1wlQUWf_-rrAb2Hth4r64x1g4Cvjw4VYqpcamX-LGHklwYIAA&crmHost=s34.crm.dynamics.com&v=6.2.0.13&envelopeId=25a4f2db-c8af-483b-80b8-b9caf4ca0ff7&entityLogicalName=opportunity&entityId=628cf01a-aed1-e411-80ef-c4346bac7be8&oneclicksend=True&oneclickoption=Tag&templateId=019b6c8a-3faa-4a65-a256-97382dfa1554
Deserializing json response: {"Error":"Unknown","ErrorDescription":"The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Error querying documents for Envelope ID = 25a4f2db-c8af-483b-80b8-b9caf4ca0ff7 (ENVELOPE_IS_INCOMPLETE)"}
Error Message:
Unhandled exception:
Exception type: Microsoft.Crm.CrmException
Message: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): DocuSign.DSIntegrationActivity.GetSignatures: System.Exception: Unable to deserialize the returned JSON.
Endpoint: GetSignatures.
Params: t=L%2BUL0dVaJKrxG7jPjGXtUacp4FfMOWprKbw6ML9qcvvUX76oVsfPu3hJ0sk3wbfc7SK6nQXcw44eGuum1P%2Fea2wlZxitPj%2Bas%2B52vVlmOq4%3D&baseUrl=https%3A%2F%2Fdemo.docusign.net&accountId=6b76af6b-6663-4b1b-aea4-6fedb0b159bf&uid=c20189f4-73d3-4298-8065-36e04a089458&refreshToken=AQABAAAAAAAm-06blBE1TpVMil8KPQ41Qy0jKUb0TMSdpFJKrCmxKKQWM9NCQTqtV3LKgZLnb47f-NnmSMgL2ssfXvlpw_9jcKLy7n_c-AmQhLjKXynoUgkUYt3-5ZeMaggxr7yT7Td1CeBVYQ4mV68t8TT-Eb5kbwcglNW-u5UuStp1KEKrVrePjq__n3PnTq9tMCBoUxCiIobg4Xj-aSSNeoH9UappzpFqhHjs8a1tv7JyJaDxJfEED8R2i_bXb6D54gPqDiZDhKBfiIBg29JgwReIIZeqWQytBnuQ-Mlitlmvw5LSHVgHA6CS6OFpvT36cIpjgejbakshREilAMbSt8U2kpOZ1MV9O89H7qkSJs_XGh02uPHptjiGPcdAkaKIL39HPNoTLz24EKXFmPB9i8X596LKBu7pil6D4QfL5nPSnoFWVDCvQE7Ot0wm9O6xM1ku6r9z2pd5XrcRLYwDZZ-tQQkxdwxIimh74ipC-eeslVJN1APC2WlC1rXROD4Z3TBBS3pMZcTS8VeCgQMn4TwF9FerJjSr-rS1yBJcftPGcbqqL9Hn9NDYJmc8Id0fV_d4H9kq86SBKq11XlXeZ0r8iSTHhTV2vtheNSV1QOvFPC_PWnk7u_rXjNu2ZCipgHVaLEgU3jfnXVUHnt0Qg7wwNqxPB8fVoR4DGxiwDx-myVdhUjVKfWMzUjwNt8vy3aqh9n7dsAnHszm8x_stv2p4MP1R9YPyqW4x3NsBnHASa6iST7ejSx155voSCWjNIIi4XnSUtrRHAydlZLhVZSM4ElwWqTYkf5gHNtArAyFlIv1wlQUWf_-rrAb2Hth4r64x1g4Cvjw4VYqpcamX-LGHklwYIAA&crmHost=s34.crm.dynamics.com&v=6.2.0.13&envelopeId=25a4f2db-c8af-483b-80b8-b9caf4ca0ff7&entityLogicalName=opportunity&entityId=628cf01a-aed1-e411-80ef-c4346bac7be8&oneclicksend=True&oneclickoption=Tag&templateId=019b6c8a-3faa-4a65-a256-97382dfa1554
Error Description: The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Error querying documents for Envelope ID = 25a4f2db-c8af-483b-80b8-b9caf4ca0ff7 (ENVELOPE_IS_INCOMPLETE) (Unknown)
Server Response: {"Error":"Unknown","ErrorDescription":"The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Error querying documents for Envelope ID = 25a4f2db-c8af-483b-80b8-b9caf4ca0ff7 (ENVELOPE_IS_INCOMPLETE)"}
at Microsoft.Crm.Sandbox.SandboxCodeUnit.ProcessException(Exception originalException, IExecutionContext context, SandboxClient client, SandboxCallTracker callTracker, Boolean isSafeToRetry, DateTime performanceExecutionStartTime, SandboxTracker tracker, Guid parentExecutionId, CrmException& crmException, String& assemblyContents)
at Microsoft.Crm.Sandbox.SandboxCodeUnit.<>c__DisplayClass24_0.<Execute>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Xrm.RemotePlugin.CrmProvider.RemotePlugin.CDSExecute(IServiceProvider serviceProvider)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
-- End stack trace --

usually this fails for these reasons:
1. No documents are attached, but if you used the template, then this doesn't applied
2. No recipients are provided. If you add a recipient, and the recipient role is incorrect (it's case sensitive), it will be added as a new recipient, but it might not be the required recipient the template specifies. Double check that you have the role name correct.
3. A good way to verify what is missing, is to copy the envelope ID created in the workflow, then open a new window and login to your docusign account. Look for the envelope using this ID, and you'll see it's in a draft state. You can spot check if it does have the required recipients.

Related

How do i get body of message when using keyword mentions in teams

in automate i have a flow. I am using "When keywords are mentioned". the keyword i entered is "test"
I Selected, the team,channel,etc... all correctly.
when someone types "the test is a success". in that channel. how do i get the full string "the test is a success"?
I have tried a few operations "get Messages", also tried a few dynamic content options and a few triggeroutput variations. all either are blank or provide a long json string with subscription,channelId,teamId,etc. but not the string I am trying to get.
The Get message details action should help you ...
In the body of the response, you'll clearly see the text that was entered to invoke the trigger.
Use Get message details, you will get message detail of that reply message. Then get your text with expression like this:
outputs('Get_message_details')?['body']['body']['plainTextContent']

Embedded Signing request DocuSign API fails on certain envelopes

We submit a CreateRecipient request to get a document signing URL:
https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/
To identify the user we provide user_id and client_user_id as per documentation(client_user_id has a valid string value). And most of the time but in a fraction of cases it fails with the following:
{
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of the specified envelope."
}
We request values for user_id and client_user_id from the Envelopes -> Get Envelope envelope -> recipients -> signers, so there is no chance id's are incorrect.
DocuSign_eSign::Signer
#client_user_id="gid://platform/Client/617983",
#delivery_method="email",
#embedded_recipient_start_url="SIGN_AT_DOCUSIGN",
#recipient_id="1",
#recipient_id_guid="98e4bd97-a0b0-4c66-8b5d-7cca21813b04",
#recipient_type="signer",
#require_id_lookup="false",
#require_upload_signature="false",
#role_name="Client",
#routing_order="1",
#user_id="ad1bed21-ef62-4f37-af4c-909b0e95e7e3">
and the request is:
{
"authenticationMethod": "none",
"clientUserId": "gid://platform/Client/617983",
"returnUrl": "...",
"userID": "ad1bed21-ef62-4f37-af4c-909b0e95e7e3"
}
Using email and userName for the same failing envelope doesn't help.
We assume there is a bug in API, but it's hard to tell which signer actions activate such malfunctioning.
Recently affected envelope ids:
[
"357ed66b-866a-42c5-9304-23931a6daaee",
"9a900c0b-ca76-45ac-818b-3e38e1a0638a",
"5eb84ec3-a7ef-47a0-94bd-2842fe768f93",
"98934b17-674a-4be2-a6f3-2767821de395",
"05a09768-c3d6-4fe8-9654-85ce3e07b276"
]
We have checked this question: UNKNOWN_ENVELOPE_RECIPIENT but the recipients actually do match but since we identify signer by userID and clientUserID it doesn't seem relevant. Anyways we checked the recipient via by listing recipient and it matches perfectly.
PS Signing via email link works though.
I looked in the logs and saw the same thing you're seeing.
The request is for the wrong user/recipient.
Typically, when specifying these:
view_request.email = signer_email
view_request.user_name = signer_name
They have to match exactly (including case) to what's in the envelope.
If you use a userId, that has to match to how the envelope was sent. I would confirm that using email and user_name should work if you put the correct values. You can find these values by doing a GET on the envelope with all information included.

Optional recipient role template docusign

I created a template by the UI, and use it to create envelopes through the rest API. So far so good.
In the template, 4 roles were created. But one of these should be optional when creating the envelope, that is, in certain envelopes there will only be 3 signers.
The problem is that if I only send information for 3 templatesroles the docusign returns an error of INVALID_EMAIL_ADDRESS_FOR_RECIPIENT, for the role that was not informed.
My question is if there is a way to create a "optional" role in template. Which will only be informed in some envelopes.
Edit:
I'm creating the envelope with the status "created". I do that bc we have to add some documents to the envelope before sending. After that I update the envelope changing the status to "sent".
The error happens when I update the status to "sent". If I create the envelope already with the "sent" status the error doesn't happens.
Here's my code:
$result = Docusign::createEnvelope(array(
'templateId' => $saleContract->obra->template_id,
'emailSubject' => 'Contrato de Compra - ' . $saleContract->obra->nome_fantasia,
'status' => 'created',
'templateRoles' => $this->getRoles($saleContract, $tabs),
));
$this->addDocuments($saleContract, $result['envelopeId']);
//HERE IS WHERE THE ERROR HAPPENS
Docusign::updateEnvelope($result['envelopeId'], ['status' => 'sent']);
By default, template roles are optional. This means that you can successfully do the following:
Create a single template that contains the maximum number of recipients (and fields/tabs for all recipients).
Each time you create an Envelope via API, include Recipient information in the "Create Envelope" API request only for the needed recipients (Roles).
Any Recipient Roles that you do not specify information for when you POST /envelopes will not be included. In the event you want to create your envelope in draft, make modifications, and then send, set the "merge roles on draft" qp to true.
merge_roles_on_draft string
When set to true, template roles will be merged, and empty recipients will be removed. This parameter applies when you create a draft envelope with multiple templates. (To create a draft envelope, the status field is set to created.)
If you're still having problems, double-check that you haven't prepopulated your template role with name or email values. That will fudge up the merge ^

Microsoft graph API - empty bccRecipients list

This is the Scenario:
In the same Azure tenant, I used one account (user_1_address) to send emails to the other account (user_2_address) using outlook (o365).
I sent 3 emails, one where user_2_address is BCCed, one CCed, and one when it's the TO recipient.
I'm using Microsoft graph API to get a list of emails received by user_2_address in a specific time range, using this query:
https://graph.microsoft.com/v1.0/users/{<user_2_id>}/messages?$filter=
receivedDateTime ge <some date> and receivedDateTime lt <some other date>
and isDraft eq false
and sender/emailAddress/address ne '<user_2_address>'
I'm getting all the three emails user_2_address had received from user_1_address. But in the email user_2 was BCCed the bccRecipients list is empty, when it should contain user_2_address :(
I have seen this question about sending an email from Gmail and BCC an outlook user:
Microsoft graph API: empty BCC field
In that case, also the bccRecipients list was empty, but it was resolved by saying the BCC is removed when sending the emails from an external source (Gmail in that case). When for me it's not an external source - both users are using outlook in the same tenant.
So my questions are:
Is it the desired behaviour, or is it a bug?
Now, let's say I'm using the query above where I get all emails where the sender is not the user_2_address and it's not a draft. Can I assume that every email I get where user_2_address is not in the ccRecipients and toRecipients lists - that email was BCCed to user_2_address?
Thanks!
The bcc field in a Message is an envelope (P1) recipient only so you should always expect that it will be blank (no matter the context inside a tenant really make no difference). Like the other post referenced if it wasn't blank it would break the RFC and the purpose of a BCC, the only exception is the sent item (which is just a copy of the sent message)
No there are many scenarios that would break that particular logic eg forwarded email is one the comes to mind. You could certainly refine you result set that way, one thing you might want to examine is the X-MS-Exchange-Organization-Recipient-P2-Type: mail header that should get set in your internal to internal scenario (you need to look at the PidTagTransportMessageHeaders extended property to see it)

Endpoint returned a body with contentType 'text/html', while a valid FHIR xml/json body type was expected. Is this a FHIR endpoint?

I am using Hl7.Fhir.Rest.FhirClient to update some resources on our local fhir server. However, sometimes we receive the following exception that I cannot identify why it happens? Does anyone have a way to debug the issue to see what is going on
Endpoint returned a body with contentType 'text/html', while a valid FHIR xml/json body type was expected. Is this a FHIR endpoint?
This is also part of the stack trace that we receive
Hl7.Fhir.Rest.HttpToEntryExtensions.parseResource(String bodyText, String contentType) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\HttpToEntryExtensions.cs:139
Hl7.Fhir.Rest.HttpToEntryExtensions.ToBundleEntry(HttpWebResponse response, Byte[] body) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\HttpToEntryExtensions.cs:73
Hl7.Fhir.Rest.Requester.doRequest(EntryComponent interaction) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\Requester.cs:119
Hl7.Fhir.Rest.Requester.Execute(EntryComponent interaction) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\Requester.cs:58
Hl7.Fhir.Rest.FhirClient.execute(Bundle tx, IEnumerable`1 expect) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\FhirClient.cs:807
Hl7.Fhir.Rest.FhirClient.internalUpdate(TResource resource, Bundle tx) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\FhirClient.cs:283
Hl7.Fhir.Rest.FhirClient.Update(TResource resource, Boolean versionAware) in C:\src\FHIR\fhir-net-api-DSTU2 - Merge\src\Hl7.Fhir.Core\Rest\FhirClient.cs:248
Is the Accept header being set? You should be able to check what's actually being sent by using a tool like Fiddler
The cause for the exception would be either the request doesn't reach to the end point due to any security layer in the middle like OAuth or the endpoint, you are trying on, doesn't exist at the service.

Resources