- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 12:46 PM
Hello,
Is there a way within an HTML Document Template to add/map a signing date? I know this can be done on a PDF Document Template, but since what I'm generating is an offer letter there are dynamic field values and the ability to edit the document after previewing it before the document task is initiated.
I need a way to record the signing date from the subject person before the final PDF gets generated. Any ideas?
Solved! Go to Solution.
- Labels:
-
Employee Document Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2024 03:50 PM - edited 08-19-2024 04:50 AM
Here's the BR conditions and script that I use.
(function executeRule(current, previous /*null when async*/) {
var htmlBody = current.body.toString();
var curDate = new GlideDate();
var formattedDate = curDate.getByFormat('dd-MMM-yyyy');
var actionType = current.participant.toString();
if (actionType == '1450bf7c937f42d0b6c1b92b1bba10ef' && current.state.changesTo(3)) {
// Manager Acknowledgement and state changes to Closed
htmlBody = htmlBody.replace('<span style="color: #ffffff;">DateManagerAcknowledgement</span>', '<span style="color: #000000;">' + formattedDate + '</span>');
} else if (actionType == '1200bbfc937f42d0b6c1b92b1bba10bc') {
// Employee Acknowledgement
if (current.state == 1) { // Ready
var prevTask = current.previous_task.sys_id;
var prevtskQuery = new GlideRecord('sn_doc_task');
if (prevtskQuery.get(prevTask)) {
var prevtskDate = prevtskQuery.getValue('closed_at');
var prvformattedDate = new GlideDate(prevtskDate).getByFormat('dd-MMM-yyyy');
htmlBody = htmlBody.replace('<span style="color: #ffffff;">DateManagerAcknowledgement</span>', '<span style="color: #000000;">' + prvformattedDate + '</span>');
}
}
if (current.state.changesTo(3)) { // Closed
htmlBody = htmlBody.replace('<span style="color: #ffffff;">DateEmployeeAcknowledgement</span>', '<span style="color: #000000;">' + formattedDate + '</span>');
}
}
current.setValue('body', htmlBody);
current.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 09:32 PM
You can write a static Doc template script and add it to the HTML Doc Template. But to get the signing date it must be dynamic & travel through PDF mapping based on date of sigining and this cannot be done beforehand in HTML Document Template.
Hope this answers!
Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 11:34 PM
Hi @leahdany ,
In order to achieve the dynamically signing date of Subject Person after completion of Signature can't be possible in HTML document template. You can achieve this by PDF document template to populate dynamic date after subject persons signed. Similar requirement also received from our client.
Please mark helpful & correct answer if it's really worthy for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 07:36 AM
@Akash4 @abirakundu23 I know I can set the signing date on a PDF, but I haven't found a way to edit and sign the PDF before initiating the document task.
When I use Managed Documents for the PDF I can't edit the PDF before initiating the document tasks. This is why I was using HTML because I could edit prior to initiating the document task.
When I use HR Managed Documents for the PDF I can edit and sign, but I can't initiate document tasks because it's not a managed document.
I'm looking for a solution that will allow me to edit and sign the document then initiate the document task while having the signing date mapped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 08:55 AM - edited 07-22-2024 09:01 AM
To this point - "I can't initiate document tasks", you can try using a logical script if it's allowed. As described, use the HTML Document for editing required content, then trigger a Document task using a Business Rule or Flow.
Hope this helps!
Regards, Akash
_____________________________________________________________________________
Please mark it as helpful 👍 or Accept Solution ✔️ based on the response to your query.
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.