Skip to main content
Home page
Example scripts
To homepage
New
Jira
Cloud icon
Cloud

Prefill fields with user info and dates for JSM

Features
Behaviours
Created 2 month(s) ago, Updated 2 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
typescript
// Replace with your actual custom field IDs
const employeeNameField = getFieldById("customfield_11546");
const startDateField = getFieldById("customfield_10015");
const summaryField = getFieldById("summary");
const descriptionField = getFieldById("description");

const employeeName = employeeNameField.getValue();
const startDate = startDateField.getValue();

// Only update when both fields have values
if (employeeName && startDate) {
    summaryField.setValue(`${employeeName} will be joining the company on ${startDate}`);
    descriptionField.setValue({
        "version": 1,
        "type": "doc",
        "content": [
            {
                "type": "paragraph",
                "content": [{ "type": "text", "text": `Employee: ${employeeName}` }]
            },
            {
                "type": "paragraph",
                "content": [{ "type": "text", "text": `Start date: ${startDate}` }]
            }
        ]
    });
}
Having an issue with this script?
Report it here