Created
July 8, 2025 07:58
-
-
Save vikrantyadav11/f91c8395d2d36107b2a59bc84a7731a4 to your computer and use it in GitHub Desktop.
Set Default for Single Line text field based on dropdown field selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const customerFacingVarbatimField = getFieldById("customfield_27449"); | |
const customerFacingVarbatimFieldValue = customerFacingVarbatimField.getValue()?.value; | |
const responseField = getFieldById("customfield_20579"); | |
const responses = { | |
"Fix Released": "The issue has been fixed in [Version X.Y.Z] released on [Date]. Please upgrade to apply the fix.", | |
"Fix in Progress": "Actively working on a fix, expected in our upcoming patch [on Date].", | |
"Under Investigation": "The issue/request is under investigation. Updates will follow.", | |
"Workaround Provided": "[Share workaround].", | |
"Added to Backlog": "Logged for future consideration. We'll keep you posted.", | |
"Known Limitation": "Known product limitation. Under review for a future release.", | |
"Already Supported": "This feature exists. Access it via: [Instructions or link].", | |
"Answer Provided": "Requested info: [Add details].", | |
"More Information Needed": "Please clarify or provide more details on [specific part].", | |
"Reject": "We regret to inform you that this request has been rejected. [Add reason if needed]." | |
}; | |
if (customerFacingVarbatimFieldValue === "Other") { | |
responseField.setReadOnly(false); | |
responseField.setValue(""); // Optional: clear the field so the user can enter freely | |
} else if (responses.hasOwnProperty(customerFacingVarbatimFieldValue)) { | |
responseField.setReadOnly(true); | |
responseField.setValue(responses[customerFacingVarbatimFieldValue]); | |
} else { | |
// Optional: default behavior for unknown values | |
responseField.setReadOnly(false); | |
responseField.setValue(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment