Sage CRM 2021: Add a view for custom entities to support the sending of emails in workflow and escalation rules.

1 minute read time.

Imagine that you have created a new custom entity called 'Project' for your system. Sage CRM provides the Advanced Customisation Wizard to allow you to do just this very easily as you can see in the image below.

You should notice that I created this entity as a child of company and person.

Depending on the options that you select when running the Advanced Customisation Wizard, Sage CRM will create an example 'stub' workflow. You can see that I have started to customise this workflow by adding a 'Send Email' rule.

I ran into a problem when I tried to create the Workflow Action 'Send Email'.

I therefore needed to create a new view called 'vNotificationProject'.

I added the view under the customisation area of the new entity 'Project'

Administration -> Customisation -> Project

This is the SQL used.

SELECT Project.*, vPersonPE.*, vCompanyPE.*, Users.*, Escalations.*
FROM Users INNER JOIN Project
ON Proj_UserId = User_UserId AND Proj_Deleted IS NULL
LEFT JOIN vPersonPE ON Proj_PersonId = Pers_PersonId AND Pers_Deleted IS NULL
LEFT JOIN vCompanyPE ON Proj_CompanyId = Comp_CompanyId
LEFT JOIN Escalations ON Proj_ProjectId = Escl_RecordID AND Escl_TableId = 10240 AND Escl_Deleted IS NULL
WHERE User_Deleted IS NULL

I based my view on the existing 'vNotificationOpportunity' view.

As I mentioned above, this assumes that the custom entity 'Project' is a child of Company and Person.
I also had to check in the metadata table 'custom_tables' to get the correct ID for the field 'escl_tableid'. This will be different in your system.

Once I had created the view then the workflow action 'Send Email' could be defined and the emails sent and stored as communications.

Parents
  • Hi Jeff,

    I have done this for a custom entity that is a child of a primary (very similar to Quotes). I am able to create an email to send in workflow, however I am unable to include Company fields without getting an error (Access violation at address 1A91668A in module 'eware.dll'. Read of address 00000010).

    I have tried adding a view named vSummaryBid to link the tables. My logic:

    When I create an email template for Quotes, it is pulling from vSummaryQuote. The linked entity fields are not available in the 'Choose Field' drop-down, but I am able to send emails with Company fields included without error.

    To me, the missing link is how to reference vSummaryBid with vsearchlistuser for email template data. Is this accurate? If so, how can this be done?

    Any insight you have would be much appreciated.

    Here is my notifications view:

    CREATE VIEW vNotificationBids AS SELECT Bids.*, vPersonPE.*, vCompanyPE.*, Users.*, Escalations.*, Projects.* FROM Users

    INNER JOIN Projects ON Proj_PrimaryUserID = User_UserID AND Proj_Deleted IS NULL

    LEFT JOIN vPersonPE ON Proj_PersonID = Pers_PersonID AND Pers_Deleted IS NULL

    LEFT JOIN vCompanyPE ON Proj_CompanyID = Comp_CompanyID AND Comp_Deleted IS NULL

    INNER JOIN Bids ON Bids_ProjectsID = Proj_ProjectsID AND Bids_Deleted IS NULL

    LEFT JOIN Escalations ON Bids_BidsID = Escl_RecordID AND Escl_TableID = 10241 AND Escl_Type IS NULL AND Escl_Deleted IS NULL

    WHERE User_Deleted IS NULL

    Thank you. Steph

Comment
  • Hi Jeff,

    I have done this for a custom entity that is a child of a primary (very similar to Quotes). I am able to create an email to send in workflow, however I am unable to include Company fields without getting an error (Access violation at address 1A91668A in module 'eware.dll'. Read of address 00000010).

    I have tried adding a view named vSummaryBid to link the tables. My logic:

    When I create an email template for Quotes, it is pulling from vSummaryQuote. The linked entity fields are not available in the 'Choose Field' drop-down, but I am able to send emails with Company fields included without error.

    To me, the missing link is how to reference vSummaryBid with vsearchlistuser for email template data. Is this accurate? If so, how can this be done?

    Any insight you have would be much appreciated.

    Here is my notifications view:

    CREATE VIEW vNotificationBids AS SELECT Bids.*, vPersonPE.*, vCompanyPE.*, Users.*, Escalations.*, Projects.* FROM Users

    INNER JOIN Projects ON Proj_PrimaryUserID = User_UserID AND Proj_Deleted IS NULL

    LEFT JOIN vPersonPE ON Proj_PersonID = Pers_PersonID AND Pers_Deleted IS NULL

    LEFT JOIN vCompanyPE ON Proj_CompanyID = Comp_CompanyID AND Comp_Deleted IS NULL

    INNER JOIN Bids ON Bids_ProjectsID = Proj_ProjectsID AND Bids_Deleted IS NULL

    LEFT JOIN Escalations ON Bids_BidsID = Escl_RecordID AND Escl_TableID = 10241 AND Escl_Type IS NULL AND Escl_Deleted IS NULL

    WHERE User_Deleted IS NULL

    Thank you. Steph

Children
No Data