Automation Rules: Can't reference Rule/Entity fields for defining Document Name

With the “Add Document” Action in a Button/Rule: The Document Name field does not seem to allow references, e.g. `Collected Meeting Notes - <%= Entity.Client.Name %>

Both forms get interpreted literally:

image

Furthermore, I am unable to open the created document - on ALT-click, nothing happens.

And when I “Unlink” the Document, I see this:

image

See here

1 Like

I am getting this error now:

For this Rule:

I don’t know if it’s causing the error but i would suggest leaving the doc name field blank if you are setting it programmatically.

1 Like

I tried that - no difference. Also with dummy content, and blank content.

Hi,

Init of Client.Name is missing. Also the null ref check for Entity.Client is required. Please try to use something like that:

UPDATED:

{!Client.Name!}

<% NAME("Collected Meeting Notes-" + Entity["Client.Name"])%>

Thanks,
Oleg

1 Like

@Oleg, I tried your suggestion, but I still get the error:

Failed to execute Action "Add Document": Response code 400 (Bad Request)

This rule also fails the same way:

Is the Meeting Notes relationship to Clients many-to-one?

It is one-to-one.

I just noticed, I think you need all caps for NAME:

<% NAME("Collected Meeting Notes-" + (Entity.Client ? Entity.Client.Name : "No Client"))%>

Can you try that…

Thanks @Chr1sG - that fixes the error, but Entity.Client is apparently empty (in both cases), as the Client.Name substitution gives “No Client”.

Can you send a screen grab of the meeting notes you’re trying it on (or even better, a video of the automation being triggered and the outcome)

I’m not sure why Oleg’s suggestion is not working as intended, but here’s a JS-based workaround:

<%
const fibery = context.getService('fibery');
const x = await fibery.getEntityById(Entity.Type, Entity.Id, ['Client']);
const client = x['Client']['Name'];
%>

<% NAME("Collected Meeting Notes-" + client)%>
1 Like

Thanks @Chr1sG - that works for both triggers.

Looks like I made a mistake in accessing one-to-one property.
I believe this is the correct code

{!Client.Name!}

<% NAME("Collected Meeting Notes-" + Entity["Client.Name"])%>

@Oleg, that returns null, but @Chr1sG’s solution works.