Search the FirstSpirit Knowledge Base
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,
Kindly suggest.
Thank you.
Click at the project --> open Project -> Properties.
There you can edit the description in the first menu item named "Project":
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
Hello Holger,
yes we wanted to do it via api, thanks for your answer!
Hello Mareike,
Thanks for your input 🙂 We wanted to do it via API...sorry that it wasn't clear in my question.
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.
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