How do I change the name/description of an incoming Website form submission based on the eForm's answers?

A link to your Website Forms will set the "Description" value for a Website form to match the description of the associated service. For example, a "Physiotherapy" Website form will set the "Description" column value of a form submission to "Physiotherapy". However, this may not be very helpful for browsing incoming submissions if they are all of the same type(s).

You can customize this description by changing the associated eForm for the Website Forms. All you need to do is add an invisible formula item with the following values:

  • Item Reference should be "referralDescription".
  • Item Type should be "Formula"
  • "Show this field if:" should be "false"
  • The formula should be a Javascript expression that returns the value of the description, based on the form answers.

Examples of possible formulas include:

renewalRequest.p != 0 ? "Renewal Request" : "General eRequest"
Copy Rule
(function() { if (myItem1.p != 0) { return "myItem1Description"; } if (myItem2.p != 0) { return "myItem2Description"; })()
Copy Rule

Here is the XML for the Diagnostic Imaging eRequisition form:

item ref="referralDescription" type="FORMULA" showIf="false" formula="(function() {
	var descs = [];
	if (ctBrainHeadNeck.p) { descs.push('CT Brain/Head/Neck'); }
	if (ctSpine.p) { descs.push('CT Spine and Neck'); }
	if (ctMsk.p) { descs.push('CT MSK'); }
	if (ctChest.p) { descs.push('CT Chest'); }
	if (ctChestAbdoPelvis.p) { descs.push('CT Abdomen/Pelvis'); }
	if (ct_angiography.p) { descs.push('CT Angiography'); }
	if (mammo.p) { descs.push('Mammogram'); }
	if (bmd.p) { descs.push('Bone Densitometry'); }
	if (xray.p) { descs.push('X-Ray'); }
	if (nm.p) { descs.push('Nuclear Medicine'); }
	if (us.p) { descs.push('Ultrasound'); }
	if (fluoroscopy.p) { descs.push('Fluoroscopy'); }
	if (descs.length == 0) { descs.push('Diagnostic Imaging'); }
	return descs.join('; ');
Copy Rule
Have more questions? Submit a request