how to pull caller email on short description in incident form ?

VedhR
Tera Contributor

Whenever caller is selected in incident form that caller email id should be displayed in short description and work notes fields.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@VedhR 

you can use onChange client script on caller_id field and set the short description and work notes

sample script below

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    g_form.getReference('caller_id', function(caller) {
        if (caller) {
            var email = caller.email;
            var shortDescription = g_form.getValue('short_description');
            var workNotes = g_form.getValue('work_notes');
            
            // Update Short Description
            g_form.setValue('short_description', 'Caller Email: ' + email + ' - ' + shortDescription);
            
            // Update Work Notes
            g_form.setValue('work_notes', 'Caller Email: ' + email + '\n' + workNotes);
        }
    });
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@VedhR 

you can use onChange client script on caller_id field and set the short description and work notes

sample script below

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    g_form.getReference('caller_id', function(caller) {
        if (caller) {
            var email = caller.email;
            var shortDescription = g_form.getValue('short_description');
            var workNotes = g_form.getValue('work_notes');
            
            // Update Short Description
            g_form.setValue('short_description', 'Caller Email: ' + email + ' - ' + shortDescription);
            
            // Update Work Notes
            g_form.setValue('work_notes', 'Caller Email: ' + email + '\n' + workNotes);
        }
    });
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Uncle Rob
Kilo Patron

Its worth asking why?
Why email in the short description of every single incident?  

Dr Atul - LNG
Tera Patron

Hi @VedhR 

 

What is the business use case for this? Adding a caller in the Short description did not add any value, where you already have the caller field on the incident form. You will increase technical debt.