Clone / Cloning - How to Preserve Service Portal Icon and Logo

G24
Kilo Sage

What is the best way to Preserve the Service Portal FavIcon and Logo on lower instances (Dev, Test, Sand) when performing a Clone Down from Production?

 

Step11.png

1 ACCEPTED SOLUTION

G24
Kilo Sage

Step 1.  Make a note of the sys_id of the actual portal record in your lower instance.  (Records in the sys_attachment table point back to this.)

Step1.png

 

Step 2.  Find the relevant records in the sys_attachment table.  For a thorough understanding, make a note of the Content Type of each record (png, jpg).

Step2.png

 

Step 3.  Download each attachment, for safekeeping, by clicking on each "File name" link.  (Note you can't open these records in Form View like you would other ServiceNow records.)  Clicking on each link immediately downloads the entire file.

Step3.png

 

Step 4.  Notice that the downloaded files do NOT have filename extensions.

Step4.png

 

Step 5.  Delete each of the files to confirm that we are working with the right records.

Step5.png

 

Step 6.  Refresh the Logo record to see that the Logo and Icon fields have gotten erased / cleared out.  We now know that nothing in the Portal record really points to the sys_attachment table.  Rather, it works the other way around.  Records in sys_attachment point back to the sp_portal table.

Step6.png

 

Step 7.  Rename each each of the downloaded files and give each one the correct file extension (see step 2).

Step7.png

 

Step 8.  From the portal record, click "Update" for each field, and re-upload the image files.

Step8.png

 

Step 9.  But wait.  We forgot the "sys_attachment_doc" table, where the actual image binary data is stored.  Add the "sys_attachment.Table sys ID" column to this List View and again put in the sys_id of the portal record, so we can see that these records also point back to the sys_portal table.

Step9.png

 

Step 10.  Now that you know exactly what needs to be preserved across Clone operations, go to your PRODUCTION system, and in table clone_data_preserver, create one record for the sys_attachment table, and one record for the sys_attachment_doc table, each with a condition that the table_sys_id must match the sys_id of your portal record in your target (lower) instance (from step 1).  And be sure those 2 records you create are attached to whatever Clone Profile you will be using.  The final product should look like this:

Step10.png

 

Step 11.  Perform a clone to your target instance.  After the Clone operation is complete, CLEAR YOUR WEB BROWSER CACHE (Ctrl + Shift + D in Chrome) and then verify that the Portal FavIcon and Logo are still correct and as you expect.

Step11.png

 

Now live happily ever after.

The End.

View solution in original post

3 REPLIES 3

G24
Kilo Sage

Step 1.  Make a note of the sys_id of the actual portal record in your lower instance.  (Records in the sys_attachment table point back to this.)

Step1.png

 

Step 2.  Find the relevant records in the sys_attachment table.  For a thorough understanding, make a note of the Content Type of each record (png, jpg).

Step2.png

 

Step 3.  Download each attachment, for safekeeping, by clicking on each "File name" link.  (Note you can't open these records in Form View like you would other ServiceNow records.)  Clicking on each link immediately downloads the entire file.

Step3.png

 

Step 4.  Notice that the downloaded files do NOT have filename extensions.

Step4.png

 

Step 5.  Delete each of the files to confirm that we are working with the right records.

Step5.png

 

Step 6.  Refresh the Logo record to see that the Logo and Icon fields have gotten erased / cleared out.  We now know that nothing in the Portal record really points to the sys_attachment table.  Rather, it works the other way around.  Records in sys_attachment point back to the sp_portal table.

Step6.png

 

Step 7.  Rename each each of the downloaded files and give each one the correct file extension (see step 2).

Step7.png

 

Step 8.  From the portal record, click "Update" for each field, and re-upload the image files.

Step8.png

 

Step 9.  But wait.  We forgot the "sys_attachment_doc" table, where the actual image binary data is stored.  Add the "sys_attachment.Table sys ID" column to this List View and again put in the sys_id of the portal record, so we can see that these records also point back to the sys_portal table.

Step9.png

 

Step 10.  Now that you know exactly what needs to be preserved across Clone operations, go to your PRODUCTION system, and in table clone_data_preserver, create one record for the sys_attachment table, and one record for the sys_attachment_doc table, each with a condition that the table_sys_id must match the sys_id of your portal record in your target (lower) instance (from step 1).  And be sure those 2 records you create are attached to whatever Clone Profile you will be using.  The final product should look like this:

Step10.png

 

Step 11.  Perform a clone to your target instance.  After the Clone operation is complete, CLEAR YOUR WEB BROWSER CACHE (Ctrl + Shift + D in Chrome) and then verify that the Portal FavIcon and Logo are still correct and as you expect.

Step11.png

 

Now live happily ever after.

The End.

Note!  This SHOULD work, but IS NOT workings of 10/10/2023, because of ServiceNow Problem PRB1705247.

iooryz
Tera Expert

Did you find another solution for this? As the documentation on KB1642193 says that the records in the sys_attachment can not be preserved when cloning.