Set dynamicfield value via SOAP

Moderator: crythias

Locked
richardn
Znuny newbie
Posts: 16
Joined: 16 May 2012, 09:05
Znuny Version: 3.2.2

Set dynamicfield value via SOAP

Post by richardn »

I want to make the following SOAP Call:

Code: Select all

	makeSoapCallArray(array("DynamicFieldValueObject", "ValueSet",
		"FieldID"  , 15,
		"ObjectID" , $ticketID,
		"Value" , 'Ja',
		"UserID"   , 12)
	);
Now the System prints this error: error OTRS-RPC-10 No such Object DynamicFieldValueObject!

How can I Set The Dynamic Field Value?
OTRS 3.2.2 - CentOS - MySQL
eparlin
Znuny newbie
Posts: 3
Joined: 22 May 2013, 16:58
Znuny Version: 3.1.8PROD/3.1.12DEV
Real Name: Eric Parlin
Company: Anonymous Telecom
Location: Atlanta, GA

Re: Set dynamicfield value via SOAP

Post by eparlin »

This seems to be a common problem that those of us that rely on our own scripts for SOAP calls are having. Had no trouble with setting Free Text values before the upgrade to 3.1.X.... There's nothing in the API, only says the TicketFreeTextSet() function has been deprecated which leaves me to believe it may not be possible (hope this isn't the case). I've been able to get around this via the Generic Interface, but this just 'feels' unwieldy; It'd be great to be able to just modify my existing scripts. I think I've tried everything, been stuck for days on this one issue. If anyone has any ideas, it would be greatly appreciated. For the sake of public humiliation, here's a snippet of code from my latest attempt - I am getting the same error: OTRS-RPC-10 No such Object DynamicFieldValueObject!':

my $Success = RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'DynamicFieldValueObject', 'ValueSet',
FieldID => '17', #the ID of the field I am attempting to set the value of - I have also tried 'Name' and 'FieldName' ('Location'), etc...
ObjectID => $TicketID,
Value => [
{
ValueText => $location,
},
],
UserID => $user,
);
Last edited by eparlin on 16 Jun 2013, 17:06, edited 2 times in total.
eparlin
Znuny newbie
Posts: 3
Joined: 22 May 2013, 16:58
Znuny Version: 3.1.8PROD/3.1.12DEV
Real Name: Eric Parlin
Company: Anonymous Telecom
Location: Atlanta, GA

Re: Set dynamicfield value via SOAP

Post by eparlin »

Just found this...I just powered down for tonight, so haven't tested it yet but will try first thing in the AM:

https://gist.github.com/xonic128/2147909
eparlin
Znuny newbie
Posts: 3
Joined: 22 May 2013, 16:58
Znuny Version: 3.1.8PROD/3.1.12DEV
Real Name: Eric Parlin
Company: Anonymous Telecom
Location: Atlanta, GA

Re: Set dynamicfield value via SOAP

Post by eparlin »

SOLVED: This patch works great. If you are dependent on 'DynamicFieldValueObject' because you've already used it in code since its called in the API just use it instead of 'TicketDynamicObject' when updating your rpc.pl file. If you use this patch verbatim, just remember to change your calling code to 'TicketDynamicObject->ValueSet()'. I have tested both ways and works just fine. I'm not sure if this is already fixed in 3.2.X or not, but I am testing on 3.1.12.
jeremyk
Znuny newbie
Posts: 21
Joined: 18 Jul 2013, 15:29
Znuny Version: 3.2.8
Real Name: Jeremy Kessous
Company: DataMotion

Re: Set dynamicfield value via SOAP

Post by jeremyk »

I have been trying to implement this patch, but I keep getting an undefined subroutine error. Is there anything else you have to do other than replacing the rpc.pl?

This is the error I am getting :

Fatal error: Uncaught SoapFault exception: [soap:Server] Undefined subroutine &Kernel::System::DynamicFieldValue called at /opt/otrs/bin/cgi-bin/rpc.pl line 86. in /var/www/jeremy/form.php:58 Stack trace: #0 /var/www/jeremy/form.php(58): SoapClient->__soapCall('Dispatch', Array) #1 {main} thrown in /var/www/jeremy/form.php on line 58

I am also not 100% on the syntax of how to use TicketDynamicObject.


Sorry if this is stupid, I am pretty new to PHP HTML and OTRS....
OTRS v3.2.8 running on Debian 7 with MySQL
jeremyk
Znuny newbie
Posts: 21
Joined: 18 Jul 2013, 15:29
Znuny Version: 3.2.8
Real Name: Jeremy Kessous
Company: DataMotion

Re: Set dynamicfield value via SOAP

Post by jeremyk »

eparlin wrote:SOLVED: This patch works great. If you are dependent on 'DynamicFieldValueObject' because you've already used it in code since its called in the API just use it instead of 'TicketDynamicObject' when updating your rpc.pl file. If you use this patch verbatim, just remember to change your calling code to 'TicketDynamicObject->ValueSet()'. I have tested both ways and works just fine. I'm not sure if this is already fixed in 3.2.X or not, but I am testing on 3.1.12.


OK So I have been able to make some sort of progress I think....

Using this:
$companyname = $client->__soapCall("Dispatch", array("xxxxx", "xxxxx", "TicketDynamicObject", "DynamicFieldUpdate",
"FieldID" , "10",
"ObjectType", 'Ticket',
"ObjectID", $ticket,
"Value", array(
"ValueText", $_POST["company"]),
"UserID", 1,
));

I have been able to make it stop giving me errors in the SysLog, however now nothing happens. This is part of my script to create a ticket, and the ticket is created properly, however I cannot for the life of me get a value passed into the dynamic field.

If anyone could help I would really appreciate it, I have been stuck on this for a few days now.

Thanks!
OTRS v3.2.8 running on Debian 7 with MySQL
ianez
Znuny newbie
Posts: 1
Joined: 28 Jan 2015, 16:53
Znuny Version: 4.0.4
Real Name: Luca Iannelli
Company: Università Ca' Foscari - Venice University

Re: Set dynamicfield value via SOAP

Post by ianez »

Hi jeremyk,
I don't know if you solved this problem... maybe you changed job :D
Anyway I would like to share my solution to this problem because I tried to set dynamic field value by rpc call and I had the same issue.

Looking inside OTRS code (DynamicFieldValue.pm) I see that the "Value" array expects to be populated by others array containing values.
So I get the following code working:

Code: Select all

 $result = $this->__soapCall("Dispatch", array($this->_wsconf['username'], $this->_wsconf['password'],
	"DynamicFieldValueObject",  "ValueSet",
	"FieldID",		$fieldId,
	"ObjectID",	$ticketId,
	"Value",		array(
		"0" => array(
			"ValueText" => $value
		)
	) ,
	"UserID",		1
  ));
I hope this could be useful for someone!

Bye

Luca
wolf97084
Znuny newbie
Posts: 26
Joined: 10 Feb 2015, 22:37
Znuny Version: 4.0.1

Re: Set dynamicfield value via SOAP

Post by wolf97084 »

Does this mean the <Name> and <Value> need to be a array list? (I am using Java SOAP)

Thank you.
Locked