Yamini
Returning Observer

How to execute a script in content creator using fs-button

Hi team, How do I run this script on the content creator using FS-button?

It does not execute nor does it throw any error. Can i use the context.getElement for content creator too? or is there something else i have to use.

I have added FS-Button in the form of the page template and also in the html part the FS-button is working but the script is not.

The following code runs perfectly fine on Site architect when i right click on a page and run this script on it.

import de.espirit.firstspirit.access.store.pagestore.Page;

import de.espirit.firstspirit.access.store.pagestore.Section;

page= context.getElement();

if (page instanceof Page)

{

scriptFormData = context.showForm();

scriptFormField_name = scriptFormData.get(null, "script_user_name").get();

scriptFormField_header = scriptFormData.get(null, "script_headline").get();

scriptFormField_name = page.getEditor().toString();

formData = page.getFormData();

try {

page.setLock(true);

formData.get(null,"comment_headline").set(scriptFormField_header);

formData.get(null,"comment_name").set(scriptFormField_name);

page.setFormData(formData);

page.save();

}

finally{

page.setLock(false);

} }

0 Kudos
0 Replies