<!DOCTYPE html> <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="https://brokensites-cust-1.custhelp.com/AgentWeb/module/extensibility/js/client/core/extension_loader.js"></script> <script type="module"> var taskFields = ["Task.TaskId", "Task.Name", "Task.StatusId"] var globalContext; ORACLE_SERVICE_CLOUD.extension_loader.load("wjpTaskWorkspace" , "1") .then((extensionProvider) => { extensionProvider.getGlobalContext().then((gc) => { globalContext = gc; }); extensionProvider.registerWorkspaceExtension((WorkspaceRecord) => { WorkspaceRecord.addDataLoadedListener(taskLoadedHandler); WorkspaceRecord.addRecordSavedListener(taskSavedHandler); }); }); function taskLoadedHandler(parameter) { let WorkspaceRecord = parameter.getWorkspaceRecord(); WorkspaceRecord.getFieldValues(taskFields).then((IFieldDetails) => { if (IFieldDetails.getField(taskFields[1]).getLabel() != null) { globalContext.invokeAction('setTask', Number(IFieldDetails.getField(taskFields[0]).getValue())) .then((result) => { console.log(result); }).catch((error) => { console.log(error); }); } }).catch((e) => { console.log(e); }); } function taskSavedHandler(parameter) { WorkspaceRecord = parameter.getWorkspaceRecord(); WorkspaceRecord.getFieldValues(taskFields).then((IFieldDetails) => { if (IFieldDetails.getField(taskFields[1]).getLabel() != null) { globalContext.invokeAction('setTask', Number(IFieldDetails.getField(taskFields[0]).getValue())) .then((result) => { console.log(result); }).catch((error) => { console.log(error); }); } }).catch((e) =>{ console.log(e); }); } </script> </head> <body> </body> </html>