Remove Unwanted Prefix from Serial Number Discovered by SNOW Software

Service now11
Tera Contributor

Hi,

 

I am facing an issue with the serial number in the computer table that is generated from SNOW Software. These records are integrated with the SNOW tool. This is an incoming connection from SNOW to ServiceNow. The BIOS serial number in SNOW Software is 4206f0ba74195be736d078b6133fd839. However, it is being reflected as VMware - 4206f0ba74195be736d078b6133fd839 in ServiceNow. I do not want "VMware" in the serial number. I want the exact values from the SNOW tool. So how to solve this. I am writing transform script for this. I don't know this will help or not. Kindly provide me a solution to solve this.

 

Below is the transform map script:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
 
    if (source.u_biosserialnumber.indexOf('VMware-') === 0) {
        // Remove the 'VMware - ' prefix
        target.serial_number = source.u_biosserialnumber.replace('VMware-', '');
    } else {
        // If no prefix, just copy the source serial number
        target.serial_number = source.u_biosserialnumber;
    }
})(source, target, map, log, action == "update");

 

Thanks.

6 REPLIES 6

Robbie
Kilo Patron
Kilo Patron

Hi @Service now11,

 

I've verified your supplied script works as desired.

To clarify your question, is the reason you've created a Transform Script is because when importing the data from SNOW to ServiceNow you leverage Transform Maps - I assume so, please confirm.

If so, this script is perfect and should be placed as an onBefore Transform Script.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

Hi Robbie,

Yes. Data is imported from SNOW at a particular time. I have executed this on "onBefore", but it is not providing the solution. What is the reason for this? Can you please help me with this?

Hi @Service now11,

 

Let me try and replicate this on my PDI to confirm for you... it may take me a little while.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

Thank You Robbie.