When creating a new job in OFBiz or Moqui, especially one that should appear in the Job Manager, it’s essential to ensure that the product and product category member data are also created. This guarantees the job is not only functional but also visible and manageable via the Job Manager.
Steps to Setting up a custom job in Job Manager
For each new job, you must:
- Create a Product data
- This defines the job as a service-type product.
- Use the following attributes consistently:
productTypeId="SERVICE"isVirtual="N"isVariant="N"internalName = productId
- Create a Product Category Member data
- This makes the job visible in Job Manager and links the product to a relevant category like
ORDER_SYS_JOB,INVENTORY_SYS_JOB, orPRODUCT_SYS_JOB.
How to Create a productId
Example: IMP_CNCLD_SLS_ORD
- Use a clear, logical naming convention.
- Limit: 20 characters max.
- Use abbreviations to keep it concise and meaningful.
Vocabulary Sheet for Product Data Naming
General – Can be used
Warning/Critical – Use better alternatives if possible
Banned – Avoid completely
Here’s a sample XML snippet for creating product and product category data:
<product productId="IMP_ITM_CNCL" productName="Cancel Order items HC->Shopify every 1 hour"
internalName="IMP_ITM_CNCL" productTypeId="SERVICE" isVirtual="N" isVariant="N"
primaryProductCategoryId="ORDER_SYS_JOB"/>
<productCategoryMember productCategoryId="ORDER_SYS_JOB" productId="IMP_ITM_CNCL" fromDate="2025-07-21 00:00:00.0"/>
Note: You no longer need to create enumeration data (
<Enumeration />) for new jobs, as this has been deprecated.
Run time data
Runtime data defines the default values for the parameters of the service you want to create a job for. Make sure to double-check the parameter names and data types your service requires, and ensure your default values match accordingly to avoid job execution issues.
Job Sandbox data
JobSandbox data is used to connect your RuntimeData parameters and Job Enum ID to the actual service you want to execute. The reference job must be created in DRAFT status so that the Job Manager can use it as a template to create runnable job instances.
To ensure the job runs correctly and appears in the Job Manager interface:
- The
runtimeDataIdin<JobSandbox />must match the ID defined in your<RuntimeData />. - The
instanceOfProductIdmust correspond to theproductIddefined in the<product />entity.
Note: The
instanceOfProductIdis important for making the job visible in the Job Manager app, as it links the job configuration to the product data.
<RuntimeData
runtimeDataId="IMP_ITM_CNCL">
<runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-ser>
<map-HashMap>
<map-Entry>
<map-Key>
<std-String value="frequency"/>
</map-Key>
<map-Value>
<std-Integer value="15"/>
</map-Value>
</map-Entry>
<map-Entry>
<map-Key>
<std-String value="shopifyConfigId"/>
</map-Key>
<map-Value>
<std-String value="null"/>
</map-Value>
</map-Entry>
</map-HashMap>
</ofbiz-ser>
]]></runtimeInfo>
</RuntimeData>
<JobSandbox instanceOfProductId="IMP_ITM_CNCL" jobId="IMP_ITM_CNCL" jobName="Cancel Shopify Store order items in HotWax" maxRecurrenceCount="-1" runAsUser="system" runtimeDataId="IMP_ITM_CNCL" serviceName="cancelOrderItemsFromShopify" statusId="SERVICE_DRAFT"/> ```