How to Add a Multi-Row Variable Set to a Formatter on the Form?

caiooliveira
Tera Expert

I need to add a variable (multi-row variable set) to a 'formatter' in a form.

I accessed the 'CSC v2 Variable Editor' from the 'sys_ui_formatter' table, but I couldn't find out how to add a new variable to it.

How can I achieve this?

 

Formatter from record:

2 - Comunity - form.png

 

Form layout:

1 - Comunity - form layout.png

 

Record from 'sys_ui_formatter':

caiooliveira_0-1708345289324.png

There is a UI macro relationed 'com_glideapp_questionset_default_question_editor' that is out-of-box apparently and I don't understand how the dynamic presentation works here:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <g:requires name="scripts/js_includes_catalog.js" includes="true"/>
    <g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
    <g:if_polaris>
       <g:then>
         <g:requires name="styles/${new CatalogCssSelector().getPolarisVariableCss()}" includes="true"/>
      </g:then>
    </g:if_polaris>
    <g2:evaluate var="jvar_catalog_item">
       function eval_cat_item() {
        var cat_item = "";
		var catItemProducedGr = new GlideRecord("sc_item_produced_record");
		catItemProducedGr.addQuery("record_key", current.getUniqueValue());
		catItemProducedGr.query();
		if (catItemProducedGr.next())
			cat_item = catItemProducedGr.getValue("producer");
        return cat_item;
       }
       eval_cat_item();
    </g2:evaluate>
	
	<!-- load only the one_to_one variable sets -->
    <g2:evaluate var="jvar_cat_sets" jelly="true">
       var jvar_cat_sets = "";
       var gr = new GlideRecord("io_set_item");
       gr.addQuery("sc_cat_item", jelly.jvar_catalog_item);
	   gr.addQuery("variable_set.type", "one_to_one");
       gr.query();
       while (gr.next()) {
          if (jvar_cat_sets.length > 0)
             jvar_cat_sets += ",";
          jvar_cat_sets += gr.variable_set;
       }
       jvar_cat_sets;
    </g2:evaluate>
	
	<g2:evaluate var="jvar_questionset_read_only" jelly="true">
		(gs.getProperty('glide.sc.evaluate.variables.write.access', true) == 'true') ? !current.variables.canWrite() : !current.canWrite();
	</g2:evaluate>

	<div data-sn-macro-sys-id="${jvar_macro_sys_id}">
		<j2:if test="$[jvar_catalog_item != '']">
			<j2:set var="jvar_producer_target_record" value="true"/>
			<g2:client_script type="catalog_question_editor" catalogItem="$[jvar_catalog_item]"/>
			<g:inline template="catalog_ui_policy.xml"/>
			<g2:render_component componentName="com.glideapp.servicecatalog.DefaultQuestionEditor"/>
		</j2:if>
		<j2:if test="$[jvar_catalog_item == '']">
			<!--Render old default editor if catalog item is not found -->
			<g2:render_component componentName="com.glideapp.questionset.DefaultQuestionEditor"/>
		</j2:if>
	</div>
</j:jelly>

 

1 ACCEPTED SOLUTION

caiooliveira
Tera Expert

I needed to add the MRVS to the record producer from which the UI macro was pushing data. It works; it was added to the formatter on the form.

View solution in original post

1 REPLY 1

caiooliveira
Tera Expert

I needed to add the MRVS to the record producer from which the UI macro was pushing data. It works; it was added to the formatter on the form.