Auto populate description of Complaint task from Complaint Case

sreeshsurendran
Tera Guru

Hi all,

 

The requirement is auto populate certain field values from linked Complaint Case into the Complaint task's description field.

 

Also, want the field attribute to be in bold

 

For example,

 

Account: ServiceNow

Contact: Fred Luddy

 

I have tried an after-insert Business rule but seems like it's not working (script attached below).

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var cmp = new GlideRecord('sn_complaint_case');
    if (cmp.get(current.parent)) {
        var message = '<b>' + 'Account: ' + cmp.getDisplayValue('company') + '/n' + '<b>' + 'Contact' + cmp.getDisplayValue('contact');
        current.description = message;
    }
})(current, previous);

 

Any leads would help me a lot.

 

Thanks,

Sreesh Surendran

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

When running a Business Rule after insert AND updating the current record, you need to use current.update() for the update to be saved.  In this case, to avoid an unnecessary update, try running the Business Rule before Insert.