water mark or prepopulated text inworknotes

nameisnani
Mega Sage

Hi Team 

 

when ever we are reopening the incident 

 

can any one please help me on this requriement 

 

Enable Mandatory capture of reason in Work Notes when an incident is reopened.

 

request is to ensure that whenever an incident is moved from Resolved to In Progress that is reopened by the caller or operate team, the system automatically should prompt the user or operate team to enter the reason for reopening, which should populate in the Work Notes field.

 

The incident should not be allowed to transition from Resolved to In Progress unless the reopening reason is mandatorily filled.

 

we need a water mark or pre populated text in the work notes 

 

how to achieve this requirment 

nameisnani_0-1778657527966.png

 

 

Ehab Pilloor

 

@Ehab Pilloor 

@Ankur Bawiskar 

 

please help me here

13 REPLIES 13

@nameisnani 

 

It maybe possible via DOM manipulation but it shall be avoided as much as possible.

 

Alternate solution i can suggest is to add the message to work notes via UI action by System.

 

Regards,

Ehab Pilloor

@Ehab Pilloor  - Alternate solution i can suggest is to add the message to work notes via UI action by System. 

 

can u provide that alternate solution

Ankur has provided the code. @nameisnani you can add it as shown is ss below: 

EhabPilloor_0-1778732963494.png

 

This works fine for your usecase. the placeholder only shows when prompted for adding worknotes during reopen.

 

Regards,

Ehab Pilloor

@Ehab Pilloor  attached sscreenshot is not clear - can you please attach new one please along with complete script 

@nameisnani 

// Client side onclick function
function reopenIncident() {


    if (g_form.getValue('work_notes') == '') {
        g_form.setMandatory('work_notes', true);
        g_form.addInfoMessage('Please provide the reason for reopening this Incident.');
        var streamNotes = g_form.getControl("activity-stream-work_notes-textarea");

        streamNotes.placeholder ='Please provide reason for opening this incident.';
    }

    gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); // MUST call the 'Action name' set in this UI Action
}

// Code that runs without 'onclick'
// Ensure call to server side function with no browser errors
if (typeof window == 'undefined')
    serverReopen();

function serverReopen() {
    // Set Incident state to active, update and reload the record
	//var streamNotes = g_form.getControl("activity-stream-work_notes-textarea");

        //streamNotes.placeholder ='Worknotes';
    current.incident_state = 2;
    current.state = 2;
    current.update();
    var msg;
    if (current.child_incidents > 0) {
        msg = gs.getMessage("{0} and its child incident(s) have been reopened", current.getDisplayValue());
    } else {
        msg = gs.getMessage("{0} has been reopened", current.getDisplayValue());
    }
    gs.addInfoMessage(msg);
    action.setRedirectURL(current);
}

I have added the code here.

 

Regards,

Ehab Pilloor