Can't find the product variant through the formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paulina
    Member
    • Feb 2022
    • 50

    #1

    Can't find the product variant through the formula

    Hello,

    I use this formula to find a product variant:

    Code:
    $variantId = record\findOne('Product', 'createdAt', 'desc', 'templateId=', productId, 'type=', 'Variant', 'variantOrder=', 0);
    This formula does not find a variant even though the product variant does exist. Sales pack version - 3.1.5
    The same formula in sales pack version 2.4.1 finds a product variant. Is it no longer possible to find the product variants in the newer Sales pack? Is anyone else experiencing this problem?
  • lazovic
    Super Moderator
    • Jan 2022
    • 1182

    #2
    Hi Paulina,

    First, please install the latest version (3.1.7) of the Sales Pack extension from the customer EspoCRM portal.

    Then, replace the application/Espo/Core/Formula/Functions/RecordGroup/FindOneType.php file with the following one: https://github.com/espocrm/espocrm/b...indOneType.php

    Comment

    • Paulina
      Member
      • Feb 2022
      • 50

      #3
      Thank you lazovic
      It helped, but before that I had to update crm to the latest version because it was 9.1.8

      But why do we need to change this file manually? Will it change automatically with any update?

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 1182

        #4
        Paulina,

        This file content will only change automatically in the next EspoCRM version, so to use the functionality of searching for product variants via a formula script now, you should update the file manually.
        Last edited by lazovic; 10-10-2025, 11:54 AM.

        Comment

        Working...