Customer Journey Configuration: Difference between revisions

From SMTX Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
=== Variables ===
=== Variables ===
  #VARIABLE-name-of-variable||value||#
  #VARIABLE-name-of-variable||value||#
==== Special variables ====
When a variable with the internallabel "widget-header-text" is created, the contents of this variable will be displayed at the top of the widget


== Common Form References ==
== Common Form References ==

Revision as of 12:11, 20 January 2023

Below are some examples for referring to fields in the customer journey

Customer Journey References

These references are examples for retrieving data from the Customer Journey

Moments

Planned Start Date

#MOMENT-name-of-moment||date||#

Actions

Planned Start Date

#ACTION-name-of-action||date||#

Form instanceid of the Concept form created

#ACTION-actionname||output.forminstanceid||#

Submitted Form Values

#ACTION-actionname||output.fieldvalues.datum.value||#

Variables

#VARIABLE-name-of-variable||value||#

Special variables

When a variable with the internallabel "widget-header-text" is created, the contents of this variable will be displayed at the top of the widget

Common Form References

#REPLACE-FORMFIELD-InternalLabel||#
#REPLACE-FORMFIELD-InternalLabel||Column#

Common Process References

Customer Journey process start date

#REPLACE-STEP-PROCESS-DateStarted-yyyyMMdd#

Customer Journey process id

#REPLACE-STEP-PROCESS-Id#

Javascript Examples

Below are some common used scripts that can be reused in your projects

Check if moment already has a startdate, if not set it

var currentvalue = '#MOMENT-dossier-klaar||date||#';
if (currentvalue) return currentvalue;
if ('#VARIABLE-dossier-klaar||value||#' === 'yes') 
 {
   return CommonInterface.utcDateToString(new Date(), "yyyyMMddHHmmss");
 }

Script to execute in a form when it is used to collect additional data

var forminstance = JSON.parse(g_forminstance_string);
var processinstanceidformfields = forminstance.values.filter(function (val) { return val.internallabel === "hidProcessInstanceId"; });
var processinstanceid = 0;
if (processinstanceidformfields.length > 0) {
  processinstanceid = +processinstanceidformfields[0].value;
}
if (processinstanceid) {
  WorkflowInterface.setVariableValue(processinstanceid, "FormInstance_" + forminstance.id, g_forminstance_string);
  CommonInterface.callWebservice("BZ - Klantreis - Check create form instance actions", { ProcessInstanceId: processinstanceid, CheckIsProcessing: "true" });
  return "Bedankt voor het invullen, we gaan er mee aan de slag";  
} else {
   return "ProcessInstanceId not found";
}

Update variable with webservice

Name of the webservice: ssproot/customer-journey-app/buttonactions/editvariables
retrievesinglevalue
Input plain text: ProcessInstanceId=#PROCESSINSTANCEID||URL#&VariableNames=#VARIABLENAME||URL#&VariableValue_#VARIABLENAME||URL#=#VARIABLEVALUE||URL#&HashCheck=#HASHCHECK||URL#
Input fields:
 ProcessInstanceId (ticket id)
 VariableName (Name of the customer journey variable)
 VariableValue (New value to set)
 HashCheck (CommonInterface.getHash('sha512', processinstanceid + 'actionbutton_editvariables' + '_' + variablename + StudioInterface.getVariableValue("hash-check-salt")))