ONLYOFFICE DocSpace released: improve document collaboration with offices, customers, and partners. Use it for free!
ONLYOFFICE DocSpace released

How to get content control value by tag through plugin?

I have community version installed. And I am trying to get a content control value based on a tag and update that value to the rest of the content controls with similar tags through a plugin.
OS version: Ubuntu 20.04LTS
App version: DocumentServer v7.3

Hello @waghankit
It seems that you can use InsertAndReplaceContentControls method and specify tag\internalID to change its contents. We discussed similar case recently here:Replacing content in an existing ContentControl with a Plugin - #4 by Alexandre
If I misunderstood your request, please clarify it.

I have four content control tags with same “tag”. Now if I update one of the content controls then its value should be updated to the rest of the content controls onBlur.

If it’s possible, please reproduce the situation and record a videofile, additionally you can provide us with a test file as well.

window.Asc.plugin.event_onBlurContentControl = function(oPr)
			console.log("oPr", oPr);
			window.Asc.plugin.executeMethod ("GetAllContentControls", null, function (data) {
				console.log('allcontentcontrols', data)
				for (var i = 0; i < data.length; i++) {
					if (data[i].Tag == oPr.Tag) {
						var arrDocuments = [{
							"Props": {
								"InternalId": data[i].InternalId
							"Script": `var oParagraph = Api.CreateParagraph();oParagraph.AddText("${Asc.scope.text}");Api.GetDocument().InsertContent([oParagraph]);`
						window.Asc.plugin.executeMethod("InsertAndReplaceContentControls", [arrDocuments]);

So basically, what i am trying to achieve is. I am changing a specific content control and onBlur event , i want to update the value of the current content control to the rest of the content controls present in the document which have same Tag id as the content control which was being edited.

Your code sample looks OK. Did you face any issues? If so, please describe it in details, we will check it out.