Announcement

Collapse
No announcement yet.

OnLoad - copy field content to a 2nd field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • OnLoad - copy field content to a 2nd field

    Hello,

    how can i copy the (text) content of a entity field into a 2nd field?
    This should be triggered when i load the page. (not when saving)

    Use Case: I have a primary key (mac address => uniq), if i change the mac address then my hook funktions (afterSave) wont be able to find the uniq mac addres on my 3rd party system.

    So i tought i will create a mac_tmp field which i will fill out on loading the page, and when saving it i can search for the old mac and replace it by the new one in my 3rd party system/api.

    Thanks,
    Michael

  • #2
    Hello,

    You can always read the old value of fields from Formula & PHP:

    Code:
    // Formula
    entity\attributeFetched('assignedUserId');
    https://docs.espocrm.com/administrat...tributefetched


    Code:
    // PHP
    $entity->getFetched('mac_address');
    Last edited by eymen-elkum; 10-12-2021, 03:27 PM.
    CEO & Founder of Eblasoft.
    Professional EspoCRM development & extensions.

    Comment


    • #3
      Awsome! Thanks!

      Comment

      Working...
      X