0
 $sign = array(
                "firstname" => $sign->firstname, 
                "lastname" => $sign->lastname,
            
            );
 $this->users($sign); 

and in the function users i do that :

 public function users($sign)

{   

    $this->args = $this->getTemplateArgs();

    $args = $this->args;
   
    $envelope_args = $args["envelope_args"];

    # Create the envelope request object
    $envelope_definition = $this >makeEnvelopeFileObject($args["envelope_args"]);
  
    $envelope_id = $results->getEnvelopeId();
    # Create the Recipient View request object
    $authentication_method = 'None'; # How is this application authenticating
    # the signer? See the `authenticationMethod' definition
    # https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient
    $recipient_view_request = new \DocuSign\eSign\Model\RecipientViewRequest([
    'authentication_method' => $authentication_method,
    'client_user_id' => '1000',
    'recipient_id' => '1',
    'return_url' => $envelope_args['ds_return_url'],
    'user_name' => $sign['firstname'], 

    ]);

  $result_test = $envelopeApi->getEnvelope($accountInfo[0]->getAccountId(), $args['envelope_ids']);

 $url = $results['url'];
 $json['data'] = $url;
 return Response::success(200, 'ok', $json);
      
}

  

but then a got the error "Cannot access offset of type string on string i don't know how to resolve this issue the error is on this line 'user_name' => $sign['firstname']

thanks for your help in advance

Rubyjane
  • 3
  • 2
  • Is the value of `$sign` altered in the function? Please **Edit** the question and add the whole `users` function. – A.L Jul 06 '23 at 16:07
  • 1
    Try using a different variable name in place of $sign when doing array assignment. That's probably the only error. – Alex Jul 06 '23 at 16:12
  • i added the whole function users. i used a different assignement but it doesn't work thanks for responding – Rubyjane Jul 06 '23 at 16:19
  • I don't see any problem with this code. As suggested by Alex, try to not reuse the `$sign` variable: use `$this->users($sign->firstname);` then `public function users($firstname)` and `'user_name' => $firstname,`. The `lastname` is not used in the function so you don't have to pass an array. – A.L Jul 06 '23 at 16:38
  • ok thank you i will try that. and if i want to use both of firstname and lastname how can i proceed ? – Rubyjane Jul 06 '23 at 16:43
  • Then you can add another argument to the `users` function. – A.L Jul 06 '23 at 20:48

0 Answers0