remove carriage return characters or extra spaces from specific table record

tanmay8
Tera Contributor

Hi All,

In the Hardware asset table for serial number, I get the record for contains and starts with, but I don't get the record for is equal to (=).Maybe while importing some extra spaces or carriage return characters are added(after searching a lot, I got these answers and I don't know which is correct in my case). So correct me if i'm wrong.

After reimporting that record, we were able to resolve this issue. Also please help me with exact script for this issue to avoid getting such types of inputs.

Please help me to understand this situation and selecting script.

Note : i have to create script for workflow as well as before condition transform script.

 

Thanks in advance.

Tanmay Mangaonkar

4 REPLIES 4

tanmay8
Tera Contributor

Hi All,

 

I have sorted out some scripts without knowing my situation.

After knowing the situation ill implement.

 

1)smo = smo.replace(/<br\/>/g,'');
2)smo= smo.replace(/(<|&lt;)br \s*\/*(>|&gt;)/gi,'');
3)smo = smo.replace('/\r\n'," ");
4)smo = smo.replace(/CN=/g,"");
5)smo = smo.replace(/\s+/g,"");

6)smo = smo.replaceAll("\r","");

 

Thanks in advance

Best regards,

Tanmay

tanmay8
Tera Contributor

Hi Experts,

 

Please help me with this situation.

@Ankur Bawiskar  @Hitoshi Ozawa @Chuck Tomasi 

 

Thanks & Regards,

Tanmay

GV Saranesh Kum
Kilo Guru

Hi Tanmay,

If the issue is about leading spaces. you can write like below in transform map or background scripts to modify the existing records.

smo = smo.toString().trim();

Definitely, it is not good idea to remove spaces or hyphens in between the serial numbers, as in certain cases they might be valid. It is good idea to get them corrected over excel and reload them.

Hope this helps.

Regards

Saranesh

Hi Saranesh,

 

Thanks for your quick response.

I'm not sure if these are empty spaces or not. Earlier, we raised one HI ticket and i got to know from my teammates that the servicenow support team were able to see =ABCD1234" such types of extra quotes in the serial number for us, it was =ABCD1234 only. So the trim is not working?

 

Thanks & regards,

Tanmay