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

## Action Elements

The following are the msgbased-specific interaction actions.

#### <createmessage>

This action creates a new message and an associated interaction which can be used for the following purposes:

- Acknowledgements (source interaction — e-mail and open media)
- AutoResponses (source interaction — e-mail and open media)
- New e-mail notifications
- SMS messages (e-mail and native)
- Forwarded e-mail
- Reply e-mail from an external resource
- Redirect e-mail
- E-mail a chat transcript
- Create outbound e-mail

This action will also give the developer the options to send the message after it is created.

##### 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. 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.
type | false | NMTOKEN | emailout | acknowledgement, auto_response, outbound_new, inbound_collaboration_reply, outbound_collaboration_invite, outbound_notification, redirect, forwarded | This specifies the type of message header that is to be used for the message.
media | false | string | TMediaEMail | The following properties from a _genesys.ixn.mediaType object: TMediaAny, TMediaEMail, TMediaFax, TMediaNativeSMS, TMediaSMail, TMediaSMS, TMediaWebForm, TMediaOpenMedia | This is the media type of the message. The TMediaOpenMedia is only valid when the type attribute value is "acknowledgement" or "autoresponse".
server | false | value expression | If not supplied, the functional module will determine the server based on the type attribute | Any value expression that returns a valid string | A value expression which returns the name of the msgbased server to create this message on. See SCXML Legal Data Values and Value Expressions for details.
relatedixnid | false | value expression | "0" | Any value expression that returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid of the interaction that is associated with the interaction being created with this request. There are special values that can be returned: "0" means the functional module will use the _genesys.FMname.interactions[0].g_uid as the related interaction. "$NOT" — means that there is not an interaction that is to be related to the new one. See SCXML Legal Data Values and Value Expressions for details.
thread | false | boolean expression | true | Any boolean expression that returns a true or false | A boolean expression which returns a boolean that identifies whether this new message is going to be part of the related interaction's thread. See SCXML Conditional Expressions for details.
includeorig | false | boolean expression | false | Any boolean expression that returns a true or false | A boolean expression which returns a boolean that identifies whether the original message is going to be added to this new message. See SCXML Conditional Expressions for details.
msgsrc | false | value expression | none | Any of the following valid URI schemes: gdata | A value expression which returns a URI that identifies the location of the source message (suggested response, and so on) to use for this new message. The following are the URI schemes that are supported: gdata Configuration data (for example, gdata:config\CA.name or gdata:config\SR.name) — This will be the name (id) of the suggested responses or categories from the Configuration Server. User data (for example, gdata:udata) — this indicates that the message will be taken from the user data of the related interaction. So the related interaction must have key/value pairs for the CategoryId key. If SRLid and CtgId are in the related interaction's message and the CategoryId in udata is null, then an error is generated (error.msgbased.createmessage). See SCXML Legal Data Values and Value Expressions for details.
to | false | value expression | none | Any list of valid addresses. This will be a string with the address URIs separated by either a "," or ";". | A value expression which returns a list of addresses to send this message to. An example is to="joe@cox.com joe@coy.com" or to="_origin.all". The following are the valid values for this attribute: _origin _origin.all _udata — if this URI value is used, then this can be the only entry in list. You can also specify a specific key name to be using `_udata\\<keyname>`. List of addresses See SCXML Legal Data Values and Value Expressions for details.
from | false | value expression | none | Any valid e-mail address(es). If multiple addresses are supplied, the string with the URIs will be separated by either a "," or ";". | A value expression which returns the address(es) that this message will be from. An example is from="joe@cox.com" or from="_origin". The following are the valid values for this attribute: _origin List of addresses Note: This attribute is required when the type attribute value is: outbound_new See SCXML Legal Data Values and Value Expressions
cc | false | value expression | none | Any list of valid addresses — This will be a string with the address URIs separated by either a "," or ";". | A value expression which returns a list of addresses to send a copy of this message to. An example is cc="joe@cox.com joe@coy.com". cc="_origin" The following are the valid values for this attribute: _origin List of addresses See SCXML Legal Data Values and Value Expressions
exclude | false | value expression | none | Any list of valid addresses — This will be a string with the address URIs separated by either a "," or ";". | A value expression which returns a list of addresses to exclude from the "to" or "cc" list of addresses. An example is exclude="joe@cox.com joe@coy.com". The following are the valid values for this attribute: List of addresses See SCXML Legal Data Values and Value Expressions
subject | false | value expression | none | Any valid string | A value expression which returns the subject of the new message. There are special values that can be returned: "$USESRL" means the functional module will use the subject from the suggested response template. If not specified, there will be no subject for the new message. See SCXML Legal Data Values and Value Expressions for details.
queue | false | value expression | none | Any valid string | A value expression which returns the queue that the new interaction or message should be put into when it is created. The SCXML session associated with this queue will be responsible for explicitly sending this message or interaction later.The following are the values that can be provided and what processing will be done: "$CURQUEUE" means that the current queue associated with the interaction is used. This value cannot be used if the relatedixnid value is "$NOT". If no value is specified the message will be sent by platform automatically. The session will not get any other events (except masgbased.createmessage.done) related with this message. It is recommended that you do not use this attribute and allow the functional module to send the interaction or message. See SCXML Legal Data Values and Value Expressions for details.
chattranscript | false | boolean expression | false | Any valid boolean value | A boolean expression which identifies whether the chat transcript of the related interaction (must be a chat interaction) should be attached to the message. This attribute is only valid when the relatedixn attribute does not have a value of "NOT". See SCXML Conditional Expressions for details.
delivery | false | boolean expression | false | Any boolean expression that returns true or false | A boolean expression which returns a boolean that identifies whether this message being sent should include a request for a return message indicating whether and how the original message was delivered. If one of the SMTP servers involved in the transport of the original message fails to deliver it, the return message comes into the system with subtype InboundNDR. It contains no additional information. If the original message is successfully delivered, the return message comes into the system with subtype InboundReport. It uses attached data to indicate delivery statuses such as delayed, delivered, relayed, and so on. This attribute is only used when the "send" attribute is equal to "true". User's Guide. See SCXML Conditional Expressions for details.
disposition | false | boolean expression | false | Any boolean expression that returns true or false | A boolean expression which returns a boolean that identifies whether the message should include a request for a return message indicating what happened to the original message after it was delivered; for example, whether it was displayed, printed, deleted without displaying, and so on. The return message comes into the system with subtype InboundDisposition and it provides the delivery status in attached data. This attribute is only used when the "send" attribute is equal to "true". See SCXML Conditional Expressions for details.
codefields | false | ECMAScript object | none | Any valid ECMAScript object with a set of key/value properties | An ECMAScript Object which contains the list of key/value pairs which should be used to substitute the values into the suggested response message that is created. See SCXML Legal Data Values and Value Expressions for details.

The following is an example:

    <state id="do_simple_autorsp_or_Ack">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="reply" server="'JEmailServer1'"
    			msgsrc="'gdata:config\CA.SR27'" includeorig="true" to="'_origin.all'"
    			from="'_origin'" subject="'$USESRL'">
    		<ixn:field key="'$servicename'" value="_data.service"/>
    	</ixn:createmessage>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_new_email">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="newmail" server="'JEmailServer1'"
    			msgsrc="'gdata:config\CA.SR45'" relatedixn="'$NOT'" to="'joee@abc.com'"
    			from="'doitco@xyz.com'" subject="'$USESRL'">
    		<ixn:field key="'$servicename'" value="_data.service"/>
    	</ixn:createmessage>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_new_sms">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="newsms" server="'JEmailServer1'"
    			msgsrc="'gdata:config\CA.SR888'" relatedixn="'$NOT'" to="'joee@abc.com'"
    			from="'doitco@xyz.com'" subject="'Hello to Bank xyz'">
    		<ixn:field key="'$custname'" value="_data.custname"/>
    	</ixn:createmessage>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_forward">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="forwarded" server="'JEmailServer1'"
    		thread="false" to="'joee@abc.com'" from="'doitco@xyz.com'"/>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_redirect">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="redirect" server="'JEmailServer1'"
    		thread="false" to="'joee@abc.com'" from="'doitco@xyz.com'"/>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_reply_from_extresource">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="inbound_collaboration_reply"
    		server="'JEmailServer1'" thread="false" to="'joee@abc.com'"
    		from="'doitco@xyz.com'"/>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_chat_transcript">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="newmail"
    		server="'JEmailServer1'" msgsrc="'gdata:config\CA.SR988'"
    		thread="false" relatedixnid="_genesys.ixn.interactions[1]"
    		to="'joee@abc.com'" from="'doitco@xyz.com'" chattranscript="true"/>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

    <state id="do_new_task">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:createmessage requestid="_data.reqid" type="newtask"
    		server="'JEmailServer1'" msgsrc="'gdata:config\CA.SR999'"
    		thread="false" relatedixn="$NOT" to="'agent1'"
    		from="'doitco@xyz.com'"/>
    </onentry>
    <transition event="msgbased.createmessage.done" target="statex"/>
    <transition event="error.msgbased.createmessage" target="statey"/>
    </state>

##### Required Attributes based on Request and Media Type

Note: For `<createmessage>`, all request types except outbound_new require a related interaction (relatedixnid). For send all requests require a related interaction (relatedixnid). The related interaction id defaults to _genesys.ixn.firstinteractionid if none is specified on the request (so it's not listed as a required attribute in the following table).

Type | Media | Required Attributes | Comments
--- | --- | --- | ---
acknowledgement, auto_response | TMediaEMail, TMediaOpenMedia | msgsrc | msgsrc may be gdata:config\CA.id or gdata:config\SA.id or gdata:udata A valid related interaction is required.
acknowledgement, auto_response | TMediaNativeSMS | msgsrc | msgsrc contains text string of message. A valid related interaction is required.
forwarded | TMediaEMail | msgsrc, to | msgsrc must be gdata:config\SA.id A valid related interaction is required.
inbound_collaboration_reply | TMediaEMail |  | no required attributes A valid related interaction is required. The related interaction must be of type "InboundCollaborationReply"
outbound_new | TMediaEMail, TMediaSMS | msgsrc, from | If 'to' is not specified then 'ContactId' must be in user data of related interaction. msgsrc may be gdata:config\CA.id or gdata:config\SA.id or gdata:udata
outbound_new | TMediaNativeSMS | msgsrc, to, from | msgsrc contains text string of message.
outbound_notification | TMediaEMail | msgsrc | A valid related interaction is required.
redirect | TMediaEMail | to | A valid related interaction is required.

##### Children

None

##### Events

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

- msgbased.createmessage.done — This event is sent when the request has been accepted by the system, creating the msgbased interaction.
- error.msgbased.createmessage — This event is sent when the request has failed for some reason.
- interaction.present — This event is sent when the actual new msgbased interaction is created and is available to the session (if the queue is not specified).

#### <sendmessage>

This action sends a message that was created either by the `<createmessage>` action or by an outside source (for example, agent desktop).

##### 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. 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.
server | false | value expression | If not supplied, the functional module will determine the server based on the media type of the interaction | Any value expression that returns a valid string | A value expression which returns the name of the msgbased server to create this message on. See SCXML Legal Data Values and Value Expressions for details.
interactionid | false | value expression | "0" | Any value expression that returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid of the interaction that is 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 as the related interaction. See SCXML Legal Data Values and Value Expressions for details.
delivery | false | boolean expression | false | Any boolean expression that returns a true or false | A boolean expression which returns a boolean which identifies if the message being sent should include a request for a return message indicating whether and how the original message was delivered. If one of the SMTP servers involved in the transport of the original message fails to deliver it, the return message comes into the system with subtype InboundNDR. It contains no additional information. If the original message is successfully delivered, the return message comes into the system with subtype InboundReport. It uses attached data to indicate delivery statuses such as delayed, delivered, relayed, and so on. See SCXML Conditional Expressions for details.
disposition | false | boolean expression | false | Any boolean expression that returns a true or false | A boolean expression which returns a boolean that identifies whether the message should include a request for a return message indicating what happened to the original message after it was delivered; for example, whether it was displayed, printed, deleted without displaying, and so on. The return message comes into the system with subtype InboundDisposition, and it provides the delivery status in attached data. See SCXML Conditional Expressions for details.
from | false | value expression | none | A valid address URI | A value expression which returns the address that this message will be from. If specified, it will overwrite the current "from" address in the message. An example is from="joe@cox.com" The following are the valid values for this attribute: address See SCXML Legal Data Values and Value Expressions
cc | false | value expression | none | Any list of valid addresses — This will be a string with the address URIs separated by either a "," or ";". | A value expression which returns a list of additional addresses to send a copy of this message to. These addresses are added to the current list of carbon copy addresses in the message being sent. An example is `cc="joe@cox.com joe@coy.com"`. The following are the valid values for this attribute: List of addresses See SCXML Legal Data Values and Value Expressions
exclude | false | value expression | none | Any list of valid addresses — This will be a string with the address URIs separated by either a "," or ";". | A value expression which returns a list of additional addresses to exclude from the "to" or "cc" list of addresses. An example is exclude="joe@cox.com joe@coy.com". The following are the valid values for this attribute: List of addresses See SCXML Legal Data Values and Value Expressions
subject | false | value expression | none | Any valid string | A value expression which returns the subject of the message that is to be sent. This will overwrite the subject currently assigned to the message. See SCXML Legal Data Values and Value Expressions for details.
headerfields | false | ECMAScript object | none | Any valid ECMAScript object with a set of key/value properties. | An ECMAScript Object which contains the list of key/value pairs which should be used to add headers to the message when it is sent. See SCXML Legal Data Values and Value Expressions for details.

The following is an example:

    <state id="do_send">
    <datamodel>
    	<data id="reqid"/>
    </datamodel>
    <onentry>
    	<ixn:sendmessage requestid="_data.reqid" server="'JEmailServer1'"
    		delivery="true"/>
    </onentry>
    <transition event="msgbased.sendmessage.done" target="statex"/>
    <transition event="error.msgbased.sendmessage" target="statey"/>
    </state>

##### Children

None

##### Events

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

- msgbased.sendmessage.done — This event is sent when the request has been accepted by the system and the msgbased message is being sent.
- error.msgbased.sendmessage — This event is sent when the request has failed for some reason.

#### <getcontent >

This action gets the latest version of the message and updates the _genesys.FMName.interactions[].msgbased.content property

##### 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. 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.
interactionid | false | value expression | "0" | Any value expression that returns a valid string | A value expression which returns the _genesys.FMname.interactions[x].g_uid of the interaction that is 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 as the related interaction. See SCXML Legal Data Values and Value Expressions for details.

The following is an example:

    <state id="do_getContent">
    <datamodel>
    	<data id="reqid"/>
    	<data id="currentixn"/>
    </datamodel>
    <onentry>
    	<ixn:getcontent requestid="_data.reqid"
    		interactionid="'_genesys.ixn.interactions[1].g_uid"/>
    </onentry>
    <transition event="chat.getcontent.done" target="statex"/>
    <transition event="error.chat.getcontent" target="statey"/>
    </state>

##### Children

None

##### Events

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

- chat.getcontent.done — This event is sent when the request has been accepted by the system and the content has been refreshed.
- error.chat.getcontent — This event is sent when the request has failed for some reason.

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