How to add URL to current record into email template

I’d like to send out an email via workflow upon certain conditions in the invoice module.

How can I add a link to the current invoice record into the email template?
I can’t see a way to add the invoice-ID (which could be added to the static part of the URL), nor do I know of a variable that fills exactly the link of the current invoice…

I’m sure there’s a smooth & easy way to do this?

$url will link to the record the email is related to. This will work via workflow, not sure if it works sending direct emails.

3 Likes

holy cow that’s simple! Thanks!

Are special variables like this one documented somewhere? Or to be found in a script file somewhere?

There’s no documented list but pretty much all field variables can be added using the ‘Insert Variables’ option. The variable is automatically populated for each field.

If you come across something you need to add but don’t see an option let us know.

Kind Regards,

Will.

The $url variable is awesome but is there a variable that only gives me the part before index.php

eg:
$url = http://localhost/test/suitecrm/index.php?module=Opportunities&action=DetailView&record=a-record-id

$domain = http://localhost/test/suitecrm

I tested $domain but it didn’t work

Regards,

Hello,

I’m running into the same issue as ‘cumanacr’.

I’m using the email template, and it doesn’t seem to save the domain. Only the content after ‘index.php’

Is there a way around this? Using the source code to change this still doesn’t work as well.

It seems like I have my workflow working.

The Template editor does not like https and only understands http.

So filling out using the GUI or source code, just use HTTP and it should passthrough.

Hello,
maybe my answer arrive too late, but I think you can try with $sugarurl
I found it in template email user case update.

B.

Yes, $sugarurl works if it’s the domain of your crm, and sadly I have to use it almost every time I create or edit URLs in the email templates (most of the time you cannot use the full URL because it removes your domain for you, perhaps as user above mentioned it does not like https?).

A related tip: to get the record ID, even if it is not in the drop down list of variables, use this: modulename_id (I think it needs to be lower case for some reason).