Document Template - generate PDF with Subject Person name in the title

vstefanova
Tera Contributor

Hi all, 

Is there any way to generate a PDF document with "Subject Person" name in the title?  We are using "Document Templates" plugin.

Thank you in advance,

Victoria 

1 REPLY 1

abirakundu23
Mega Sage

Hi @vstefanova ,

I faced similar issue. We can achieve this using customization.

Please create Before/insert BR in 'sys_attachment' table with global application scope.

 

(function executeRule(current, previous /*null when async*/ ) {
var case = new GlideRecord("sn_hr_core_case_global_mobility"); // put table name as per you configuration
case.addEncodedQuery('sys_id=' + current.table_sys_id);
case.query();
if (case.next()) {
var EmpName = case.subject_person.name;
}

current.file_name = 'Employee offer letter-' + EmpName;
// gs.info('EmpNameFilename' + current.file_name);
})(current, previous);

 

May be RCA record will be created post that please allowed RCA with target scope.

 

Please helpful & mark answer if it's really worthy for you.