Can't update a Service call using DI Server

Tags:

sap_business_one_software_development_kit

Former Member

July 10, 2012 at 11:16 AM

0
Likes

Correct Answer

Former Memberreplied

January 09, 2008 at 21:37 PM

SAP B1 "business logic", in its infinite wisdom, dictates that a service call can be modified only if it is assigned to a person, and cannot be updated when it is assigned to a Queue (even though it is technically assigned, no one person is responsible for this).

The (easy, and possibly only) solution that I found to this problem is that you must assign the service call to someone, update it, and assign it back. This is especially annoying when adding activities to a service call, because then the steps become

1. assign call to self

2. create activity (through the service calls link)

3. add activity

4. update service call

5. assign it back to the queue

6. update service call.

Assuming you want to do this programatically (given that this IS the SDK forum), you can use something like this (the code is PHP, but the logic should be self-evident)

[code]

private function DISUpdate_basic( ... ) {

// returns the service call ID of the call which was updated or created, or null on error

// this update is a straightforward XML interaction with the DI Server, after

// creating the necessary XML envelopes.

}

public function DISUpdate( $addNotUpdate = false ) {

// First, move the call to $me instead of Queue, only if needed

$isInQueue = $this->inQueue;

$queue = $this->queue;

$prefs = SapToolsmysettings();

$myuid = $prefs['UserId'];

if( $isInQueue ) {

debug( "Call is in a queue, moving it to myself ($myuid) before making changes" );

$this->inQueue = false;

$this->assignedTo = $myuid;

// *** bug *** if $addNotUpdate is passed along, then TWO calls will be created

// one without the queue, the other WITH. Noticed when adding activities (monitoring) along with a call

// solution: store the resulting callid, and reuse that when updating.

if( ! ($aucallid = $this->DISUpdate_basic($addNotUpdate)) ) {

debug( "Moving call to myself and updating - it failed!" );

return false;

}

// put it back into a queue only if the call remains open - a closed call must be

// assigned to a person

if( $this->status != variable_get( 'SAP_DIS_ClosedStatus', null ) ) {

debug( "Call updated, putting it back into the rightful queue ... " );

// We dont really need to reload the service call information - all I need to do is