Skip to main content
Apr 23, 2018 8:06 AM UTC
Solved

Get Most Recent Stream Entry Id

I would to ask if there is anyone that knows how to retrieve the auto generated id value of a value stream entry using a service

Apr 28, 2018 5:03 PM UTC
var params = {
	oldestFirst: false /* BOOLEAN */,
	maxItems: undefined /* NUMBER */,
	sourceTags: undefined /* TAGS */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	source: undefined /* STRING */,
	startDate: undefined /* DATETIME */,
	tags: undefined /* TAGS */
};
// result: INFOTABLE
var data = Things["AlertHistoryStream"].QueryStreamEntriesWithData(params);

result = data.rows[0].id

3 replies

Apr 28, 2018 5:03 PM UTC
var params = {
	oldestFirst: false /* BOOLEAN */,
	maxItems: undefined /* NUMBER */,
	sourceTags: undefined /* TAGS */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	source: undefined /* STRING */,
	startDate: undefined /* DATETIME */,
	tags: undefined /* TAGS */
};
// result: INFOTABLE
var data = Things["AlertHistoryStream"].QueryStreamEntriesWithData(params);

result = data.rows[0].id
Apr 30, 2018 8:25 PM UTC

i would set maxItems to 1 to speed things up.

Is there a particular reason why you need to know the id?

May 1, 2018 5:05 PM UTC

Yeah. That's Good.