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
  • Roger

    Sorry for the slight delay in my response. I have been discussing this with a colleague in development.

    I understand that you have a field called comm_CareRepairID. But that you get a message "Invalid column name 'Comm_vNotificationCareRepairID'".

    My colleagues in development looked at the code around Workflow rules and the Send Email action to see whether this requires a userid to be populated in the cmli_comm_userid field.

    It doesn't. We know we can create a comm_link record without a user (the cmli_comm_userid field can be NULL). This is pretty much the same behaviour to tasks, appointments in the main UI.

    This still leaves us wondering how the reference to a view gets mentioned here.

    My colleague looked at this issue and apparently the error is not related to the selection of "Add to My CRM" option of the Advanced Customization Wizard nor the cmli_comm_userid field.

    What happens is that when we try to create a new communication record the Comm_ProjectId/Comm_CareRepairID column from the Communication table tries to be populated, but it doesn"Tmt exist.

    This column is being created only when the "Has Communication" option is being selected when running the Advanced Customisation Wizard.

    I hope this helps.

Comment
  • Roger

    Sorry for the slight delay in my response. I have been discussing this with a colleague in development.

    I understand that you have a field called comm_CareRepairID. But that you get a message "Invalid column name 'Comm_vNotificationCareRepairID'".

    My colleagues in development looked at the code around Workflow rules and the Send Email action to see whether this requires a userid to be populated in the cmli_comm_userid field.

    It doesn't. We know we can create a comm_link record without a user (the cmli_comm_userid field can be NULL). This is pretty much the same behaviour to tasks, appointments in the main UI.

    This still leaves us wondering how the reference to a view gets mentioned here.

    My colleague looked at this issue and apparently the error is not related to the selection of "Add to My CRM" option of the Advanced Customization Wizard nor the cmli_comm_userid field.

    What happens is that when we try to create a new communication record the Comm_ProjectId/Comm_CareRepairID column from the Communication table tries to be populated, but it doesn"Tmt exist.

    This column is being created only when the "Has Communication" option is being selected when running the Advanced Customisation Wizard.

    I hope this helps.

Children
No Data