Skip to main content
  1. Work Notes/
  2. Reference Docs/

E9 Workflow Form Frontend API Quick Reference

·1569 words·8 mins
Ecology E9 Workflow Form Frontend API Reference Docs Quick Reference
Author
molefool
Table of Contents

Goal: quickly locate the right WfForm API by scenario. This version keeps API names, constants, config keys, and important constraints, while removing screenshots, long demos, and repeated explanations.

Basic Rules
#

  • Global object: window.WfForm; most code uses WfForm directly.
  • Mobile check: WfForm.isMobile(); backend code can read _ec_ismobile.
  • Frontend entry points: template code blocks, route-level custom pages, and app-level global custom pages.
  • Do not import init_wev8.js in route-level or global custom pages.
  • Prefer WfForm APIs for field operations. Avoid jQuery("#field111").val() and do not mutate form fields with raw DOM APIs.
  • Field mark format: main fields look like field111; detail fields look like field111_0.
  • viewAttr: 1 read-only, 2 editable, 3 required, 4 hide field label and content, 5 hide the whole row.

Open Workflow Forms
#

ScenarioAPI or URLNotes
PC create requestwindow.open('/workflow/request/CreateRequestForward.jsp?workflowid=747')Pass workflow ID; the active version is resolved by the system.
PC view requestwindow.open('/workflow/request/ViewRequestForwardSPA.jsp?requestid=5963690')The user must have permission to view the request.
Mobile recommendedwindow.openLink.openWorkflow(url, callbackFun, returnUrl)Custom pages must load /spa/coms/openLink.js.
Mobile fallbackwindow.open(url + '&returnUrl=' + encodeURIComponent(returnUrl))Not recommended; manual-back callbacks are hard to control.
Mobile hover windowwindow.showHoverWindow(url, baseRoute)Useful from non-main form views such as detail-row edit pages.

Action Events
#

Before-action Guards
#

WfForm.registerCheckEvent(type, fn) runs before the action. The callback must call callback() to continue; otherwise the action is blocked.

ConstantUsage
WfForm.OPER_SAVEBefore save.
WfForm.OPER_SUBMITBefore submit, approve, submit-with-feedback, submit-without-feedback.
WfForm.OPER_SUBMITCONFIRMBefore submit confirmation page; the confirm page then triggers OPER_SUBMIT.
WfForm.OPER_REJECTBefore reject.
WfForm.OPER_REMARKBefore remark submit.
WfForm.OPER_INTERVENEBefore intervene.
WfForm.OPER_FORWARDBefore forward.
WfForm.OPER_TURNHANDLEBefore transfer.
WfForm.OPER_TURNREADBefore circulate/read.
WfForm.OPER_FORCEOVERBefore forced archive.
WfForm.OPER_TAKEBACKBefore forced take-back.
WfForm.OPER_DELETEBefore delete.
WfForm.OPER_ADDROW + detailIndexBefore adding a detail row; detail index starts from 1.
WfForm.OPER_DELROW + detailIndexBefore deleting a detail row.
WfForm.OPER_PRINTPREVIEWBefore print preview.
WfForm.OPER_WITHDRAWBefore withdraw.
WfForm.OPER_CLOSEBefore page close.
WfForm.OPER_SAVECOMPLETEAfter save and before page navigation.
WfForm.OPER_ASKOPINIONBefore asking for opinion.
WfForm.OPER_TAKFROWARDBefore opinion transfer.
WfForm.OPER_BEFORECLICKBTNBefore right-menu button click.
WfForm.OPER_BEFOREVERIFYBefore required-field validation.
WfForm.OPER_EDITDETAILROWBefore mobile detail-row edit.
jQuery(function () {
  WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, function (callback) {
    // Continue after custom validation.
    callback();
  });
});

After-action Hooks
#

WfForm.registerAction(actionName, fn) runs after the action.

ConstantUsage
WfForm.ACTION_ADDROW + detailIndexAfter adding a detail row.
WfForm.ACTION_DELROW + detailIndexAfter deleting detail rows.
WfForm.ACTION_EDITDETAILROW + detailIndexMobile detail-row edit.
WfForm.ACTION_SWITCHDETAILPAGINGDetail-table page switch.
WfForm.ACTION_SWITCHTABLAYOUTTemplate tab-layout switch.
WfForm.registerAction(WfForm.ACTION_ADDROW + '1', function (index) {
  console.log('new row index:', index);
});

Field APIs
#

TaskAPIKey Point
Convert field name to markWfForm.convertFieldNameToId(fieldname, symbol?, prefix?)symbol is main or detail_1; prefix=false returns only the numeric ID.
Read valueWfForm.getFieldValue(fieldMark)Browser fields return selected IDs by default.
Read browser value objectWfForm.getFieldValueObj(fieldMark)The source demo uses it to read specialobj; verify case and availability in target systems.
Write valueWfForm.changeFieldValue(fieldMark, valueInfo)Attachments are not supported; linkage and formatting are triggered.
Change display stateWfForm.changeFieldAttr(fieldMark, viewAttr)4 hides the field; 5 hides the row.
Write value and stateWfForm.changeSingleField(fieldMark, valueInfo, variableInfo)Example: write a value and make it read-only.
Batch writeWfForm.changeMoreField(changeDatas, changeVariable)Update multiple field values and attributes in one call.
Trigger all linkageWfForm.triggerFieldAllLinkage(fieldMark)Includes field linkage, SQL linkage, formula, row/column rules, display rules, select linkage, and bindPropertyChange. Invalid after archive.
Read field configWfForm.getFieldInfo(fieldid)fieldid has no field prefix; returns htmltype, detailtype, fieldname, fieldlabel, viewattr.
Read current display stateWfForm.getFieldCurViewAttr(fieldMark)Runtime state after display linkage, API changes, and done-state rules.
const field = WfForm.convertFieldNameToId('zs');
WfForm.changeFieldValue(field, { value: 'text value' });

WfForm.changeFieldValue('field11_2', {
  value: '2,3',
  specialobj: [
    { id: '2', name: 'Zhang San' },
    { id: '3', name: 'Li Si' }
  ]
});

Field Events and Custom Rendering
#

TaskAPIKey Point
Main-field changeWfForm.bindFieldChangeEvent(fieldMarkStr, fn)Callback often receives obj, id, value.
Detail-field changeWfForm.bindDetailFieldChangeEvent(fieldMarkStr, fn)Callback often receives id, rowIndex, value.
Field-area actionWfForm.bindFieldAction(type, fieldids, fn)onfocus, onclick, and similar events are bound to the cell area, not only the input element.
Proxy single-line textWfForm.proxyFieldComp(fieldMark, el, range)Single-line text fields only; range can limit read-only/editable/required states.
Append render contentWfForm.afterFieldComp(fieldMark, el, range)Adds custom content after the standard field.
Functional field proxyWfForm.proxyFieldContentComp(fieldid, fn)Higher priority than proxyFieldComp and afterFieldComp.
Force field renderWfForm.forceRenderField(fieldMark)Common after proxying a field from code blocks/custom pages.
Generate field componentWfForm.generateFieldContentComp(fieldMark)Used with React and mobxReact.Provider for custom layouts.
Read layout storeWfForm.getLayoutStore()Used together with getGlobalStore() for custom rendering.
WfForm.bindFieldChangeEvent('field27555,field27556', function (obj, id, value) {
  console.log(id, value);
});

Detail-table APIs
#

TaskAPIKey Point
Add detail rowWfForm.addDetailRow(detailMark, initAddRowData)detailMark looks like detail_1; initial field values can be passed.
Delete detail rowWfForm.delDetailRow(detailMark, rowIndexMark)rowIndexMark can be all or 3,6.
Check detail rowsWfForm.checkDetailRow(detailMark, rowIndexMark, needClearBeforeChecked)Can clear previous checks before checking.
List all row marksWfForm.getDetailAllRowIndexStr(detailMark)Returns comma-separated row marks.
List checked row marksWfForm.getDetailCheckedRowIndexStr(detailMark)Returns currently checked rows.
Disable row checkboxesWfForm.controlDetailRowDisableCheck(detailMark, rowIndexMark, disableCheck)Rows disabled by backend config cannot be controlled by this API.
Hide/show rowsWfForm.controlDetailRowDisplay(detailMark, rowIndexMark, needHide)UI-only hiding; row serial numbers are not recalculated.
Read database row keyWfForm.getDetailRowKey(fieldMark)Existing rows only; new or missing rows return -1.
Count rowsWfForm.getDetailRowCount(detailMark)Count only; do not treat it as row indexes.
Copy last row on addWfForm.setDetailAddUseCopy(detailMark, needCopy)Works on manual add after ready; attachment fields are not copied.
Read display serialWfForm.getDetailRowSerailNum(mark, rowIndex)Original API spelling is Serail.
const rows = WfForm.getDetailAllRowIndexStr('detail_1');
(rows ? rows.split(',') : []).forEach(function (rowIndex) {
  const value = WfForm.getFieldValue('field222_' + rowIndex);
  console.log(value);
});

Global APIs
#

TaskAPIKey Point
Read request contextWfForm.getBaseInfo()Workflow, node, form, primary/sub account info.
Read global storeWfForm.getGlobalStore()Useful for debugging right menus and custom rendering.
Read operation storeWfForm.getOperateStore()Useful for locating mobile right-menu button types.
MessageWfForm.showMessage(msg, type, duration)type=2 can be used for error style.
Confirm dialogWfForm.showConfirm(content, okEvent, cancelEvent, otherInfo)Mobile-compatible; PC supports title and button text.
Disable top/right-menu buttonsWfForm.controlBtnDisabled(isDisabled)Can disable and restore.
Trigger right-menu actionWfForm.doRightBtnEvent(type)Call only; do not override.
Reload formWfForm.reloadPage(params)Defaults to current requestid; params can override.
Mobile hover linkwindow.showHoverWindow(url, baseRoute)Useful from detail-row edit pages.
Append submit paramsWfForm.appendSubmitParam(obj)Prefer a cus_ prefix to avoid overriding standard params.
Read first empty required fieldWfForm.getFirstRequiredEmptyField()Returns field${fieldid}_${rowIndex}.
Trigger required validationWfForm.verifyFormRequired(mustAddDetail, fieldRequired)Returns a boolean and shows validation messages.

Field-type APIs
#

TaskAPILimit
Add browser data URL paramsWfForm.appendBrowserDataUrlParam(fieldMark, jsonParam)Non-date browser fields; backend browser interfaces must read URL params.
Read browser display namesWfForm.getBrowserShowName(fieldMark, splitChar)Joins multiple values with the separator.
Remove select optionsWfForm.removeSelectOption(fieldMark, optionKeys)Select fields; comma-separated option keys.
Control visible select optionsWfForm.controlSelectOption(fieldMark, optionKeys)Empty string clears all options.
Read select display namesWfForm.getSelectShowName(fieldMark, splitChar)Select fields.
Empty text placeholderWfForm.setTextFieldEmptyShowContent(fieldMark, showContent)Single-line text, integer, float, thousands, and non-HTML multiline fields.
Override browser propsWfForm.overrideBrowserProp(fieldMark, jsonParam)Use carefully; it overwrites browser component props.
Control date rangeWfForm.controlDateRange(fieldMark, start, end)Date fields; start/end may be day offsets or date strings.
Radio print text onlyWfForm.controlRadioPrintText(fieldid)Radio-style select fields in print scenarios.
WfForm.appendBrowserDataUrlParam('field111', { cus_type: 'A' });
WfForm.controlDateRange('field222_0', '2019-05-01', '2019-05-31');

Sign Remark APIs
#

TaskAPIKey Point
Read sign remarkWfForm.getSignRemark()Returns current sign remark content.
Set sign remarkWfForm.setSignRemark(text, isClear=true, isAfter=true, callback)Can overwrite, prepend, or append.
Extend bottom barWfForm.appendSignEditorBottomBar(comps=[])Adds custom React components or elements.

Legacy E8 Compatibility
#

Legacy APIRecommended ReplacementNotes
window.checkCustomize = function () {}WfForm.registerCheckEvent(...)Return true to continue, false to block; avoid in new code.
jQuery('#field27563').bindPropertyChange(...)WfForm.bindFieldChangeEvent(...)Legacy version depends on DOM.
_customAddFun${groupid}(addIndexStr)WfForm.registerAction(WfForm.ACTION_ADDROW + detailIndex, ...)groupid starts from 0; action constants are appended with detail index from 1.
_customDelFun${groupid}()WfForm.registerAction(WfForm.ACTION_DELROW + detailIndex, ...)Compatibility only.
window._writeBackData / _writeBackDataWfForm.changeFieldValue(...)Use the API for browser-field writes in new code.
Raw document.getElementById(...).valueWfForm field APIsRaw DOM mutations are upgrade-risky.

Common System Config
#

These settings usually affect all workflow forms in the current Ecology system. Confirm scope before changing them.

GoalConfig or EndpointValues
Default sign font/api/workflow/index/updateWfConfig?name=signinput_default_fontfamily&value=仿宋_GB2312/FangSong_GB2312Examples: 宋体/SimSun, 微软雅黑/Microsoft YaHei, Arial/Arial, Helvetica, sans-serif.
Default sign font size/api/workflow/index/updateWfConfig?name=signinput_default_fontsize&value=36/36pxCommon values range from 8/8px to 36/36px.
Custom browser cacheun_use_customize_browser_cache1 disables, 0 enables; cleanup page: /workflow/request/CustomizeBrowserCacheUtil.jsp.
HTML support for non-HTML text fieldssupport_html_textarea_fieldSQL append field12345_1; older forms may use field12345_0; Resin restart required.
Bottom duration logshow_duration_log1 on, 0 off.
Lock detail button row on horizontal scrolldetail_locked_button_row1 locked, 0 unlocked.
Main-field total when detail has no rowscolRule_noRow_empty1 zero, 0 empty.
PC handwritten sign buttonhandwrittensign_switch1 on, 0 off.
Mobile select displayed as radiomobile_show_radio1 on, 0 off.
Mobile body/attachment signingMobileWFOfficeSign.propertiesmobileWFOffice=1; mobilePDFSign=1/2/3.

Common CSS Cases
#

GoalStyle or ConfigNotes
Move detail add/delete buttons left.detailButtonDiv{float:left}Wrap with <style> inside code blocks; not needed in CSS files.
Center cell background image.imageCell_swap{background-position:center}Cell custom class: imageCell.
Stretch cell background image.imageCell_swap{background-size:100% 100%}Same custom class.
Browser link color follows cellbrowser_color_controlByCell=1Enable through updateWfConfig.
Force browser link color.browserColorCell a{color:red !important}Cell custom class: browserColorCell.
Main select minimum width.selectCell .wea-select{min-width:50px !important}Cell custom class: selectCell.

Other Scenario
#

  • Refresh the mobile workflow list after submitting from a heterogeneous mobile system: redirect to current Ecology server URL + '/workflow/workflow/WfRefreshList.jsp'.
  • If mobile access uses a reverse proxy, use the proxy-facing server address.

AI Lookup Keywords
#

  • Field values: getFieldValue, changeFieldValue, specialobj, changeMoreField.
  • Field state: changeFieldAttr, getFieldCurViewAttr, viewAttr.
  • Linkage: triggerFieldAllLinkage, bindFieldChangeEvent, bindDetailFieldChangeEvent.
  • Detail rows: addDetailRow, delDetailRow, getDetailAllRowIndexStr, getDetailRowCount.
  • Browser fields: appendBrowserDataUrlParam, getBrowserShowName, overrideBrowserProp.
  • Select fields: removeSelectOption, controlSelectOption, getSelectShowName.
  • Sign remarks: getSignRemark, setSignRemark, appendSignEditorBottomBar.
  • Config: updateWfConfig, support_html_textarea_field, MobileWFOfficeSign.properties.

Related