How to insert description information with bullet points using scheduled job

reddy8055
Tera Contributor

Hi,

I have created scheduled job which will create ptask with short description and description. Now at that time description information should be created as bullets points like 1,2,3 .. etc. I am looking the below var par should be inserted as points after each comma. How can I achieve this?

var par = 'Please complete the following before 4:00pm ,Export CDSS and Network Tapes from tape library, Log in to SecureSync and complete Distribution List,Place tapes in case and lock.,Place on the IT bookcase for pickup';
var ptask = new GlideRecord('u_property_it_tasks');
ptask.initialize();
ptask.short_description = 'Prepare Tapes for Iron Mountain';
ptask.description = par.split('');
ptask.assignment_group = 'b0ead3a0dba02b80a2b63437b996192d';
ptask.priority = '3';
ptask.insert();

 Thanks,

2 REPLIES 2

AnubhavRitolia
Mega Sage
Mega Sage

Hi @reddy8055 

 

Try below code:

 

var par = 'Please complete the following before 4:00pm ,Export CDSS and Network Tapes from tape library, Log in to SecureSync and complete Distribution List,Place tapes in case and lock.,Place on the IT bookcase for pickup';

var parSplit = par.split(',');
var desc = '';
var count = 1;

for (var i=0; i<parSplit.length; i++)
{
desc = desc + count + '. ' + x[i] + '.' + '\n';
count = count + 1;
}

var ptask = new GlideRecord('u_property_it_tasks');
ptask.initialize();
ptask.short_description = 'Prepare Tapes for Iron Mountain';
ptask.description = desc;
ptask.assignment_group = 'b0ead3a0dba02b80a2b63437b996192d';
ptask.priority = '3';
ptask.insert();

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

kalyan13
Tera Guru

Hi @reddy8055 ,

Use the code of @AnubhavRitolia it will work but just u need to do small change in the code i.e in the place of x[i] give parSplit[i] then it will work.

Please mark as helpful/correct if it solves your issue.
Regards,

Kalyan