The CreatorCon Call for Content is officially open! Get started here.

Convert page variant to a new page - Next Experience

Norah Nguyen
Tera Contributor

I have a page in UI builder, lets called Home. On the Home page, I have two variants. Now I want to convert one of the variant to a new page - Is this possible? The reason for this is that I now want the content of variant to be accessible from another page, since I'm planning to use the first variant of Home page as home page.

 

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Currently, there is not a supported way to convert a variant into a new page or move a variant or page to a different experience. Depending on how complex the page is, you could create a new blank page and then try to copy over the JSON int he fields from one sys_ux_macroponent to another, but there could be some issues with this.

John Zyphur
ServiceNow Employee
ServiceNow Employee

@Brad Tilton I was able to get this working.  Simply needed to re-create the client state variables, client scripts, and data broker server scripts within the UI Builder page.  Posting here for posterity.

Any chance you could write a guide on how to do this? Would be extremely helpful for many developers.

John McCormick1
ServiceNow Employee
ServiceNow Employee

As Brad said this isn't technically supported, however you can cheat around that if you're VERY CAREFUL. I'll put some steps below for it, but please please please do it in an update set that you can back out if it goes sideways.

1. Create a brand new blank page within the same experience

2. In the UIB Editor page, go to the developer menu -> Open related records -> Open variant collection
3. Copy the sys_id of the variant collection
4. Delete the Screen record in the related list for the Screen collection

5. Open the Variant in the UIB Editor that you want to move to the page
6. Go to the Developer menu -> Open related records -> Open Variant

7. Change the Screen Collection field to the be record of the Variant Collection sys_id you grabbed above
8. Return to the Experience page in UIB and find the page you created in the list (you should see the variant in the list now)

9. Open the variant and then Preview it to make sure that it loads correctly in runtime

In most cases that should work, however for situations where a screen is being used in multiple places this can cause issues. So as I mentioned, always do this in an update set that you can back out if it falls apart.