Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

unable to get or store project key and project name using SIL script

Mohan Reddy KRISHNAREDDYGARI May 25, 2023

Hi,

we are unable to get or store project key and project name using SIL script
can someone help us here pls ?

1 answer

0 votes
Anna Hryhoruk _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2023

Hi @Mohan Reddy KRISHNAREDDYGARI ,

Could you please share a bit of context on how and when you are trying to get this information?

If you are running just SIL script from SIL Manager and have in context some particular Jira issue , you can get the project key as : 

return project;

Please see the full list of standard variables like project via link

Also, you may be interested in  routine getProjectKeyByName which will give project key by project name 

If, for example, you are running listener, you can get project information via  getProjectFromEvent()routine using JProject structure, which contains project id, key, name etc.

If that doesn`t help, please describe your use case and I will be glad to help you. 
Anna

Mohan Reddy KRISHNAREDDYGARI May 25, 2023

Hi Anna, Thanks for your response
As a Business admin, I want to restore a project that would be for some reasons deleted

Automated way to have the Project key and project name
Solution:- SIL script

Acceptance criteria;

Having the list of input required by restore process delivered as CSV and scheduled every day and stored on the server (like a backup) :

Anna Hryhoruk _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2023

I am still not sure that I understand what you are trying to set up with SIL particularly. So feel free to correct me in my assumptions.

If you want to collect information about deleted projects, you can configure SIL Listener, which will be triggered by the "Project Deleted" event, so each time someone deletes a project, sil script will be triggered. The example of the script: 

printInFile("myprojects.txt", "Result of listener: " + getProjectFromEvent());

as a result, you will see in txt file: 

Result of listener: 12000|DEL|del||software|JIRAUSER11200||true|10324|

where in my example DEL is the project key and del is the project name. You even can trigger email sending to some admin person with an alert that some project was deleted. 


And another my understanding of your set up: 


If you want each day to get the list of all projects you have in your jira - it`s easy. 
sil script: 

string datetime =currentDate();
string allprojs= allProjects();
printInFile("myprojects.txt", datetime+ " - " + allprojs);

as a result you get file with similar content: 

2023-05-25 18:43:33 - APP|COMM|CONF|CM|DB|DEC|DEMO|ES|ES2|JSU|LF|MGR|NY|OCT|PORTAL|SEP|SD|SPRN|THD|TSOT|ZEP

also this script can be run on a daily basis automatically, if you configure sil scheduler

 

Hope it will give you some idea on solving your problem.

Anna

bhadresh_hampanna_external May 29, 2023

Hello Anna,

we followed below script which you have provided,

string datetime =currentDate();
string allprojs= allProjects();
printInFile("myprojects.txt", datetime+ " - " + allprojs);

but output we got only as "DONE", it was not displaying any projects or keys.
Can you help us to here. 

Anna Hryhoruk _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2023

The list of projects will not appear in the console, it should be added to the newly created file myprojects.txt inside the silprograms folder. If you want to get output in the console window, you need to add 

runnerLog( datetime+ " - " + allprojs);

Suggest an answer

Log in or Sign up to answer