I am sending document using apex. Sending and signing is happening properly also, document is attaching back to salesforce record once signing is completed by all parties.
I also want to update field in salesforce record based on envelope status. Like this:
Envelope status ='Sent' then Document__c.Envelope_Status__c='Sent'
Envelope status ='Completed' then Document__c.Envelope_Status__c='Completed'.
I am giving these conditions in code like below:
myEnvelope = myEnvelope.withOptions(
new dfsle.Envelope.Options(
null,
new dfsle.Document.WriteBack(
recordId,
dfsle.Document.WRITE_BACK_NAME_ENVELOPE_STATUS_PDF,
true,
false
),
new Map<String, Map<String, Object>>{
dfsle.Envelope.STATUS_SENT => new Map<String, Object>{
'Document__c.DSEnvelope_Status__c'=>'Sent'
},
dfsle.Envelope.STATUS_COMPLETED => new Map<String, Object>{
'Document__c.DSEnvelope_Status__c'=>'Completed'
}
},
new Map<String,Map<String, Object>>{
dfsle.Recipient.STATUS_DECLINED => new map<String,Object>{
'Document__c.DSEnvelope_Status__c' =>'Declined'
}
}
)
);
The problem is I am always getting blank value in DSEnvelope_Status__c field in custom object Document__c record(Source record). I am testing with system admin profile.