I am trying to create a request item that has, among other variables, a "related incident" reference. When this request item is submitted, if there's a related incident, I am opening that incident up and updating a "related record" field on it via a script task in the workflow. The flow is as such:
Start -> If (Has related incident is checked) -> Update incident -> (end if) -> Approval, tasks, etc.
This is my script task in the workflow:
if (current.variables.has_incident == "true") {
var gr = new GlideRecord('incident');
if (gr.get(current.variables.incident)) {