Setting up custom job data in HotWax Commerce Job Manager

Miscellaneous jobs

Job manager has a set of pre-determined jobs that cover a lot of automation. If you want to add your own automations to manage from the app, this post will give a walkthrough and example of how to import your job data into HotWax Commerce.

Enumeration Data

Enumeration data identifies your job across all instances of it. An enumeration can be linked to any jobId so its important to make sure your enumId is unique and mapped to the correct job. Name and Description from the enumeration should be user friendly and as non technical as possible since it is used in the Job Manager by your user. When creating your enumId try to follow semantic naming and don’t bind its naming to the technology (ex. Shopify, ORSI, HotWax).

If your job doesn’t fall into an obvious category of operations related to an OMS, use the “MISC_SYS_JOB” enumeration type.

How to create an effective enumId

Example: JOB_UL_PRMS_DTE

Your enumId should follow a logical naming convention. All system jobs begin with the prefix “JOB_”, followed by the verb of the job, in the example “UL” stands for Upload. EnumIds have a character limit of 20 characters, so the description of your job may have to be condensed.

Run time data

Run time data defines the default values for the parameter service you want to create a job for. Make sure to double check the type of data your service parameter requires and if your default data matches it.

Job Sandbox data

Job Sandbox data is used to link your Run Time service parameters and your Job Enum ID to the service you want to run. The reference job should be created in Draft status so that Job Manager can reference them to create instances which will be executed. Matching your Runtime ID and EnumID to the right JobSandbox data entry is required to run correctly.

In the sample data attached below, replace the placeholders in square brackets “[]” with your actual values. Make sure to remove the square brackets as well.


    <Enumeration enumId="[unique enum id for your job]" enumName="[the job name displayed in Job Manager app]" description="[the job description displayed in Job Manager app]" enumTypeId="[the domain of the job]" parentEnumTypeId="SYSTEM_JOB" sequenceId=""/>

    <RuntimeData runtimeDataId="[define your runtimeid here]">
        <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-String value="30"/>
                        </map-Value>
                    </map-Entry>
                    <!-- This job has to be configured for an individual ShopConfig. Your job may or may not need this parameter.-->
                    <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>
    <!-- Add a description of your job here for developers.-->

    <JobSandbox jobId="[define your job id here]" jobName="[enter a name for your job]" poolId="pool" runAsUser="system" productStoreId="" runTime="" serviceName="[name of your service to run from this job]" maxRecurrenceCount="-1"  runtimeDataId="[the runtime id you defined earlier]" systemJobEnumId="[unique enum id for your job]" statusId="SERVICE_DRAFT" tempExprId=""/> 

2 Likes

Thank you @aditya.patel for listing all the necessary details. This is really helpful for anyone who is trying to automate tasks by scheduling jobs in the system.

I would like to add a point here from a developer perspective, which is that I follow a best practice to create the enumId, runtimeDataId, JobId, and systemJobEnumId same. This allows me to easily search and view the entire data of a scheduled(automated) job.

<Enumeration enumId="JOB_UL_PRMS_DTE" /> 
<RuntimeData runtimeDataId="JOB_UL_PRMS_DTE"/>
<JobSandbox jobId="JOB_UL_PRMS_DTE" systemJobEnumId="JOB_UL_PRMS_DTE"/>
2 Likes