Closed antonyferguson closed 6 years ago
Change AccountID to id then it should work
Change AccountID to id then it should work
Every update request requires that you specify the exact object you want to update via the id
field.
Once you have pulled down a contact you should have the required id
field to pass up to it.
If you are trying to create one, set the id
field to 0
Hi,
Thank you this worked with the changing to the "id"
What is the AccountID for then?
Regards
Tony Ferguson RITO Technologies mobile (082) 464 6018 office (010) 213-7016/7
On Tue, Apr 5, 2016 at 11:00 PM, Eric Reynolds notifications@github.com wrote:
Every update request requires that you specify the exact object you want to update via the id field.
Once you have pulled down a contact you should have the required id field to pass up to it.
If you are trying to create one, set the id field to 0
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/opendns/autotask-php/issues/38#issuecomment-205983993
To be honest I don't recall seeing a field called AccountID
HI,
If I look at the Contacts Object file
https://github.com/opendns/autotask-php/blob/master/src/AutotaskObjects/Contact.php
It's the first public var
Tony Ferguson RITO Technologies mobile (082) 464 6018 office (010) 213-7016/7
On Tue, Apr 5, 2016 at 11:28 PM, Pete Casson notifications@github.com wrote:
To be honest I don't recall seeing a field called AccountID
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/opendns/autotask-php/issues/38#issuecomment-205991012
Apologies I read your original code wrong. AccountID refers to the account the contact is connected to, id is the ID of the contact object, so you either specify the id for the contact when updating it or set it to 0 if you are creating one.
I attempted to do the same with Ticket
$ticket= new ATWS\AutotaskObjects\Ticket(); $ticket->id = '12345678'; $ticket->status = 5;
$authOpts = array( 'login' => $username, 'password' => $password, 'trace' => 1, // Allows us to debug by getting the XML requests sent ); $wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL); $client = new ATWS\Client($wsdl, $authOpts); $result = $client->update($ticket);
This keeps failing with the error:
public 'Message' => string 'Missing Required Field: Title. '
Can some one tell me what i am doing wrong... i just want to update the status of a ticket.
You need to get the ticket first. You cant just create a new ticket entity with the ticket ID and send it.
So first query the API for the ticket. Update the relevant fields, send the entire ticket back through the API. Any fields left blank or missing will be updated as empty in Autotask.
There are a number of required fields for a ticket including title.
Sulfurcode, thanks for the quick reply... let see if i get this right:
$query = new ATWS\AutotaskObjects\Query('Ticket'); $ticketNumberField = new ATWS\AutotaskObjects\QueryField('ticketnumber'); $ticketNumberField->addExpression('Equals', '1234567'); $query->addField($ticketNumberField); $queryResult = $client->query($query);
$ticket = $queryResult->queryResult->EntityResults->Entity; $ticket->status = 5;
$result = $client->update($ticket);
Am i on the right track... should this work????
I was able to test it successfully. Thanks for all your help
Hi @jamoverkill would you be able to post your working code for updating a ticket? I believe I am using the same code you used in your second to last post and I still cannot get updates to work.
Hi,
I'm getting the following error: PHP Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'id' property in opendns/autotask-php/src/Client.php:198
I'm sure it's something simple that I'm doing wrong.
I'm trying to update a contact $contact = new ATWS\AutotaskObjects\Contact();
$contact->AccountID = '12345678'; $contact->Active = '0'; $contact->EmailAddress = 'name.surname@example.com'; $contact->FirstName = 'name'; $contact->LastName = 'Surname'; $contact->MogilePhone = '082 123 4567
$authOpts = array( 'login' => $username, 'password' => $password, 'trace' => 1, // Allows us to debug by getting the XML requests sent ); $wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL); $client = new ATWS\Client($wsdl, $authOpts); $result = $client->update($contact);
Thank you for your time
Regards Tony