- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-23-2020 09:04 PM
Hi I am trying to update the work notes of RITM from a Business rule .
I want to align variables value , so adding spaces but it takes only one space.
My code is like
var variables='Requirement Details :\n'+"\n";
//variables+= 'sfdb:'+current.variables.investment_name_short_description.getDisplayValue()+"\n"+"\n" +"\n";
variables+= 'Skill :'+" "+': '+current.variables.skill.getDisplayValue()+"\n"+"\n";
variables+= "Skill S ID" +" "+ " "+ '    + current.variables.skill_sub_id.getDisplayValue()+"\n"+"\n";
variables+= 'Skill Descript'+ spaces(10) +":" +current.variables.skill_description.getDisplayValue()+"\n"+"\n";
current.work_notes=variables;
I tried /s ,   etc but nothing worked.
How can i fix this ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-23-2020 10:39 PM
Hi naveen.sharan,
The \t or &nsbp; will add only one spaces in between. So you have to use the <pre> tag in the script and format the code in which you want and the same way it will apprear.
You have to use <BR> for inserting a new if you are using pre tag.
IN the start you have to add [code]<pre> and after end of the full notes you have to close this tag </pre>[/code] like we do for HTML tag.
We also have used this approach for constructing the formatted string.
The script which I have written : You can replace hihih with the variable name and try.
var gr = new GlideRecord('incident');
gr.get('0544020e07e5941046c7fd908c1ed0bc');
var variables='[code]<pre> Requirement Details :'+'<BR>';
variables+= 'sfdb: '+'hihiihi' +"<BR>";
variables+= 'Skill: '+'newowlkwel'+"<BR>";
variables+= "Skill S ID : "+ 'jakfjladsjfa'+"<BR>";
variables+= 'Skill Description: '+ 'test' +"<BR>" +"</pre>[/code] ";
gr.work_notes=variables
gr.update();
Output:
Mark helpful and correct if it helps.
Thanks,
CB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-23-2020 10:29 PM
Hello naveen.sharan,
You can add variables into an array and then setValue in work note with white spaces "+".
Please let me know if it works.
Regards,
Akshata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-23-2020 10:39 PM
Hi naveen.sharan,
The \t or &nsbp; will add only one spaces in between. So you have to use the <pre> tag in the script and format the code in which you want and the same way it will apprear.
You have to use <BR> for inserting a new if you are using pre tag.
IN the start you have to add [code]<pre> and after end of the full notes you have to close this tag </pre>[/code] like we do for HTML tag.
We also have used this approach for constructing the formatted string.
The script which I have written : You can replace hihih with the variable name and try.
var gr = new GlideRecord('incident');
gr.get('0544020e07e5941046c7fd908c1ed0bc');
var variables='[code]<pre> Requirement Details :'+'<BR>';
variables+= 'sfdb: '+'hihiihi' +"<BR>";
variables+= 'Skill: '+'newowlkwel'+"<BR>";
variables+= "Skill S ID : "+ 'jakfjladsjfa'+"<BR>";
variables+= 'Skill Description: '+ 'test' +"<BR>" +"</pre>[/code] ";
gr.work_notes=variables
gr.update();
Output:
Mark helpful and correct if it helps.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-27-2022 08:55 AM
Hi, this solution is not working in Rome for me, is this no longer supported