No announcement yet.

Change status via link, is that possible?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Change status via link, is that possible?

    Hello all.
    I have a special question for the professionals.

    Is it possible to change a status via a link?
    In the way as with the appointments (Accept/Reject).

    My thought:
    We create our orders via Espo, write a mail to the supplier and set the status to "Ordered".
    Now there should be a link in the mail with "Confirm" and the status changes to "Confirmed" instead of waiting for his reply and changing it manually.

    Would something like this be possible? If not, also not bad.​

  • #2
    Yes, possible with both a controller or an entrypoint, If your programming skills are good enough you can ask ChatGPT to write the code for you and then you fix the bugs manually.

    should’t be that hard.


    • #3
      Kharg, thanks for your quick reply. Unfortunately, my programming skills are not sufficient so far.


      • #4
        I can see if I find some time to help you,

        what’s the entity name?
        status value?

        can you share the custom folder?


        • #5
          Thank you very much for your help.
          The entity is called : Shopping list
          Status: Open, Ordered, Confirmed, Delivered
          This is now in english, but I can change it to german?

          Which folder do you need exactly?​


          • Kharg
            Kharg commented
            Editing a comment
            I will PM you

        • #6
          If you have the Advanced Pack extension installed, no changes to the code are needed; you can use Tracking URLs with BPM:


          • #7
            Created an EntryPoint for ChrisSka83



            PHP Code:
            namespace Espo\Custom\EntryPoints;
            ConfirmOrder extends \Espo\Core\EntryPoints\Base
                public static 
            $authRequired false// This requires the user to be authenticated.
            public function run()
            $entityManager $this->getContainer()->get('entityManager');
            $id $_GET['id'] ?? null;
                    if (!
            $id) {
            $this->displayMessage('Missing Order ID.');
            $shoppingList $entityManager->getEntity('ShoppingList'$id);
                    if (!
            $shoppingList) {
            $this->displayMessage('Order not found.');
            $status $shoppingList->get('status');
            $message "";
                    if (
            $status === 'Ordered') {
            $message "Your Order has been confirmed.";
                    } elseif (
            $status === 'Confirmed') {
            $message "This order has already been confirmed.";
                    } elseif (
            $status === 'Delivered') {
            $message "Order Delivered";
                    } else {
            $message "Order not found.";

            private function 
                echo <<<HTML
            <!DOCTYPE html>
            <html lang="en">
                <meta charset="UTF-8">
                <title>Order Confirmation</title>
                <link rel="stylesheet" href="client/css/espo/espo.css">
            <div class="container">
                <div class="panel panel-default block-center-md margin-top-2x">
                    <div class="panel-body">
                        <h1 class="text-5em text-soft margin-bottom-4x">Status</h1>
                        <p class="text-large">


            Click image for larger version  Name:	image.png Views:	0 Size:	11.7 KB ID:	98476
            Last edited by Kharg; 10-10-2023, 05:25 PM.


            • #8
              I have made some changes to the design so that it fits better with our portal.

              Thanks again to Kharg who also gave me tips on how I can read out more data and use it further.

              namespace Espo\Custom\EntryPoints;
              use Espo\Core\Exceptions\NotFound;
              class ConfirmOrder extends \Espo\Core\EntryPoints\Base
                  public static $authRequired = false; // This requires the user to be authenticated.
                  public function run()
                      $entityManager = $this->getContainer()->get('entityManager');
                      $id = $_GET['id'] ?? null;
                      if (!$id) {
                         $this->displayMessage('fehlende Bestell-ID.');
                      $shoppingList = $entityManager->getEntity('Einkaufsliste', $id);
                      if (!$shoppingList) {
                          $this->displayMessage('Bestellung nicht gefunden.');
                      $status = $shoppingList->get('status');
                      $eDatum = $shoppingList->get('einkaufsdatum');
                      $lDatum = $shoppingList->get('lieferdatum');
                      $lieferant = $shoppingList->get('lieferantenName');
                      $aktualisierung = $shoppingList->get('modifiedAt');
                      // Format the dates
                      if ($eDatum) {
                          $eDatumObj = new \DateTime($eDatum);
                          $eDatum = $eDatumObj->format('d.m.Y');
                      if ($lDatum) {
                          $lDatumObj = new \DateTime($lDatum);
                          $lDatum = $lDatumObj->format('d.m.Y');
                      if ($aktualisierung) {
                          $aktualisierungObj = new \DateTime($aktualisierung, new \DateTimeZone('UTC'));
                          $aktualisierungObj->setTimezone(new \DateTimeZone('Europe/Berlin'));
                          $aktualisierung = $aktualisierungObj->format('d.m.Y H:i:s');
                      // Set the message
                      $message = "";
                      if ($status === 'Bestellt') {
                          $shoppingList->set('status', 'Bestätigt');
                          $message = "<i class='bi bi-check2-circle' style='font-size:54px;color:green'></i><br><font color='green'>Deine Bestellung wurde bestätigt.</font>";
                      } elseif ($status === 'Bestätigt') {
                          $message = "<i class='bi bi-info-circle-fill' style='font-size:54px;color:red;'></i><br><font color='red'>Diese Bestellung wurde bereits bestätigt.</font>";
                      } elseif ($status === 'Geliefert') {
                          $message = "<i class='bi bi-truck' style='font-size:54px;color:blue'></i><br><font color='blue'>Diese Bestellung wurde bereits geliefert.</font>";
                      } elseif ($status === 'offen') {
                          $message = "<i class='bi bi-bag-x' style='font-size:54px;color:red;'></i><br><font color='red'>Diese Bestellung wurde noch nicht freigegeben!</font>";
                      }else {
                         $message = "<i class='bi bi-bag-x' style='font-size:54px;color:red;'></i><br><font color='red'>Bestellung wurde nicht gefunden!</font>";
                      $this->displayMessage($status,$message, $eDatum, $lDatum, $lieferant, $aktualisierung);
                  private function displayMessage($status,$message, $eDatum, $lDatum, $lieferant = '', $aktualisierung)
                  echo <<<HTML
              <!DOCTYPE html>
              <html lang="de">
                  <meta charset="UTF-8">
                  <title>{$lieferant} - Bestellbestätigung</title>
                  <link href="" rel="stylesheet">
                  <link rel="stylesheet" href="client/css/espo/espo.css">
                  <link rel="stylesheet" href="client/modules/KurtTheme/css/espo/modern.css?r=1696956647" id='main-stylesheet'>
                  <script src="" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
                  <script src="" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
                  <script src="" crossorigin="anonymous"></script>
              <body background-color="#A4876A">
              .box {
                position: relative;
                width: 600px;
                height: 600px;
                background: #fff;
                box-shadow: 0 0 15px rgba(0,0,0,.1);
              /* common */
              .ribbon {
                width: 150px;
                height: 150px;
                overflow: hidden;
                position: absolute;
              .ribbon::after {
                position: absolute;
                z-index: -1;
                content: '';
                display: block;
                border: 5px solid #A4876A;
              .ribbon span {
                position: absolute;
                display: block;
                width: 225px;
                padding: 15px 0;
                background-color: #A4876A;
                box-shadow: 0 5px 10px rgba(0,0,0,.1);
                color: #fff;
                font: 700 18px/1 'Lato', sans-serif;
                text-shadow: 0 1px 1px rgba(0,0,0,.2);
                text-transform: uppercase;
                text-align: center;
              /* top right*/
              .ribbon-top-right {
                top: -10px;
                right: -10px;
              .ribbon-top-right::after {
                border-top-color: transparent;
                border-right-color: transparent;
              .ribbon-top-right::before {
                top: 0;
                left: 0;
              .ribbon-top-right::after {
                bottom: 0;
                right: 0;
              .ribbon-top-right span {
                left: -25px;
                top: 30px;
                transform: rotate(45deg);
              .panel {
               box-shadow: none !important;
              <div class="container box">
                  <div class="ribbon ribbon-top-right"><span>{$status}</span></div>
                  <div class="panel panel-default block-center-md margin-top-2x">
                      <div class="panel-body">
                          <center><img src="Path to the image file" width="50%"></center>
                          <h1 class="text-3em text-soft margin-bottom-4x" align="center" style="text-shadow: #FC0 1px 0 10px;">Bestell-Status</h1>
                          <p class="text-large" align="center">{$message}</p>
                          <table align="center" border="0" width="75%" style="box-shadow: 0px 0px 12px 7px rgba(164, 135, 106, 1);padding:5px;">
                                  <td colspan="3" align="center"><h4><u>Bestelldetails</u></h4></td>
                                  <td width="50%" align="right"><b>Bestelldatum:</b></td>
                                  <td align="right"><b>Lieferdatum:</b></td>
                                  <td align="right"><b>Lieferant:</b></td>
                                  <td align="right"><b>letzte Aktualiserung:</b></td>
                                  <td colspan="3">&nbsp;</td>
              Click image for larger version

Name:	Screenshot 2023-10-29 22.08.07.png
Views:	109
Size:	84.4 KB
ID:	99191