I recently had a requirement where the employee would provide a bulleted list along with a couple of paragraphs of text in an HRSD case. My initial thought was to use an Employee Form (Collect Employee Input) for this, however I quickly discovered that Employee Forms don’t have an HTML field. I came up with the solution (read: workaround) below which uses a Submit Catalog Item instead. Record Producers have a lot more options than Employee Forms (read: Surveys) do. In this example, the HR specialist needs to request a justification from the Opened for for an HR Account Access request.
High-level:
- Create a Record Producer.
- Create a Subflow that creates a Submit Catalog Item HR Task with the Record Producer selected.
- Create a UI Action that calls the Subflow.
Record Producer
Create a simple Record Producer on any table, the record that will be produced is just used to store the data temporarily until the Subflow copies it to the original (i.e. parent) case. You can put the Record Producer on the same table as the original record, here it is HRIT Operations Case.
We want a specific Short Description and we want the user to be redirected back to the parent case upon submitting the RP, so we have the below in the Script field
current.setValue('short_description','Provide justification response');
producer.portal_redirect = "/esc?id=hrm_ticket_page&table=sn_hr_core_case_operations&sys_id=" + current.parent;
gs.addInfoMessage('Task completed');
Finally, the HTML variable should be mapped to field so that it can be easily retrieved by the Subflow.
Subflow
Our input is the parent case
Our actions are the following
- Create Task. The type is Submit Catalog Item. Specify the Record Producer created in the previous section.
2. Wait for 10 seconds. This is probably not needed, but I stick it in there to be sure that the record was created by the Record Producer.
3. Look up the record that was created by the Record Producer. The multiple conditions are probably overkill.
4. Update the parent case with data retrieved from the record. This is why the Record Producer maps the variable into a field in the record… makes copying into the parent record easy here in the Flow. Note that in this flow, I’m taking the html provided by the user and copying it into the Work Notes. In real life, you’d probably want to write to an HTML field.
Optional: You can add another step to delete the record created by the Record Producer.
UI Action
Create a simple UI action that calls the Subflow. You’ll want to use the Create Code Snippet functionality in Flow to get the FlowAPI line.
action.setRedirectURL(current);
gs.addInfoMessage('A task will be created');
var inputs = {};
inputs['case'] = current; // GlideRecord of table: sn_hr_core_case_operations
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().subflow('sn_hr_core.catalog_item_task_demo').inForeground().withInputs(inputs).run();