Data transformation

ShreyasG
Tera Contributor

I have to move stories from dev instance to prod instance, with below criteria

1. i have to match sys_ids in both instances

2. i have to check whether the number is taken by other story in prod else i have to keep same number

3. If number found then assign new number to story

 

4 REPLIES 4

Swapna Abburi
Mega Sage
Mega Sage

Hi @ShreyasG 

I don't think you can enforce unique numbering during XML import through a business rule. You can try below approach.

 

Firstly, extract the list of stories from dev and compare the story numbers with production. If number exists already in prod for any stories, then take those numbers and update the corresponding stories in Dev instance with next available number from production.

Then you can export the stories and import then using xml 

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ShreyasG 

I’m not sure how you’re removing the data, but if you’re moving it via XML, then the sys_id will be checked. If the sys_id does not exist, a new record will be created; otherwise, the existing record will be updated. However, the rest of the data cannot be verified or controlled through XML movement.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

GlideFather
Tera Patron

Hi @ShreyasG in DEV - navigate to [rm_story] and make the conditions to have the list of your desired stories that you want to export.

Once you have it, click the right mouse button on any column label and select Export > XML

Then navigate to the PROD's same table to the target, right mouse button "Import XML" (watch out there is "Import" and "Import XML", the second is correct), and then put the exported file a moment ago and it is there.

However it is possible that there will be mismatch in the numbering as it is two separated environments with different numbers of records and the numbers are generated automatically...

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@ShreyasG 
just like that:

correction "Step 2: import the saved file to the target env"

KamilTEL_0-1751542850606.png

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */