Announcement

Collapse
No announcement yet.

How to pass parameters to json via additionalParameters

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

  • How to pass parameters to json via additionalParameters

    Hello!

    I am setting up a workflow. Action = Run Service Action
    How to pass parameters to json via additionalParameters.
    This works, but only if you specify the data in advance.
    Code:
    {
        "jsonchat_id": "123"
    }
    I want to send the value of a variable.
    For example, I want to send a description.
    Code:
    {
        "jsonchat_id": {description}
    }


    Thanks!

  • #2
    Hello

    Second parameter in your service is $entity. With this variable you can get need values
    Code:
    $entity->get('description');
    Additional Parameters can contain only valid json data.

    Thanks!

    Comment


    • #3
      tanya Thank you! it works.

      How to use fields that are in a related entity?

      Comment


      • #4
        Code:
        //$entity is  Opportnity, for example
        $account = $entity->get('account');
        if ($account) {
          $account->get('assignedUser');
        }

        Comment


        • #5
          Originally posted by tanya View Post
          Code:
          //$entity is Opportnity, for example
          $account = $entity->get('account');
          if ($account) {
          $account->get('assignedUser');
          }
          I can not get the field of a related entity.
          For example:
          a field that belongs to "assignedUser"
          $account->get('assignedUser.myField'); it does not work

          Comment


          • mr2d2
            mr2d2 commented
            Editing a comment
            $user = $entity->get('user');
            if ($user) {
            $user->get('myField');
            }
            it does not work

        • #6
          Where did I use '.' in example?
          Getting of link field returns object. Use get again

          Comment

          Working...
          X