Thanks, @Polina_Zenevich and @Oleg. So yes, it’s definitely possible. The different input component and lack of description/help text with it surely confuses. → Please fix.
Here my working script (for posterity):
<%
const fibery = context.getService('fibery');
const e = await fibery.getEntityById(Entity.Type, Entity.Id, ['Time Window']);
%>
TEST: :white_check_mark: *{= Environments:Name =} downtime scheduled* in {= Countries:Flag,CA3 Code =} from <%= e['Time Window']['Start'].slice(0,10) %> at <%= e['Time Window']['Start'].slice(11,16) %> to <%= e['Time Window']['End'].slice(0,10) %> at <%= e['Time Window']['End'].slice(11,16) %> UTC.
Feels odd to mix it all together, but it seems to work.
On a different note, I find the documentation around how to access entities and their values in JS rather confusing. Is there a simple primer somewhere? → please fix
For example, searching in the docs for getEntityById
yields some code, but no explanation of the function: What is Entity.Type
and Entity.Id
, are they required? I know the last two items are the ones I want to load:
const e = await fibery.getEntityById(Entity.Type, Entity.Id, ['Time Window'],['Description']);
Seems like documents use some kind of Secret… not sure why? Doing this does not seem to work:
<%
const fibery = context.getService('fibery');
const e = await fibery.getEntityById(Entity.Type, Entity.Id, ['Time Window'],['Description']);
const desc = "";
if (e['Description']) {
const desc = await fibery.getDocumentContent(e['Description'].secret, 'md').slice(0,50);
}
%>
:white_check_mark: *{= Environments:Name =} downtime scheduled*
<%= desc %>
Again, not sure how fibery.getDocumentContent
works or why I need it, but it seems to work in the examples given…
As said, thanks a lot for helping with this, I can pretty much do, what I wanted. But at the same time, a clean primer on entities and and using hem in MD and JS would be neat. Thanks!