JavaScript examples for the Message Field application are available at GitHub
- MessageField v5 - JavaScript API Description and Usage Guide
- New Public API Methods (v5.1+)
- Update message on create
- Update message with priority
- Update message with priority and select field
- Update message on create(SD)
- Update message with priority(SD)
- Update message with priority and select field(SD)
- Update and hide message with 2 conditions by select fields(Service Desk)
- Update and hide message with 2 conditions by select fields
- Hide message if all fields are empty(View issue)
- Update message with bundled select(SD-create)
MessageField v5 - JavaScript API Description and Usage Guide
New Public API Methods (v5.1+)
The Message Field now provides public API methods to retrieve form data programmatically. These methods are available on the global MESSAGE_FIELD_OBJECT
:
getCurrentFormSelector()
Returns the current form selector based on the page context (Jira or Service Desk) and whether a dialog is opened.
// Get current form selector
const formSelector = MESSAGE_FIELD_OBJECT.getCurrentFormSelector();
console.log('Current form selector:', formSelector);
Returns:
string
- The form selector for the current contextnull
- If page manager is not initialized
getDataFromDefaultForm()
Retrieves form data from the default form based on the current page context (Jira or Service Desk).
// Get form data from default form
const formData = MESSAGE_FIELD_OBJECT.getDataFromDefaultForm();
console.log('Form data:', formData);
Returns:
object
- Form data object containing field valuesnull
- If page manager is not initialized
getFullDataFromDefaultForm()
Retrieves complete form data including all field information from the default form.
// Get full form data from default form
const fullFormData = MESSAGE_FIELD_OBJECT.getFullDataFromDefaultForm();
console.log('Full form data:', fullFormData);
Returns:
object
- Complete form data object with detailed field informationnull
- If page manager is not initialized
Note: These API methods work in both Jira and Service Desk contexts and automatically detect the appropriate form based on the current page environment.
Update message on create
Update message with priority
Update message with priority and select field
Update message on create(SD)
Update message with priority(SD)
Update message with priority and select field(SD)
Update and hide message with 2 conditions by select fields(Service Desk)
Update and hide message with 2 conditions by select fields
Hide message if all fields are empty(View issue)
The script will check the custom fields on the view issue screen. If all fields are empty, the message banner will be hidden.