How to know in before save or after save logic hook data insert through api or sugarcrm application. ..?

How to know in before save or after save logic hook data insert through api or sugarcrm application. ..?

  • Hi M kumar,

    I am not 100% sure how to interpret this question. Can you clarify what you mean?

    Here are a few possible ways I could interpret this:

    1. Is there a way for a logic hook to indicate whether the data in a record is from a feature of the system or from an api from an external source?

    2. When a logic hook updates a record, is there a way to determine whether the logic hook is using an api call or the system's internal code?

    I do not think #1 is possible.

    In regard to #2, if you are using Sugar version 7 or newer, the system's internal code uses the api to update data.

    I hope this helps.

  • Hi Patrick McQueen ,

     

    Thanks Patrick ,

    Sugarcrm 9.1 EP version

    I am trying to validate in logic hook like before save or after save

    if records  insert from Api so inset some custom validation (Code or logic ) in logic hook but i am not to  find validate data source.

     

  • Hello,

    You should be able to check the $_SESSION variable for platform. "base" would be from the application. Otherwise, it would be the platform you configured.

  • May be you just keep API user seperate from Logging in user.

    If you create new user only for API, then fields like created_by will definitely tell you difference.

    Kind Regards,

    Ashish Dwivedi  

    Founder at Outright Store

    Email: ashish@outrightcrm.com
    Website:  https://store.outrightcrm.com/