Forums › Forums › OroCRM › OroCRM – Feature Requests › Send email to Case assignee when assignee is changed
This topic contains 26 replies, has 4 voices, and was last updated by Bhavesh Tailor 7 years, 2 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- January 6, 2017 at 10:16 am #29991
When a Case is assigned, or when the assignee is changed, I want the new assignee to be notified by email.
So I go to System > Emails > Notification Rules and I start adding a new rule. I choose “Case” as the Entity Name, but it seems the only “dynamic” recipient I can choose is the Case owner — I can’t choose the Case assignee. Furthermore, the only Event Name options I have are “Entity create”, “remove”, and “update” — “Entity change assignee” is not an event option.
Questions:
1) Have I correctly understood the limitations of the Notification Rules system, or is there some way to get it to do what I want?2) If it cannot do what I want, are there any plans to make it more flexible?
3) In the meantime, can I add some custom code to do what I need? How would I begin? Can I add an event listener that can identify if the assignee has been changed?
- CreatorTopic
- AuthorReplies
- January 25, 2017 at 10:57 pm #30007
Hi Mike ,
I have create this process by custom code and it’s work . Thank you for quick response .
Thank You
Bhavesh
January 26, 2017 at 2:07 am #30008Could you please let me know what I am doing wrong?
Please change:
YAML1$.assignedTo.emailto:
YAML1$assignedTo.emailDon’t forget set cron as i said above.
January 26, 2017 at 2:30 am #30009Hi Mike ,
Yes sure mike , i already set corn as you mention in above comment like this
*/1 * * * * /usr/bin/php /home/ilogix/Workspace/orocrmdemo/app/console –env=prod oro:cron >> /dev/null
Mike i am not able to create case don’t know why . i have setup all as per your guidance . I am able to create process via custom but not through process.yml
thank you for your quick response .
Bhavesh
January 26, 2017 at 3:27 am #30010You didn’t answer on my question:
As i understood you have the following flow:
In contact request form email field is mandatory.
1. I think you should search contact by email. Something like this “select * from orocrm_contact c where c.email = ’email which user entered’”.
1.1 Contact has been found – case must be created, ContactRequest is not.
1.2 Contact hasn’t been found – ContactRequest must be created, case is not.Right ?
January 26, 2017 at 3:42 am #30011Yes i created custom query for search by email into
Workspace/tdm_marketsnap_com/src/MarketSnap/Bundle/EmbeddedFormBundle/Controller/EmbedFormController.php . There customize code as per my requirement .
1.search contact by email.
1.1 Contact has been found – case must be created, ContactRequest is not.
1.2 Contact hasn’t been found – ContactRequest must be created, case is not.Thank You
Bhavesh
January 26, 2017 at 9:21 am #30012Here is process that does the following work:
1.search contact by email.
1.1 Contact has been found – case must be created, ContactRequest is not.
1.2 Contact hasn’t been found – ContactRequest must be created, case is not.YAML12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849definitions:create_case:label: 'Create Case form Embedded Web Form'enabled: trueentity: OroCRM\Bundle\ContactUsBundle\Entity\ContactRequestorder: 10actions_configuration:- '@find_entity':parameters:class: OroCRM\Bundle\ContactBundle\Entity\ContactEmailattribute: $.contactEmailwhere:email: $emailAddress- @tree:conditions:@not_empty: $.contactEmailactions:- '@find_entity':attribute: $.caseSourceclass: OroCRMCaseBundle:CaseSourceidentifier: 'email'- '@find_entity':attribute: $.caseStatusclass: OroCRMCaseBundle:CaseStatusidentifier: 'open'- '@find_entity':attribute: $.casePriorityclass: OroCRMCaseBundle:CasePriorityidentifier: 'normal'- @create_entity:class: OroCRM\Bundle\CaseBundle\Entity\CaseEntityattribute: $.contactEntityInstancedata:relatedContact: $.contactEmail.ownerorganization: $.contactEmail.owner.organizationowner: $.contactEmail.owner.ownersubject: $firstNamesource: $.caseSourcestatus: $.caseStatuspriority: $.casePriority- @remove_entity:target: $.datatriggers:create_case:-event: createpriority: 5queued: trueJanuary 30, 2017 at 1:19 am #30013Hi Mike ,
It’s Work For me . Do you have any idea how to assign.
for example for user xyz@gmaail.com which is already exist and case created with assign,
1. if user assign for xyz user then assign value also add into create case from embedded
2 if not assign any single case for this user then it should be blank .Bhavesh
January 31, 2017 at 8:43 am #30014Hi
I think you should add this before @remove_entity
YAML12345- '@assign_value':conditions:'@not_empty': $.contactEmail.owner.assignedToparameters: [$.contactEntityInstance.assignedTo, $.contactEmail.owner.assignedTo]- '@flush_entity': $.contactEntityInstanceAlso i want to notice that you can look at orocrm actions and learn how they work here.
February 1, 2017 at 12:16 am #30015Hi Mike ,
I am not able to get assign value, i have added assign entity as per you mention above my code is :
PHP123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354definitions:create_case:label: 'Create Case form Embedded Web Form'enabled: trueentity: OroCRM\Bundle\ContactUsBundle\Entity\ContactRequestorder: 10actions_configuration:- '@find_entity':parameters:class: OroCRM\Bundle\ContactBundle\Entity\ContactEmailattribute: $.contactEmailwhere:email: $emailAddress- @tree:conditions:@not_empty: $.contactEmailactions:- '@find_entity':attribute: $.caseSourceclass: OroCRMCaseBundle:CaseSourceidentifier: 'email'- '@find_entity':attribute: $.caseStatusclass: OroCRMCaseBundle:CaseStatusidentifier: 'open'- '@find_entity':attribute: $.casePriorityclass: OroCRMCaseBundle:CasePriorityidentifier: 'normal'- @create_entity:class: OroCRM\Bundle\CaseBundle\Entity\CaseEntityattribute: $.contactEntityInstancedata:relatedContact: $.contactEmail.ownerorganization: $.contactEmail.owner.organizationowner: $.contactEmail.owner.ownersubject: $firstNamesource: $.caseSourcestatus: $.caseStatuspriority: $.casePriority- '@assign_value':conditions:'@not_empty': $.contactEmail.owner.assignedToparameters: [$.contactEntityInstance.assignedTo, $.contactEmail.owner.assignedTo]- '@flush_entity': $.contactEntityInstance- @remove_entity:target: $.datatriggers:create_case:-event: createpriority: 5queued: trueBhavesh
February 1, 2017 at 3:16 am #30016This additional code allows you assign to case entity, contact’s assign user, if contact’s assign user exists. As i understood this is what you want. I tested this code, it works.
February 1, 2017 at 3:26 am #30017Hi Mike ,
For Example I have user XYZ and this user have case with Assigned To value (if you edit case then this field will display) . If you given Assigned To is ABC and
If another case will create for XYZ user from embedded web form then this Assigned To value is set for this also .
I hope you understand .
Thank You
Bhavesh
- AuthorReplies
The forum ‘OroCRM – Feature Requests’ is closed to new topics and replies.