Friday, September 7, 2018

WS > PHPToolkit > getCustomization and getDeleted code samples

Note: This article applies to the PHP Toolkit before version 2012.2.
User wishes to perform a getCustomization or getDeleted Web Services operation using the PHPToolkit.  This article illustrates sample code that makes this possible.


  • This article requires existing knowledge of Web Services and PHP.

getCustomization sample code:

    require_once '../PHPtoolkit.php';
    require_once 'login_info.php';

    global $myNSclient;

    # GETCUSTOMIZATION ON ITEM CUSTOM FIELDS
    # ===============

    //set the getCustomizationType (i.e crmCustomField, customList, customRecordType,
    //entityCustomField, itemCustomField, itemOptionCustomField, otherCustomField,
    //transactionBodyCustomField, transactionColumnCustomField)
    $getCustomizationType = 'itemCustomField';

    // perform getCustomization operation
    $getCustomizationResponse = $myNSclient->getCustomization($getCustomizationType);

    // handle response
    if (!$getCustomizationResponse->isSuccess) {

        echo "<font color='red'><b>" . $getCustomizationResponse->statusDetail[0]->message . "</b></font>";

    } else {

        echo "<font color='green'><b>SUCCESS!!!</b></font>";

    }
...

 

 

The above code would generate the following SOAP request for the getCustomization request:

<Body>
<getCustomization>
<customizationType getCustomizationType="itemCustomField" />
</getCustomization>
</Body>
 

 

getDeleted Sample Code:

...
    require_once '../PHPtoolkit.php';
    require_once 'login_info.php';

    global $myNSclient;

    # GETDELETED USING DELETEDDATE
    # ===============

    $getDeletedFilter1 = new nsComplexObject("GetDeletedFilter");

    //Date to search on
    $myDate = '2009-07-13T18:44:00.000Z';

    $getDeletedFilter1->setFields(array("deletedDate" => array(    "operator"         => "on",
                                                        "searchValue"    => $myDate)));

    // perform getCustomization operation
    $getDeletedResponse = $myNSclient->getDeleted($getDeletedFilter1);

    // display response
    print_r($getDeletedResponse);
...
 

 

The above code would generate the following SOAP request for the getDeleted request:

<Body>
<getDeleted>
<getDeletedFilter>
<deletedDate operator="on">
<searchValue>2009-07-13T18:44:00.000Z</searchValue>
</deletedDate>
</getDeletedFilter>
</getDeleted>
</Body>
 



 

 



No comments:

Post a Comment