Formula - choosing email template problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • tomas.klicka
    replied
    Hi, It said syntax was OK even before, but i tried this and no changes :-(

    Leave a comment:


  • shalmaxb
    replied
    Hi, probably error in formula:

    ifThen(
    entity\isAttributeChanged('nakupZalohovkaPanelyZad ost'),
    ext\email\applyTemplate($emailId, '6414723c9d9a30faf');
    ext\email\send($emailId); <- don`t put this semicolon
    );

    ) <- why this?

    Leave a comment:


  • tomas.klicka
    replied
    Hi, we´ve just tried it and nothing happened. Even the mail wasn´t sent. "Draft" or "Sending" do anything while "Sent" actually sent an mail...but as i pointed out above, no template is applied. It´s just empty mail.

    Leave a comment:


  • rabii
    replied
    try status, 'Sending' Not sent.

    PHP Code:
    $emailId record\create(
    'Email',
    'to''miroslava.kaiserova@esmero.eu',
    'status''Sending',
    'parentId'entity\attribute('id'),
    'parentType''Zakazka');​ 

    Leave a comment:


  • tomas.klicka
    started a topic Formula - choosing email template problem

    Formula - choosing email template problem

    Hi, i tried to choose email template based on changing some variables.
    Is there any possibility this can work? And if yes, can you tell me what i am doing wrong?
    Emails are sent but no subject, no body (basically no template is applied).

    Could it be that email is not being created with all necessary attributes(I noticed that there is for example "from: null", "name: null" etc.) and thats(maybe) causing the template could not be applied?
    Current ESPO version 7.2.7



    Workflow:

    Any (At least one must be met)

    nakupZalohovkaPanelyZadost
    changed
    nakupZalohovkaKonstrukceZadost
    changed
    nakupZalohovkaMeniceZadost
    changed
    nakupZalohovkaElektroZadost
    changed

    Exectute formula script:

    $emailId = record\create(
    'Email',
    'to', 'miroslava.kaiserova@esmero.eu',
    'status', 'Sent',
    'parentId', entity\attribute('id'),
    'parentType', 'Zakazka');



    Code:
    ifThen(
    entity\isAttributeChanged('nakupZalohovkaPanelyZadost'),
    ext\email\applyTemplate($emailId, '6414723c9d9a30faf');
    ext\email\send($emailId);
    );
    
    )
    
    ifThen(
    entity\isAttributeChanged('nakupZalohovkaKonstrukceZadost'),
    ext\email\applyTemplate($emailId, '64147249c944824b7');
    ext\email\send($emailId);
    );
    
    
    ifThen(
    entity\isAttributeChanged('nakupZalohovkaMeniceZadost'),
    ext\email\applyTemplate($emailId, '6414726ac64dafaa5');
    ext\email\send($emailId);
    );
    
    
    ifThen(
    entity\isAttributeChanged('nakupZalohovkaElektroZadost'),
    ext\email\applyTemplate($emailId, '6414728f96a6229ff');
    ext\email\send($emailId);
    );​
    ​

    JSON of generated email (no subject no body):

    Code:
    {
    "id": "641477d2a2585703d",
    "name": null,
    "deleted": false,
    "subject": null,
    "fromName": null,
    "fromAddress": "",
    "fromString": null,
    "replyToString": null,
    "replyToName": null,
    "replyToAddress": null,
    "addressNameMap": null,
    "from": null,
    "to": "miroslava.kaiserova@esmero.eu",
    "cc": "",
    "bcc": "",
    "replyTo": "",
    "isRead": true,
    "isReplied": false,
    "isUsers": false,
    "nameHash": {
    "miroslava.kaiserova@esmero.eu": "Miroslava Kaiserová"
    },
    "typeHash": {
    "miroslava.kaiserova@esmero.eu": "User"
    },
    "idHash": {
    "miroslava.kaiserova@esmero.eu": "624b0adb25a730048"
    },
    "messageId": "dummy:641477d2a25bbdc60",
    "messageIdInternal": null,
    "bodyPlain": "",
    "body": null,
    "isHtml": true,
    "status": "Sent",
    "hasAttachment": false,
    "dateSent": null,
    "deliveryDate": null,
    "createdAt": "2023-03-17 14:23:14",
    "modifiedAt": "2023-03-17 14:23:14",
    "isSystem": false,
    "icsContents": null,
    "icsEventUid": null,
    "fromEmailAddressId": null,
    "fromEmailAddressName": null,
    "toEmailAddressesIds": [
    "63651305236a99274"
    ],
    "toEmailAddressesNames": {
    "63651305236a99274": "miroslava.kaiserova@esmero.eu"
    },
    "ccEmailAddressesIds": [],
    "ccEmailAddressesNames": {},
    "replyToEmailAddressesIds": [],
    "replyToEmailAddressesNames": {},
    "attachmentsIds": [],
    "attachmentsNames": {},
    "parentId": "6413200d4b616ed4b",
    "parentType": "Zakazka",
    "parentName": "Testovací Zakázka",
    "createdById": "630c8dc00dd195da1",
    "createdByName": "Admin Jakub",
    "sentById": null,
    "sentByName": null,
    "modifiedById": null,
    "modifiedByName": null,
    "assignedUserId": null,
    "assignedUserName": null,
    "repliedId": null,
    "repliedName": null,
    "repliesIds": [],
    "repliesNames": {},
    "repliesColumns": {},
    "teamsIds": [],
    "teamsNames": {},
    "assignedUsersIds": [
    "624b0adb25a730048"
    ],
    "assignedUsersNames": {
    "624b0adb25a730048": "Miroslava Kaiserová"
    },
    "createdEventId": null,
    "createdEventType": null,
    "createdEventName": null,
    "accountId": null,
    "accountName": null,
    "tasksIds": [],
    "tasksNames": {},
    "tasksColumns": {},
    "rodicPrilezitostId": null,
    "rodicPrilezitostType": null,
    "rodicPrilezitostName": null,
    "isFollowed": true,
    "followersIds": [
    "630c8dc00dd195da1",
    "624b0adb25a730048"
    ],
    "followersNames": {
    "630c8dc00dd195da1": "Admin Jakub",
    "624b0adb25a730048": "Miroslava Kaiserová"
    },
    "bccEmailAddressesIds": [],
    "bccEmailAddressesNames": {},
    "attachmentsTypes": {}
    }​


    JSON of email template:

    Code:
    {
    "id": "6414723c9d9a30faf",
    "name": "Zakázka - Žádost o zaplacení zalohovky (Panely)",
    "deleted": false,
    "subject": "Prosím o zaplacení zálohové faktury (Panely) Zakázka: {Zakazka.name}",
    "body": "<p>Prosím o zaplacení zálohové faktury (Panely) Zakázka: {Zakazka.name}<br></p>",
    "isHtml": true,
    "oneOff": false,
    "createdAt": "2023-03-17 13:59:24",
    "modifiedAt": "2023-03-17 13:59:24",
    "attachmentsIds": [],
    "attachmentsNames": {},
    "categoryId": null,
    "categoryName": null,
    "assignedUserId": null,
    "assignedUserName": null,
    "teamsIds": [
    "609b9a9e5b55802d4"
    ],
    "teamsNames": {
    "609b9a9e5b55802d4": "Obchod ESMERO (všetci)"
    },
    "createdById": "630c8dc00dd195da1",
    "createdByName": "Admin Jakub",
    "modifiedById": null,
    "modifiedByName": null,
    "versionNumber": 1,
    "attachmentsTypes": {}
    }



    Email template example , sent email_screen, condition_screen, action_screen are in attechement)
    Thanks a lot for answers
    Attached Files
    Last edited by tomas.klicka; 03-17-2023, 02:49 PM.
Working...