UI for Creating a New Jira Issue
While the Jira Integration Framework can have rules that automatically route a record over into a Jira Issue, sometimes it is desired that the user can create a new Jira issue with some basic required fields that are pulled live from Jira. In those cases, the framework can provide a User Interface for that stage of the creation.
Implementation Steps
STEP 1: Create a UI Action on the Table
Name: Choose your own wording (eg. Create Jira Issue)
Table: Choose a table that you want this control to be present on (eg. "Incident [incident]")
Action name: save_and_redirect_page_to_form
Client: true
Click the checkbox on at least one of the following "Control" fields:
Form button
Form context menu
Form link
List bottom button
List context menu
List choice
List link
Onclick: startClientSideOfProcess()
Show update: Depends on your use case. Typically, this would be "true"
Show insert: Depends on your use case. Typically, this would be "true"
Condition: Paste the following code snippet into your condition field. IMPORTANT: change the string, "TODO-INSERT-INTPOINTCODE", with the webhook code from your integration point that you are using for this particular use case.
!x_yala_jira.IntegrationCommonHelper.recordIsLinkedToJira(current) && x_yala_jira.JiraIssueCreationInterfaceUtil.isSupportedSourceTable(current.getTableName(), "TODO-INSERT-INTPOINTCODE")
Script: Paste the following code snippet into your script field. IMPORTANT: change the string, "TODO-INSERT-INTPOINTCODE", with the webhook code from your integration point that you are using for this particular use case.
function saveAndRedirectPageToForm() {
var intPointCode = "TODO-INSERT-INTPOINTCODE";
var lib = 'UI Action';
var func = 'Create Jira Issue';
var logger = new x_yala_jira.SystemLogHelper(true);
try {
logger.info(lib, func, 'ENTERING');
current.update();
logger.debug(lib, func, "intPointCode: " + intPointCode);
var referrer = current.getTableName() + ".do?sys_id=" + current.sys_id;
logger.debug(lib, func, "referrer: " + referrer);
action.setRedirectURL("/$sp.do?id=jira_new_issue&source_table=" + current.getTableName() + "&source_sysid=" + current.sys_id + "&intPoint=" + intPointCode + "&referrer=" + referrer);
} catch (e) {
logger.reportException(lib, func, e);
} finally {
logger.info(lib, func, 'LEAVING');
logger.writeCumulativeEntries(true);
}
}
if (typeof window == 'undefined') {
saveAndRedirectPageToForm();
}
function startClientSideOfProcess() {
if (typeof g_modal == "undefined") {
gsftSubmit(null, g_form.getFormElement(), 'save_and_redirect_page_to_form');
}
};
On the Workspace section on the form, do the following:
Workspace Form Menu: true
Workspace Client Script: Paste the following code snippet into your script field. IMPORTANT: change the string, "TODO-INSERT-INTPOINTCODE", with the webhook code from your integration point that you are using for this particular use case.
function onClick(g_form) {
var intPointCode = "TODO-INSERT-INTPOINTCODE";
var tableName = g_form.getTableName();
var sysId = g_form.getUniqueValue();
g_modal.showFrame({
url: '/$sp.do?id=jira_new_issue&source_table='+tableName+'&source_sysid='+sysId+'&referrer=&intPoint='+intPointCode,
title: 'New Jira Issue',
size: 'lg',
height: 500
});
}
If desired, you may also set up the "Requires role" section of the form. Also, you might consider any "UI Action Visibility" rules as well.
STEP 2: Configure your Integration Point Settings
Navigate to the integration point associated with the UI Action you created above. Add/modify the following settings:
Setting #1: Additional fields to include on the New Issue Form
CSV list of fields to include on the New Jira Issue Form. These are Jira field IDs.
Name
new_issue_form.additional_fields
Type
Large String
Short Description
Additional fields to include on the New Issue Form
Large String
{enter any Jira field IDs in a comma separated format}
Setting #2: Issue Type ID for Epics
If your integration involves issues types that represent Jira epics, you will want to include a setting for that here.
Name
epic_issuetype_id
Type
Short String
Short Description
Epic IssueType ID
Short String
{enter any issue type ID value that represents an epic (eg. 5)}
Setting #3: Default User for Unknown External Owner
If you want some kind of ownership of a Jira issue, but the external owner can not be resolved, what user sys_id should be used
Name
ext_owner_sysid_for_unknown
Type
Short String
Short Description
Sys ID value for a user record when no record can be matched between Jira & ServiceNow
Short String
{sys_id of the user record}
Setting #4: Supported Issue Types
If you desire to limit the issue types that can be assigned through the New Jira Issue interface, you should add those issue types here.
Name
supported_issue_types
Type
Large String
Short Description
Supported Issue Types
Short String
{csv of Jira Issue Type ids (eg. 2,1,4,10200)}
Setting #5: Supported Source Tables
To define which tables the Create Jira Issue feature is supported on, enter the table names in csv format in this setting.
Name
supported_source_tables
Type
Large String
Short Description
Supported Source Tables
Short String
{csv of table names (eg. incident,incident_task)}
Setting #6: Flow to execute on submitting the new Jira Issue Form
Once the new Jira issue form is filled out, the component will kick off a flow. This settings specifies what that flow is that will be executed.
Name
new_issue_form.flow_to_execute_on_submit
Type
Reference
Short Description
Flow to execute on submitting the new Jira issue form
Reference Record
{Table: "Flow [sys_hub_flow]", Record: ${the subflow to trigger when submitting the new Jira Issue Form}}
Step 3: Create your Subflow
Flow inputs
source_record
GlideRecord of the source table
linked_record
Reference to the Jira Record Linkage table
additional_payload
A string that will contain JSON data of additional parameters for the Jira Issue
current_user
A string that will have the sys_id of the user triggering the creation
external_owner
A string that will have the sys_id of the ServiceNow user that owns the record. (Note: while this needs to be an input in the flow, it does not necessarily have to be implemented)
Last updated