- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:03 PM
I have the field u_jira_project on the incident table of type Reference to u_jira_project table. I need to create a form button called 'Create Jira'. When the user click on this button, he needs to see a pop up with all the projects from u_jira_project table divded into two columns: u_project_name, u_project key. After the user chose a project, the value of the project that he chose need to be populated inside u_jira_project field on the incident table. How can I achieve that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2023 03:39 AM
Their is one more error: make it name,key
var $j = jQuery.noConflict();
var ga = new GlideAjax('ShowJiraProject');
ga.addParam('sysparm_name', 'getProjects');
ga.getXML(parseResponse);
function parseResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
var str = "<div><table class='table' id='tableData'><tr><th>Name</th><th>Key</th></tr>";
answer = JSON.parse(answer);
for (var i = 0; i < answer.length; i++) {
str = str + '<tr id="tableRow"><td>' + answer[i].name +'</td><td>' + answer[i].key + '</td></tr>';
}
$j('#iframee').append(str);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2023 09:57 AM
There are a lot many tasks in this, will try to help you as I get time daily!
I am also stuck somewhere that has to be completed before this week ends!
I hope you understand 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2023 01:22 PM
Hi
You can achieve this functionality by creating an ui-action on the incident table, which opens a dialog window with a list of projects from the u_jira_project table. Once the user selects a project, a script can set the value of the u_jira_project field on the incident table to the selected project's sys_id.
Please have a look at Exalate integration software. It enables you to synchronize data between the two systems, including incidents and projects, automating the transfer and ensuring they remain in sync.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:15 PM
Hi,
To achieve this functionality, you can follow the below steps:
- Create a new UI action by navigating to "System Definition" > "UI Actions" in the application navigator.
- Click on the "New" button to create a new UI action record.
- In the "UI Action" form, give a name to the action (e.g. "Create Jira").
- Set the table to "incident" table.
- Set the type to "Action".
- In the "Action name" field, enter the name you want to display on the form button (e.g. "Create Jira").
- In the "Onclick" field, enter the following code:
function createJira() {
var dlg = new GlideModal('jira_project_modal');
dlg.setTitle('Select a project');
dlg.setWidth(600);
dlg.render();
}
createJira();
- Save the UI action record.
- Create a new UI page by navigating to "System UI" > "UI Pages" in the application navigator.
- Click on the "New" button to create a new UI page record.
- In the "UI Page" form, give a name to the page (e.g. "Select Jira Project").
- Set the "Page" field to "Form".
- In the "Table" field, select "u_jira_project".
- In the "Type" field, select "List".
- In the "View" field, select "Default".
- In the "Template" field, select "Bootstrap Modal".
- Click the "Submit" button to create the UI page record.
- In the newly created UI page record, click on the "Client Scripts" related list and add a new client script.
- In the client script, enter the following code:
function selectJiraProject(sys_id, project_name, project_key) {
var ga = new GlideAjax('incidentUtils');
ga.addParam('sysparm_name', 'setJiraProject');
ga.addParam('sysparm_sys_id', sys_id);
ga.addParam('sysparm_project_name', project_name);
ga.addParam('sysparm_project_key', project_key);
ga.getXML(function(response) {
if (response.responseXML.documentElement.getAttribute("answer") == "success") {
g_form.setValue('u_jira_project', sys_id);
}
});
GlideModal.dismiss('jira_project_modal');
}
- Create a new script include by navigating to "System Definition" > "Script Includes" in the application navigator.
- Click on the "New" button to create a new script include record.
- In the "Script Include" form, give a name to the script include (e.g. "Incident Utils").
- In the "Script" field, enter the following code:
var IncidentUtils = Class.create();
IncidentUtils.prototype = {
initialize: function() {
},
setJiraProject: function() {
var sys_id = this.getParameter('sysparm_sys_id');
var project_name = this.getParameter('sysparm_project_name');
var project_key = this.getParameter('sysparm_project_key');
var gr = new GlideRecord('u_jira_project');
if (gr.get(sys_id)) {
gr.u_project_name = project_name;
gr.u_project_key = project_key;
gr.update();
return 'success';
} else {
return 'error';
}
},
type: 'IncidentUtils'
};
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:28 PM
@Rahul Kumar17 if i wanted to use CHAT gpt i would have done that by myself

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:43 PM
Hi,
Create UI Action
var ga = new GlideAjax('GetJiraProjects');
ga.addParam('sysparm_name', 'getJiraProjects');
ga.getXML(parseResponse);
function parseResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var projects = JSON.parse(answer);
var projectList = "";
for (var i = 0; i < projects.length; i++) {
var project = projects[i];
projectList += "<option value='" + project.sys_id + "'>" + project.u_project_name + " (" + project.u_project_key + ")" + "</option>";
}
var dialog = new GlideModal('select_jira_project');
dialog.setTitle('Select Jira Project');
dialog.setWidth('40%');
dialog.setPreference('projects', projectList);
dialog.render();
}
function setJiraProject(projectId) {
g_form.setValue('u_jira_project', projectId);
}
Client Script:
function onSubmit() {
var projectId = $('select[name="project"]').val();
if (projectId) {
parent.setJiraProject(projectId);
parent.document.getElementById('gsft_main').contentWindow.location.reload();
return true;
}
else {
alert('Please select a project.');
return false;
}
}
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2023 10:49 PM
Hi Alon,
I am trying to provide you solution even while i am working. From anywhere so that your solution can be done.
Thanks for the comment
Thanks,
Rahul Kumar