A token needs to be explicitly exposed, and there is none out of the box for the body. Look at existing tokens for example on how to build your own.
Orchard using tokens to retrieve property values from a part
-
01-04-2022 - |
Question
I have a part defined below, and I have a content type which has this part. I'm using Rules to trigger an email to be send when an item of this content type is created.
I'm having difficulty accessing the fields on the part using Tokens. I've done some digging in the Tokens module and it appears it cannot directly access properties on the part, but only fields on the part.
Does anyone know how I can access these properties in the email body using Tokens? I've tried {Content.Name}, {Content.AddressChangeFormSubmission.Name} and many other different tokens with no success. I can access things like {Content.Id}, {Content.ContentType} with no problem though.
Thanks
public class AddressChangeFormSubmissionPart : ContentPart<AddressChangeFormSubmissionRecord>
{
[Required]
[Display(Name="Name")]
public string Name
{
get { return Record.Name; }
set { Record.Name = value; }
}
[Required, DataType(DataType.EmailAddress), EmailAttribute]
public string Email
{
get { return Record.Email; }
set { Record.Email = value; }
}
}
Solution
OTHER TIPS
If you add a Projection Binding on this property 'Name' (in the Tab Bindings of Queries), may be you can retry {Content.AddressChangeFormSubmission.Name} next