Jump to: navigation, search

Delete User Data

The following SCXML strategy shows how to delete a property from the user data of an interaction.

<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" 
	xmlns:ixn="http://www.genesyslab.com/modules/interaction"
	initial="initial">
  <state id="initial">
	<transition event="interaction.added" target="setudata">
		<script>
			_data.ixnid = _event.data.interactionid;
		</script>
	</transition>
  </state>
  <state id="setudata">
	<onentry>
		<script>
			var data = { details : { name : "Smith, John", age : 45 } };
			_genesys.ixn.setuData( data );
		</script>
	</onentry>
	<transition event="interaction.udata.changed" 
		cond="_genesys.ixn.interactions[_data.ixnid].udata.details.name=='Smith, John' &amp;&amp; 
		_genesys.ixn.interactions[_data.ixnid].udata.details.age==45" 
		target="delete"/>
  </state>
  <state id="delete">
	<onentry>
		<script>
			_genesys.ixn.deleteuData( { details:{ age:0 } }, _data.ixnid );
		</script>
	</onentry>
	<transition event="interaction.udata.changed" 
		cond="_genesys.ixn.interactions[_data.ixnid].udata.details.name=='Smith, John' &amp;&amp; 
		_genesys.ixn.interactions[_data.ixnid].udata.details.age==undefined" 
		target="exit"/>
	<transition target="error"/>
  </state>
  <final id="exit"/>
  <final id="error"/>
</scxml>

Comment on this article:

blog comments powered by Disqus
This page was last modified on 22 September 2017, at 06:06.