$bean->stored_fetched_row_c, logic hooks and relate fields

Im trying to detect a change in a relationship through a logic hook but I cant seem to get the old value to compare it to the new.

I have a serial number module which has a relationship to accounts

Accounts -> one-to-many -> S_SerialNumber

this is visible in my module view and i can get the relationship data if i query the S_SerialNumber

    "accounts_s_serialnumber_1_name": "ID Print",
    "accounts_s_serialnumber_1": {
        "name": "ID Print",
        "id": "cac71e64-7c2c-11eb-9bf6-066c2def7d44",
        "_acl": {
            "fields": {
                "business_center_name": {
                    "create": "no",
                    "write": "no",
                    "license": "no"
                },
                "business_center_id": {
                    "create": "no",
                    "write": "no",
                    "license": "no"
                }
            },
            "_hash": "e376f7492abb281a71d6a0860441877a"
        }
    },
    "accounts_s_serialnumber_1accounts_ida": "cac71e64-7c2c-11eb-9bf6-066c2def7d44",

the problem I'm having is I want to detect if this relationship is changed on an after_save logic hook

My before_save hook captures the data with the 

        public function get_record($bean, $event, $arguments)
        {
            $bean->stored_fetched_row_c = $bean->fetched_row;
        }

However $bean->fetched_row does not include the relationship data for me to then compare

If I use the $bean->load_relationship() it only gets the updated data

Anybody know how you compare a relationship between a before and after save logic hook?

Parents
  • Hello John,

    As I can see, this logic hook is easily configurable with the Logic Builder co-code tool and the subscriber's Sugar Admin with no coding skills could make it.

    Here is the example - on S_SerialNumber record is assigned to another Account, do read previous and new Account names, then concatenate them and put into Description:



    The drawing for this behavior is fairly simple (follow the white line to read):



    And zip to install with ModuleLoader is got in a click:
    BothAccPreviousAndAccNew.zip

    Let me know if any questions

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • I understand the power of your software but  its not in our budget and wont be, 

Reply Children
  • Thanks for the high evaluation of the Logic Builder no-code tool

    Do you see any other reasons for the company decisions but economical ones?

    If Sugar subscriber expects that simple configurable tasks might take more than 11 days of experienced developer's services within a single year and even if the developer's real rate is £40 per hour, then this amount already exceeds 365 days of access for Sugar no-code configuring with Logic Builder.
    And this estimation does not include spends on custom code maintenance versus simple logic refresh in the no-code tool.

    So why not employ developers' experience for the Sugar development tasks and use no-code tools for simple Sugar configuring?

    The cost of ownership is the reason why vendors provide their subscribers with no-code tools like Sugar Studio and Logic Builder - according to Gartner, by 2024 low-code application development might be responsible for more than 65% of application development activity

    Therefore, each company decides itself what to wait for and when to start benefit from the no-code approach.

    Here is the feedback of one that started with no-code:
    sugarclub.sugarcrm.com/.../22348

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient