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

An eRequest link will set the "Description" value for an eRequest to match the description of the associated service. For example, a "Physiotherapy" eRequest link will set the "Description" column value of a submitted eRequest to "Physiotherapy". However, this may not be very helpful for browsing incoming eRequests if they are all of the same type(s).

You can customize this description by changing the associated eForm for the eRequest. 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"
  • (function() {   if (myItem1.p != 0) { return "myItem1Description"; }     if (myItem2.p != 0) { return "myItem2Description"; })()


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('; ');

})()   "/>

Have more questions? Submit a request


Powered by Zendesk