Yamini
Returning Observer

How to change the project description of FS project?

Hello All,

We have a client requirement where we need to change the description of our FS project. we tried with the following method, but it does not appear to change in server mgr.

currentProject = connection.getProjectById(context.getProject().getId());

currentProject.setDescription("new project description");

However the above statement does not seem to take affect on server mgr,

425943_pastedImage_1.png

Kindly suggest.

Thank you.

0 Kudos
6 Replies
mareike
Returning Observer

Click at the project --> open Project  -> Properties.

There you can edit the description in the first menu item named "Project":

427473_pastedImage_0.png

0 Kudos
hoebbel
Crownpeak employee

Dear Yamini,

if you need/want to go via the API, then you need to lock the project beforehand and save it after the change:

project = connection.getProjectById(context.getProject().getId());

project.lock();

project.setDescription("new project description");

project.save();

project.unlock();

Mareike has already described the way via the GUI.

Best regards

Holger

0 Kudos
Yamini
Returning Observer

Hello Holger,

yes we wanted to do it via api, thanks for your answer!

0 Kudos
Yamini
Returning Observer

Hello Mareike,

Thanks for your input 🙂 We wanted to do it via API...sorry that it wasn't clear in my question.

0 Kudos
Yamini
Returning Observer

Hello Holger,

We tried with the methods you suggesed but we get the following exception when executing this api via schedule task:

-->

: Exception: changes not allowed for current connection

...

Following is our code:

connection = context.getConnection();

currentProject = connection.getProjectById(context.getProject().getId());

currentProject.lock();

currentProject.setDescription(formFieldVersion.get().toString());

currentProject.save(); 

currentProject.unlock(); 

Kindly suggest.

0 Kudos

Hi Yamini,

In a Schedule Task, if I am not mistaken, the given connection only provides read only access.

What would work, I think, is to set up a remote project configuration (e.g., to the project itself), where you can also define the user for accessing the project. You should then be able read the remote configuration from the current project and use it to open a remote project access via the given connection (getRemoteConnection). The defined user should have project administrator rights to make the changes.

Hope this helps.

Best regards

Stefan

0 Kudos