How to pass parameters to json via additionalParameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mr2d2
    Senior Member
    • Apr 2017
    • 126

    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!
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #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

    • mr2d2
      Senior Member
      • Apr 2017
      • 126

      #3
      tanya Thank you! it works.

      How to use fields that are in a related entity?

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

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

        Comment

        • mr2d2
          Senior Member
          • Apr 2017
          • 126

          #5
          Originally posted by tanya
          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
        • tanya
          Senior Member
          • Jun 2014
          • 4308

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

          Comment

          Working...