Hi!

We have problems using the (native) macros in email templates.

When parameters are inserted, the system displays them in yellow and reports that they can not be used / found.

Does anyone have any idea how we can solve this?

Thank you!

Like 0

Like

1 comments

Hello,

Can you please provide us with step by step description on how do you add this parameter, do you add it in a basic template or into your custom template, which object is a macro source for this template, and please send us screenshots of the template and the resulted email.

Thank you in advance!

Best regards,

Oscar

Show all comments

I have this Email template using Lead object as base.

The macro for the Owner Email will not work, but the MobilePhone and other will work perfectly.

Template

Result:

Like 0

Like

1 comments

Dear Julius.

Indeed, such macros doesn't work in the out of the box version of the application. To resolve this issue, you need to perform these steps:

1.Replace Lead object to the Custom package

2. Fill in the value of the column Owner and set it 'Owner' http://prntscr.com/pbotc9

3. Publish the object and compile the system.

Best regards,

Dean

Show all comments

Do you know how to create macros in BPM'online 7.12? I found this guide for 7.13: https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-macro-handler-email-template but in my case the interface IMacrosInvokable could not be found.

Like 0

Like

4 comments

Dear Carlos,

To get the IMacrosInvokable interface, you have to add it first, by adding source code to the schema of your development package. Please, refer to the paragraph 'Creating the class which implements the IMacrosInvokable interface' of the guide. 

Apart from that you can use your own templates that are quite convenient as well. More details are in this article:

https://academy.bpmonline.com/documents/administration/7-13/how-create-…

Regards,

Dean

 

Dean Parrett,

The problem is that the interface IMacrosInvokable can not be found, so my source code doesn't compile.

Dear Carlos,

If you receive the error 'IMacrosInvokable' could not be found' that means that most likely you are not using the Service application. This guide and functionality are developed for Service applications only and the interface IMacrosInvokable' is developed in CaseService package of the IMacrosInvokable schema. It might me the reason for this error. Our R&D team is working on implementation of this functionality in different products, so you may expect it in the upcoming versions of the application.

Best regards,

Dean

Dean Parrett,

Ok, thank you.

Show all comments
Question

Hi Guys,

I am trying to filter product in opportunity based on location and sum the total for that location, then display it in printable template. Here is my code but its giving me three rows instead of just one. Please help

namespace Terrasoft.Configuration
{
    using System;
    using System.CodeDom.Compiler;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    using System.ServiceModel.Activation;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Web;
    using Terrasoft.Common;
    using Terrasoft.Core;
    using Terrasoft.Core.DB;
    using Terrasoft.Core.Entities;
    using Terrasoft.Core.Packages;
    using Terrasoft.Core.Factories;
    
    [ExpressionConverterAttribute("AtsGetLocationProductsSum")]
    class OpportunityProductSumByLocation : IExpressionConverter
    {
        private UserConnection _userConnection;
        
        public string Evaluate(object value, string arguments = "")
        {
            try
            {
                _userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"];
                Guid locationId = new Guid(value.ToString());
                return getLocationProductsSum(locationId);
            }
            catch (Exception err)
            {
                return err.Message;
            }
        }
        private string getLocationProductsSum(Guid locationId)
        {
            try
            {
                EntitySchemaQuery esq = new EntitySchemaQuery(_userConnection.EntitySchemaManager, "OpportunityProductInterest");
                var AtsSumProduct = esq.AddColumn(esq.CreateAggregationFunction(AggregationTypeStrict.Sum, "AtsLineTotal"));
                var filter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, "AtsLocation.Id", locationId);
                esq.Filters.Add(filter);
                EntityCollection entities = esq.GetEntityCollection(_userConnection);
                if (entities.Count > 0)
                {
                    return entities[0].GetTypedColumnValue(AtsSumProduct.Name).ToString();
                }
                return "0";
            }
            catch (Exception err)
            {
                throw err;
            }
        }
    }
}

File attachments

Like

3 comments

Dear Adebola,

Hi! It is impossible for listed C# code to return more than 1 result, at least because you explicitly specified ToString in getLocationProductsSum. You can ensure that only one row is returned using esq.RowCount = 1. Probably, the reason behind such an output is that your function Evaluate is called three times. You can debug your piece of code using VisualStudio: https://msdn.microsoft.com/en-us/library/sc65sadd.aspx/

Lisa

Hi Lisa, 

The code is suppose to group by locationId and sum the colums. Also, i didn't call the Evaluate function three times. Could it be because the location Id is in a table template. Please, could you explain how i can filter based on opportunity and location Id from the code i posted, maybe that will solve the problem. 

Thank you

Dear Adebola,

You can add additional filter using same syntax as with first one. If you want to create filter with multiple conditions using AND/OR, you can use EntitySchemaQueryFilterCollection - https://academy.bpmonline.com/api/SDKNETAPI/7.7.0/NetCoreAPI_Help.html#…

Best regards,

Lisa

Show all comments