Calem Blogs

Blogs of CalemEAM

How to Embed Data Fields in Service Request by Email

In the coming release of R20d one can embed data fields in the service request emails. This feature may be used by 3rd party apps to integrate with Calem. It is an alternative to integration with Calem via REST API.

The following is an email sample reporting an issue with an asset.


// Email Subject: 
Routing device malfunction Ref#3359

// Email Body:
The issue is reported with the following information:

Asset-Tag: T-55990
Failure-Time: 2020-07-25 15:30
Priority: P1
Requester: John Joe 

Here is the configuration out of the box:

  • The configuration defines how a text pattern is mapped to a field in Calem.
  • The key in the array is the field name of SR table. For instance, "asset_id" is the asset tag.
  • The value of a key (such as "Asset-Tag:" of the key "asset_id") is the text pattern for a field.
    • You may add additional text patterns for different languages.
  • You may extend the configuration to add additional fields.
  • You can find additional fields for SR at its metadata Calem_Home/server/metadata/table/cm_sr.php.

$_CALEM_dist['sr_conf']['mail_conf']['data_tpl']=
array( 
    'asset_id'=>array('Asset-Tag:'), 
    'location_id'=>array('Location:'), 
    'request_time'=>array('Failure-Time:'), 
    'priority_id'=>array('Priority:'), 
    'requester_id'=>array('Requester:'), 
    'ref_no'=>array('Ref#')
); 

Calem uses the following rules to parse the email:

  • Each line in the email body and the subject is parsed.
  • If a text pattern is found, the remaining of the text pattern is the value of the corresponding field value. For instance, "Asset-Tag: T-55990" is parsed, Calem identifies "T-55990" as the asset tag.
  • For lookup field (field with ending "_id" such as "asset_id") Calem will search the asset table to validate asset tag.
  • For date time field the format is "yyyy-mm-dd H:i" where 24-hour format must be used. The time zone is the default Calem time zone. See "Appendix F" for Calem time zone configuration.


Additional resources

How to Fetch Data Efficiently via REST API
How to Add a New Status Dropdown in Changes

Related Posts