Add a Log when the User View a Record.

Jira Code: AHD-85

When a user view a record the user name should be added to the Log.

In the User event script before load, we will check the context. If the context is view, using the runtime module we will get the user details and Using the record.submitFields we are setting the value to that record.

 beforeLoad: function (scriptContext) {
                var caserecord = scriptContext.newRecord;
                if (scriptContext.type == "view") {
                    log.debug("scriptContext", scriptContext.request.parameters.id)
                    var userdetails = runtime.getCurrentUser();
                    var otherId = record.submitFields({
                        type: record.Type.SUPPORT_CASE,
                        id: scriptContext.request.parameters.id,
                        values: {
                            'custevent_jj_view': userdetails.name
                        }
                    });
                }
}

Leave a comment

Your email address will not be published. Required fields are marked *