spacing between mrvs data on description of HR case

si21
Tera Guru

Hi experts,

we are using  below code to populate record producer variables on HR case description.

new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id);

 

But multirow variables set data is displaying without any spacing between two rows. How can we add spacing(newline) between two rows?

si21_0-1720524025574.png

 

TIA

 

3 REPLIES 3

Dnyaneshwaree
Mega Sage

Hello @si21,

What are you preferred to write that code? Script include or record producer script?

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hi @Dnyaneshwaree , this code is generally written on record producer script field

Dnyaneshwaree
Mega Sage

Hello @si21,

Ok, then please refer below code as an example of record producer script for required logic and update it as per your requirement:

(function() {
    var caseDescription = '';

    var multiRowVariableSet = producer.variables.your_multirow_variable_set;
    var rows = multiRowVariableSet.split('\n'); // Assuming rows are separated by newlines

    for (var i = 0; i < rows.length; i++) {
        caseDescription += rows[i] + '\n\n'; // Adding an extra newline for spacing
    }

    // Set the formatted case description
    current.description = caseDescription;

    new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id);
})();

 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru