Trigger with REST API call


(Bmasters) #1

Matrix Version: 5.5.6.0

We have a Trigger which fires upon user login.
It’s actions are:

  • Call REST Resource (GET request). Session var (name: getResponse) is set, with a value of print(_REST.response.body);
  • Then various metadata fields are set based on that session var. eg. %globals_session_getResponse^json_decode^index:ContactId%

Recently it seems like we’ve had some issues where the API has either timed out, or glitched, and the response has been a bunch of null values.
eg.
{"ContactId": null, "email": null}

The trigger still proceeds to set all the metadata fields to null.

I’m wanting to modify this so that if the REST response is full of null values, nothing gets updated.

Anyone have any ideas on the best way to go about it?

Can I simply set the metadata values to: %globals_session_getResponse^json_decode^index:ContactId^eq:null:{globals_metadata_FIELDNAME}%

Thanks in advance