Employee Center - moving Connected Content between instances

Michal Sadowski
Mega Sage

Hi Employee Center superstars,

I'm getting ready for the migration project from Service Portal to Employee Center and just wanted to double check on one of the doubts I have that may impact the approach.

It's related to Connected content. Is this something you would start in Dev instance and then migrate up all the way to Prod for the initial implementation? Is this migratable in update sets or as XML imports or some other way? Any other thoughts on what to watch out for when moving Connected Content between instances?

Kind regards 

1 ACCEPTED SOLUTION

No problem, 
Yeah I just tested this by moving some connected content from dev to test and you're right it will work using xml. 
I would say it is not risky if you're confident that the data is correct. Additionally, as it is just data it is unlikely to break anything. 
if you have 2 sub production instances then you could migrate the data from dev to test before moving it to prod/live. 
Thanks
Alex

View solution in original post

10 REPLIES 10

Thank you Michal 🙂
Glad I could help

Hi!

I'd like to ask you how to remove "Connected Content" on other instances.

You answered that I could move Connected Content by XML files.

However, if I'd like to remove "Connected Content" on other instances(Not DEV instance), how should I do?

I suppose that I can't remove it by XML files, so is it OK to remove  directly Connected Content on other instances?

 

Thank you in advance.

 

Alex319
Giga Guru

Hi @Mayuko MURAMOTO 
In theory your instances should be the same. I would expect you to semi-regularly clone over you sub production environments from your production environment so that they are all identical. 
However, if you do not want certain connected content to be visible on the Employee Center I would simply suggest you set the catalog item to inactive. 
Below is an example of a consumable (Keyboard) that is connected to the Hardware topic but is not needed anymore.

Alex319_0-1697612457329.png

Alex319_2-1697612534058.png

 

By doing this instead of deleting the record you can simply reactivate in the future if needed. 

I hope this answers your question
Alex

Hi, @Alex319 

 

Thank you for your answer!

It helps a lot!

 

YuvrajS90374537
Tera Expert

Hey @Michal Sadowski ,
Case 1 – Moving from Table
If you want to move connected content from the m2m_connected_content table, open the record you wish to move. Once the form is open, use the "Add to Update Set" option under Related Links. Just ensure that your update set is in the Global application.

Case 2 – Moving for Record Producer
Let's say you have a Record Producer (e.g., General Benefits Inquiry) in the Human Resource: Core application. You've already captured it in an update set (e.g., ABC_GeneralBenefitsInquiry) in HR: Core, but notice that the connected content isn't included. To capture this:
       1. Create a parent batch update set (e.g., ABC_ParentUpdateSet).
       2. Create another update set (e.g., ABC_ConnectedContent) in the Global application.
       3. Navigate to your Record Producer (General Benefits Inquiry), go to the Assigned Topics related list, and open the connected content record.
      4. From there, use "Add to Update Set" to capture it in ABC_ConnectedContent.
      5. Add both ABC_ConnectedContent andABC_GeneralBenefitsInquiry as child update sets under ABC_ParentUpdateSet.
     6. Mark ABC_ParentUpdateSet as complete (this will also complete its child update sets).
     7. Finally, move the update sets to your Test/Prod instance either by using “Retrieve Completed Update Sets” (All -> System Update Sets → Update Sources) or by exporting/importing the XML.


NOTE : The "Add to Update Set" is a custom button and can be made by using UI Actions as shown in the image.
And the script for it is : 

 

addToUpdateSet();

function addToUpdateSet(){
	//Get current URL for return
	var url = GlideSession.get().getStack().bottom();
	
	//Set to force update and save current record
	current.setForceUpdate(true);
	current.update();
	
	//Initialize updateManager
	var updateManager = new GlideUpdateManager2();
	
	//If record is already included in update sets on save, do nothing
	var currTable = current.getTableName();
	if(currTable.startsWith('wf_') || currTable.startsWith('sys_ui_') || currTable == 'sys_choice' ||  current.getED().getAttribute('update_synch') == 'true' || current.getED().getAttribute('update_synch_custom') == 'true'){
		//Do nothing
	}
	//Else, add the record into the current update set
	else{
		updateManager.saveRecord(current);
	}
	
	//If the current record *has* attachments, add those
	if (current.hasAttachments()){
		addAttachments(current, currTable);
	}
	
	//If the current record *is* an attachment, add the chunks
	if (currTable == 'sys_attachment'){
		var attach_doc = new GlideRecord("sys_attachment_doc");
		attach_doc.addQuery("sys_attachment", current.sys_id.toString());
		attach_doc.orderBy("position");
		attach_doc.query();
		while (attach_doc.next()) {
			updateManager.saveRecord(attach_doc);
		}
	}
	
	//Display confirmation
	var currentSet = new GlideRecord('sys_update_set');
	currentSet.get(gs.getPreference('sys_update_set'));
	gs.flushMessages(); //Flush to avoid multiples when list updating
	gs.addInfoMessage('Record(s) added to update set ' + currentSet.name + '.');
	action.setRedirectURL(url);
}

//Add any attachments to the update set
function addAttachments(record, table){
	//Process the main sys_attachment record
	var attach = new GlideRecord("sys_attachment");
	attach.addQuery("table_name", table);
	attach.addQuery("table_sys_id", record.sys_id.toString());
	attach.query();
	while (attach.next()) {
		var updateManager = new GlideUpdateManager2();
		updateManager.saveRecord(attach);
		
		//Process each sys_attachment_doc chunk
		var attach_doc = new GlideRecord("sys_attachment_doc");
		attach_doc.addQuery("sys_attachment", attach.sys_id.toString());
		attach_doc.orderBy("position");
		attach_doc.query();
		while (attach_doc.next()) {
			updateManager.saveRecord(attach_doc);
		}
	}
}

 

You can also visit here for more details on "Add to Update Set" UI Action.
Hope this helps! Please mark this as helpful if it resolves your issue.
Thanks.
Yuvraj