Section II – Functional Modules > Queue Interface > Action Elements Bottom of Page
| Genesys 8.0 SCXML Technical Reference
< Parameter Elements Events >

## Action Elements

#### <submit>

This action queues the request for a target based on the criteria specified in the request.

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | false | location expression | none | Any valid location expression | This is the location for the request ID that is returned as part of this request. Any data model expression evaluating to a data model location. See SCXML Location Expressions for details. The location's value will be set to an internally generated unique string identifier to be associated with the action being sent. This value will only be valid when the queue.submit.requestid event is received. If this attribute is not specified, the event identifier is dropped. This identifier can be tested by the completion event handler to distinguish among several outstanding requests. If this attribute is not specified, the identifier can be acquired from the fetch completion event. Every request must receive a unique identifier, even if the request is for the same URL.
queue | false | value expression | 'none' | Any value expression which returns a valid string | A value expression which returns the name of the (virtual) queue that this request should be put in. See SCXML Legal Data Values and Value Expressions for details.
priority | false | value expression | 0 | Any value expression which returns a value integer | A value expression which returns the priority that the interaction will be given in the queue. See SCXML Legal Data Values and Value Expressions for details.
ordertype | false | value expression | any | max, min, any, percentage | A value expression which returns how type of ordering that should be used on the targets. It is used together with orderstat. See SCXML Legal Data Values and Value Expressions for details.
orderstat | false | value expression | "none"' | Any value expression which returns a valid string | A value expression which returns the name of the statistic that will be used as a target selection criterion for ordering the targets. A value of "none" means any target and order. See SCXML Legal Data Values and Value Expressions for details.
interactionid | false | value expression | 0 | Any value expression which returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. There are two special values that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid for the request. ECMAScript Null means the functional module will not use an interaction for the request. Note: if the `<outbound>` element is present then this attribute is ignored because a new interaction will be created. See SCXML Legal Data Values and Value Expressions for details.
route | false | boolean expression | true | Any expression which returns a boolean (true, false) | A boolean expression which returns whether or not this action should also redirect the interaction to the selected destination. There are two values that can be returned: "false" means the functional module will not attempt to route the associated interaction. "true" means the functional module will use the associated interaction to route the interaction. Note: a value of "true" is only supported for voice-related interactions. See SCXML Conditional Expressions for details.
clearontimeout | false | boolean expression | true | Any expression which returns a boolean (true, false) | A boolean expression which indicates whether or not the request and all associated `<submit>` requests for this interaction and queue should be removed from the queue after the timeout of this request. See SCXML Conditional Expressions for details.
timeout | false | value expression | 0 | A value expression which returns an integer | A value expression which returns an integer that represents the number of seconds to wait. See SCXML Legal Data Values and Value Expressions for details. The integer returned must be interpreted as a time interval. This interval begins when `<submit>` is executed. A failed and timed-out submit must return the error.queue.submit event. If the `<outbound>` element is present, this attribute is only used while waiting for an agent to become available and not for the request in its entirety.
threshold | false | value expression | none | Any value expression that returns a valid string which represents a valid threshold expression. | A value expression which returns a criteria definition that is used to further filter the potential possible targets associated with the queue attribute. threshold is an analog of the strategy function SetVQTargetThreshold and defines additional conditions the target must meet to be considered as a valid target for routing with this queue. The following queue-specific methods can be used in a value expression. These methods are not executed inline as part of interpreting this attribute but are processed by the underlying queue functional module: sdata(target, statistic) — Use this function to affect routing conditions based on statistics. acfgdata(Application name, folder, property, default value) — Use this function to affect routing conditions based on external data stored in properties of configuration layer application objects (ApplicationConFigDATA). lcfgdata(list name, folder, property, default value) — Use this function to affect routing conditions based on external data stored in IRD list objects. callage function — Use this function to return the age of an interaction in seconds. See SCXML Legal Data Values and Value Expressions for details.
src | false | value expression | none | A value expression which returns one of the following valid URI schemes: gdata | This allows a developer to supply a URI which identifies the location of a `<submit>` definition that is to be used in the application. This attribute is mutually exclusive with the following attributes: queue ordertype orderstat priority This attribute is also mutually exclusive with the children of this element. This source definition will replace the entire `<submit>` element in the application at load time. See SCXML Legal Data Values and Value Expressions for details.

Other Considerations

- All events generated from the imbedded treatment actions will be suppressed as part of the action.
- The `<submit>` action does not work for targets such as multimedia queues. The `<redirect>` action is a way to place interactions into those queues.
- The src attribute supports only the gdata scheme, which maps to routing rules of type:

- Statistic
- Load Balance
- Percentage
- Workforce

- The route=true attribute value is supported only for voice-related interactions. For all others, route=false must be used with a subsequent `<redirect>` action. The error.queue.submit will be generated if this attribute is implicitly or explicitly set to true for all other interaction media types.
- The following rules are applied to the interactionid parameter in this action as well as in any other from the Queue functional module:

- Genesys recommends that you always specify it explicitly.
- The special value "0" means the first interaction in the _genesys.ixn.interactions[] array will be used. It is the responsibility of the application to make sure that this array is not empty when "0" is used.
- If the `<scxml>` document has _type=routingstrategy and there are no interactions associated with the session (for example, a session is started through web interfaces), the special value null can be used. This will result in the Queue functional module using a platform-specific interactionid for communication purposes.

The following are examples of different types of target selection that can be done with `<submit>` and SCXML:

- Load Balancing

  As you can see if you want to perform load balance functionality similar to the load balancing function block, you would use one of the load balancing statistics (this is using the basic one). In addition, you can really only load balance on DN-related resources (queue and dn types).

      <state id="load_balancing">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit requestid="_data.reqid" statorder="'StatLoadBalance'" ordertype="'min'" timeout="'100'" >
      		<queue:targets type="queue">
      			<queue:target name="'queue1'"/>
      			<queue:target name="'queue2'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex">
      	<assign location="target" expr="_event.data.targetselected"/>
      </transition>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Percentage

  As you can see, if you want to perform percentage routing functionality similar to the percentage function block, you set the ordertype attribute to "percentage" and set the appropriate target weights.

      <state id="percentage">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit requestid="_data.reqid" ordertype="'percentage'" timeout="'100'" >
      		<queue:targets type="agentgroup">
      			<queue:target name="'agtgrp1'" weight="'20'"/>
      			<queue:target name="'agtgrp2'" weight="'80'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Selection (Generic Target Selection)

  This type of target selection is generic and can be used to combine several different forms of target selections. The biggest difference is the ability to define thresholds for a given target definition. This example shows how to do that.

      <state id="Selection">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit queue="'VQ1'" requestid="_data.reqid" ordertype="'max'" orderstat="'StatTimeInReadyState'" timeout="'100'">
      		<queue:targets type="agentgroup" statserver="'www.genesyslab.stserver1.com'">
      			<queue:target name="'agtgrp1'" threshold= "'sdata(agtgrp1.GA, StatAgentsAvailable)&gt;10'"/>
      			<queue:target name="'agtgrp2'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Statistics

  As you can see here, if you want to perform statistical routing functionality similar to the statistics function block, you just have to specify the ordertype and orderstat on the action and either specify a single statserver for all targets or a specific one for each to do target selection.

      <state id="Statistics">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit queue="'VQ1'" requestid="_data.reqid" ordertype="'min'" orderstat="' StatExpectedWaitingTime'" timeout="'100'">
      		<queue:targets type="agentgroup" statserver="'www.genesyslab.stserver1.com'">
      			<queue:target name="'agtgrp1'"/>
      			<queue:target name="'agtgrp2'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Skills-Based

  As you can see here, if you want to perform skills-based routing functionality similar to that which is available on several function blocks, you just have to specify the skillexpr attribute on a target element. This can be mixed with other targets as well.

      <state id="Skills-based">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit queue="'VQ1'" requestid="_data.reqid" ordertype="'min'" orderstat="' StatExpectedWaitingTime'" timeout="'100'">
      		<queue:targets type="agentgroup" statserver="'www.genesyslab.stserver1.com'">
      			<queue:target skillexpr="'service1 &gt; 5 &amp; english &gt; 3'"/>
      			<queue:target name="'agtgrp2'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Using Busy Treatments

  As you can see here, if you want to perform treatments in conjunction with routing functionality you need to specify the appropriate `<runtreatments>` element defining which treatments are to run while waiting for a target to be found.

      <state id="Skills-based_with_treatments">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit queue="'VQ1'" requestid="_data.reqid" ordertype="'min'" orderstat="' StatExpectedWaitingTime'" timeout="'100'">
      		<queue:targets type="agentgroup" statserver="'www.genesyslab.stserver1.com'">
      			<queue:target skillexpr="'service1 &gt; 5 &amp; english &gt; 3'"/>
      			<queue:target name="'agtgrp2'"/>
      		</queue:targets>
      		<dialog:runtreatments>
      			<dialog:playsound type="'music'" resource="'EMusicDN'" duration="'100'"/>
      			<dialog:play language="'English (US)'" >
      				<dialog:prompts type="'tts'">
      					<dialog:prompt interrupt="true" text="'The estimated wait time is' + _genesys.statistic.sData("StatExpectedWaitingTime")"/>
      				</dialog:prompts>
      			</dialog:play>
      		</dialog:runtreatments>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Activity-Based

  As you can see here, if you want to perform activity(WFM)-based routing functionality similar to that which is available on several function blocks, you just have to specify the `<activity>` element in the `<targets>` element.

      <state id="Activity-based">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit queue="'VQ1'" requestid="_data.reqid" ordertype="'min'" orderstat="' StatExpectedWaitingTime'" timeout="'100'">
      		<queue:targets statserver="'www.genesyslab.stserver1.com'">
      			<queue:activity name="'service1'"/>
      		</queue:targets>
      	</queue:submit>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

- Using Routing Rules From Configuration Server

  As you can see here, if you want to perform routing rule routing functionality similar to the existing routing function block, you just have to specify the src attribute using the gdata URI scheme.

      <state id="RoutingRules_from_Configuration_Server">
      <datamodel>
      	<data id="reqid"/>
      </datamodel>
      <onentry>
      	<queue:submit src="gdata:routingrule1"/>
      </onentry>
      <transition event="queue.submit.done" target="statex"/>
      <transition event="error.queue.submit" target="statey"/>
      </state>

##### Children

- `<targets>` — Occurs 1 time. This instance defines a named set of targets.
- `<runtreatments>` — Occurs 0 or 1 times. This instance defines a set of treatments to apply while this request is queued. The treatment-related events will not be generated as part of this request. The treatment can have an additional parameter, duration (if it doesn't have it yet). When the treatment expires, the next treatment in the definition will be applied. If treatments that collect digits are used, the application will only get the digits collected by the last treatment that collected the digits when this action has ended (successfully or unsuccessfully). These digits will be available to the application via the _genesys.FMname.interactions[x].voice.ced property.

##### Events

The following events can be generated as part of this action:

- queue.submit.done
- queue.submit.requestid
- error.queue.submit — This event will be sent as a result of the following conditions:

- A timeout of the request
- Problems with the request itself.
- The customer abandons the interaction
- The platform failed to contact the customer based on the criteria specified.
- The platform failed to contact the agent that was selected.

- queue.cancelled — This event will be sent either when a target was selected from another outstanding `<submit>` action, in which case it indicates that this `<submit>` action request was cancelled, or when a `<submit>` action request has been cancelled using the `<cancel>` action.
- interaction.abandoned — This event will be sent when the customer abandons the interaction associated with this `<submit>` request.

Note: For every `<queue.submit>` action, one and only one event can be created with the reference id generated with this submit.action. Specifically:

- queue.submit.done — One of the targets from this queue was selected.
- error.queue.submit — The submit action fails to apply.
- queue.cancel.done — The interaction was explicitly requested to be removed specifically from the queue with this request id.
- queue.cancelled — The interaction was removed from the queue as a side effect of another successfully completed action.

#### <cancel>

This action removes the requests from the queue and from consideration as targets. This is equivalent to doing another `<submit>` with the clearqueue attribute set to true or to issuing the IRD function ClearTargets.

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | false | location expression | none | Any valid location expression | This is the location of the ID of the outstanding request which is to be canceled. Any data model expression evaluating to a data model location. See SCXML Location Expressions for details.
queue | false | value expression | none | Any value expression which returns a valid string | A value expression which returns the name of the (virtual) queue that this request is for. If there was more than one `<submit>` request for the same interaction and this queue, then all these requests will be removed from this queue and from consideration as a target. See SCXML Legal Data Values and Value Expressions for details.
interactionid | false | value expression | 0 | Any value expression which returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. This is only used in conjunction with the queue attribute. There is a special value that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid for the request. See SCXML Legal Data Values and Value Expressions for details.

The requestid and queue attributes are mutually exclusive. If the requestid is present, then just that request is cleared from the queue and from target selection.

If the queue is present, then all outstanding requests are cleared from the defined queue. As part of this processing, the appropriate queue.cancelled events will be fired for all requests that are cleared.

The interactionid attribute is only used in conjunction with the queue attribute and is only needed when your application is handling multiple interactions.

The following are some examples:

    <state id="cancel">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:cancel requestid="_data.reqid"/>
    </onentry>
    <transition event="queue.cancel.done" target="statex"/>
    <transition event="error.queue.cancel" target="statey"/>
    </state>

    <state id="cancel">
    <onentry>
    	<queue:cancel queue="'vq1'" />
    </onentry>
    <transition event="queue.cancel.done" target="statex"/>
    <transition event="error.queue.cancel" target="statey"/>
    </state>

    <state id="cancel">
    <datamodel>
    	<data id="ixnid"/>
    </datamodel>
    <onentry>
    	<queue:cancel queue="'vq1'" interactionid="_data.ixnid" />
    </onentry>
    <transition event="queue.cancel.done" target="statex"/>
    <transition event="error.queue.cancel" target="statey"/>
    </state>

##### Children

None

##### Events

The following events can be generated as part of this action:

- queue.cancel.done
- error.queue.cancel
- queue.cancelled — This event is sent for all requests that are cleared.

Note: The queue.cancelled events will be sent before the queue.clear.done.

#### <update>

This action updates the criteria associated with an outstanding submit request.

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | True | location expression | none | Any valid location expression | This is the location of the ID of the outstanding request which is to be updated. Any data model expression evaluating to a data model location. See SCXML Location Expressions for details.
interactionid | False | value expression | 0 | Any value expression which returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. If the interactionid attribute value is not associated with an outstanding and corresponding `<submit>` action, then an error event (error.queue.cancelled) will be generated. There is a special value that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid for the request. See SCXML Legal Data Values and Value Expressions for details.
priority | False | value expression | none | Any value expression that returns a valid integer | A value expression which returns the priority that the interaction will be assigned in the queue. See SCXML Legal Data Values and Value Expressions for details.
timeout | False | value expression | none | A value expression which returns an integer | A value expression which returns an integer that represents the number of seconds to wait. See SCXML Legal Data Values and Value Expressions for details. The integer returned must be interpreted as a time interval. This interval begins when `<update>` is executed. A failed and timed-out submit must return the error.queue.update event. If the original submit request an outbound one, this attribute is only used while waiting for an agent to become available and not for the request in its entirety.

The following are examples:

This example updates the ordering of targets to be selected from, as well as the timeout value for this request:

    <state id="update">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:update requestid="_data.reqid" order="'any'" timeout="'300'"/>
    </onentry>
    <transition event="queue.update.done" target="statex"/>
    <transition event="error.queue.update" target="statey"/>
    </state>

This example updates the statistic used for ordering the targets for this request:

    <state id="update">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:update requestid="_data.reqid" orderstat="'StatAgentsAvailable'"/>
    </onentry>
    <transition event="queue.update.done" target="statex"/>
    <transition event="error.queue.update" target="statey"/>
    </state>

This example updates the set of targets to select from for this request:

    <state id="update">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:update requestid="_data.reqid"/>
    		<queue:targets>
    			<queue:target skillexpr="'service1 &gt; 5 &amp; english &gt; 3'"/>
    		</queue:targets>
    	</queue/update>
    </onentry>
    <transition event="queue.update.done" target="statex"/>
    <transition event="error.queue.update" target="statey"/>
    </state>

This example updates the priority of this request:

    <state id="update">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:update requestid="_data.reqid" priority="'30'"/>
    </onentry>
    <transition event="queue.update.done" target="statex"/>
    <transition event="error.queue.update" target="statey"/>
    </state>

This example updates the treatments of this request:

    <state id="update">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:update requestid="_data.reqid">
    		<dialog:runtreatments>
    			<dialog:playsound type="'music'" resource="'EMusicDN'" duration="'100'"/>
    		</dialog:runtreatments>
    	</queue:update>
    </onentry>
    <transition event="queue.update.done" target="statex"/>
    <transition event="error.queue.update" target="statey"/>
    </state>

##### Children

##### Events

The following events can be generated as part of this action:

- queue.update.done
- error.queue.update

#### <query>

This action queries the status of the request. TIt returns the following information in the queue.query.done event for a specific interaction:

- priority — This is the current priority of the request.
- positioninqueue — This is the current position of the request in the queue.
- Invqwaittime — This is the expected wait time for the queue in relationship to the request.

This action can be used in two cases:

- While `<submit>` requests are outstanding, to determine what to do next. For example, while the application waits for a target, if the customer presses the "I cannot wait anymore" number, this event is processed by the application (`<transition>`). The application queries the status of the request to determine what type of treatment to present to the customer. If the customer has been waiting 10 minutes and the queue depth has not changed then the application may offer the customer the option of having a callback set up for him or her (using a dialog or treatment).
- After a `<submit>` request has timed out, if the interaction was not cleared from target selection. The application may need to collect information on where this interaction stands with respect to it still being in the queue. This information would then be used to determine what to do next (for example, provide the customer with other options, do another `<submit>` but with different target selection criteria (other targets, a new queue, and so on).

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | true | location expression | none | Any valid location expression | This is the location of the ID of the outstanding request which is to be queried. Any data model expression evaluating to a data model location. See SCXML Location Expressions for details.
interactionid | false | value expression | 0 | Any value expression which returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. If the interactionid attribute value is not associated with the outstanding corresponding `<submit>` action, then an error event (error.queue.query) will be generated. There is a special value that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid for the request. See SCXML Legal Data Values and Value Expressions for details.

The interactionid attribute is only used when your application is handling multiple interactions.

The following is an example:

    <state id="query">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:query requestid="_data.reqid">
    </onentry>
    <transition event="queue.query.done" target="statex">
    	<if cond="_event.data.positioninqueue &gt; 200">
    		<queue:update requestid="_data.reqid" priority="_event.data.priority + 5"/>
    	</if>
    </transition>
    <transition event="error.queue.query" target="statey"/>
    </state>
    re>

##### Children

None

##### Events

The following events can be generated as part of this action:

- queue.query.done
- error.queue.query

#### <default>

This action returns the configured default target address. This is used when the orchestration logic cannot find the destination. It also has the option of allowing this action to redirect the interaction to this destination, as well.

##### Attribute Details

Name | Required | Type | Default Value | Valid Values | Description
--- | --- | --- | --- | --- | ---
requestid | false | location expression | none | Any valid location expression | This is the location for the request ID that is returned as part of this request. Any data model expression evaluating to a data model location. See SCXML Location Expressions for details. The location's value will be set to an internally generated unique string identifier to be associated with the action being sent. This value will only be valid when the queue.default.requestid event is received. If this attribute is not specified, the event identifier is dropped. This identifier can be tested by the completion event handler to distinguish among several outstanding requests. If this attribute is not specified, the identifier can be acquired from the completion event. Every request must receive a unique identifier, even if the request is for the same URL.
interactionid | false | value expression | 0 | A valid value expression | A value expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. There is a special value that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid to route the interaction. See SCXML Legal Data Values and Value Expressions for details.
route | false | boolean expression | true | Any expression that returns a boolean (true, false) | A boolean expression which returns the _genesys.FMname.interactions[x].g_uid associated with this request. Two values can be returned: "false" means the functional module will not attempt to route the associated interaction. "true" means the functional module will use the associated interaction to route the interaction. Note: a value of "true" is only supported for voice-related interactions. See SCXML Conditional Expressions for details.

The following is an example:

    <state id="query">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<queue:default>
    </onentry>
    <transition event="queue.default.done" target="statex"/>
    <transition event="error.queue.default" target="statex"/>
    </state>

##### Children

None

##### Events

The following events can be generated as part of this action:

- queue.default.done
- queue.default.requestid
- error.queue.default

Section II – Functional Modules > Queue Interface > Action Elements Top of Page
| Genesys 8.0 SCXML Technical Reference
< Parameter Elements Events >