İçereği Atla
Menü
Bu soru işaretlendi

Hi!

I would like to find out if it’s possible to set up an automation where, when we send a bulk email from the email marketing app assigned to a campaign, an activity is automatically created in the contacts app (email sent: "(campaign name): price list sent") for the recipients. Once the email is sent, the activity should automatically be marked as 'done', and a new activity with a 30-day deadline should be created. This process should repeat every time.

Thank you :)

Avatar
Vazgeç
En İyi Yanıt

This one is a bit tricky, but it's possible.

On marketing Automation, you can create a campaign of the type "email", to send the first email to the mailing lists.
After that action, you can create another activity, this time you should pick "Server Action".


Into the Server Action,  create a NEW Server action, the easiest way, I believe is to use the Execute Code directly, and have a function to create a new activity in every contact, with the current Campaign details "(Campaign name: price list sent")

Here is an example. Notice that this is just a reference.
Some changes might be necessary according to your needs:

for recipient in record.mailing_contact_ids:
    # Get contact and details
    contact = recipient.contact_id
    campaign_name = record.name
    price_list = record.pricelist_id.name if record.pricelist_id else 'Default Pricelist'
    
    # Create activity on contact
    env['mail.activity'].create({
        'res_model_id': env['ir.model']._get('res.partner').id,
        'res_id': contact.id,
        'activity_type_id': env.ref('mail.mail_activity_data_todo').id,
        'summary': f"Campaign Sent: {campaign_name}",
        'note': f"The campaign '{campaign_name}' was sent with the price list '{price_list}'.",
        'user_id': record.user_id.id or env.user.id,  # Assign activity to the user responsible for the campaign
        'date_deadline': fields.Date.today(),
    })
Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Mar 24
974
1
Nis 20
2757
1
Tem 20
2987
2
Oca 18
8902
0
Eki 24
1014