You can differentiate the document that is written back from DocuSign from other documents by setting the specific name format to the writeback document.
And you can specify the name format of it through ApexToolkit. For example, if you want to set the file name as "document name + envelope status", you would need to set WRITE_BACK_NAME_ENVELOPE_STATUS as the value for the second argument of dfsle.Document.WriteBack method. Please refer to the exmaple code below:
myEnvelope = myEnvelope.withOptions(new dfsle.Envelope.Options(
false,
new dfsle.Document.WriteBack(
mySourceId,
dfsle.Document.WRITE_BACK_ENVELOPE_STATUS_PDF,
true,
true
),
new Map<String, Map<String, Object>> {
dfsle.Envelope.STATUS_COMPLETED => new Map<String, Object> {
'Opportunity.StageName' => 'Closed Won'
}
},
new Map<String, Map<String, Object>>()
));
There are a few other name format options you can use. More information about it is described in the ApexToolkit reference:
1: https://developers.docusign.com/docs/salesforce/apex-toolkit-reference/document.html
2: https://developers.docusign.com/docs/salesforce/apex-toolkit-reference/document.html