Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

372
Views
Javascript padStart() working correctly in alert box but not in email record in Dynamics 365 CRM

I have created an action that gets values from a CRM record in which are appended in a stringbuilder. Within the string that is being built, I need to add something to the equivalent of 10 spaces between the string as seen below:

for(var i = 0; i < ltRecordSnsAndLocations.length; i++)
{
    if(i < ltRecordSnsAndLocations.length - 1)
    {
        injectionString += (i+1).toString() + ". " + ltRecordSnsAndLocations[i][0].toString() + String("System Location:  ").padStart(String("System Location:  ").length+10,' ') + ltRecordSnsAndLocations[i][1].toString() + "\n";
    }

Which seems to be working correctly seen by the output in the alert box below:

enter image description here

As you can see, there is the correct padding between the number bulletted values and the system location which is what I want.

As stated earlier, I created an action in CRM which inputs this string into an email record denoted by the variable injectionString as seen below:

enter image description here

However, when the workflow kicks off and the injectionString passed in is populated, it ignores the padStart as seen below:

enter image description here

I've been fighting with this for a while now. Important to note that I tested in both Chrome and Edge Browsers. Any help on this is much appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The following blogpost provided the solution to my problem:
https://blog.hubspot.com/website/html-space

The simplest way to add a space in HTML (besides hitting the spacebar) is with the non-breaking space entity, written as &nbsp; or &#160;. Multiple adjacent non-breaking spaces won’t be collapsed by the browser, letting you “force” several visible spaces between words or other page elements.

enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!