Skip to main content

Last updated: 2024-06-07


ProcessCustomChoice Method


In this topic:


Overview


The ProcessCustomChoice method inserts, modifies or deletes custom lookup choices that appear in SmartOffice drop-down lists.


The ProcessCustomChoice method is invoked using the method operation.


Parameters


Parameter NameTypeRequired?Description
ChoiceIDIntegerYesThis is the ID that references the drop-down field and is found in the Lookup section of the
API Dictionary
.
ChoiceIndexStringYes (see description)This is the index value of the lookup choice. This parameter is required only when you are modifying or deleting an existing lookup choice.




To obtain the choice index value, you can insert a lookup choice using this method (the choice index is included in the XML response). Another way to obtain the choice index value is to use the
get operation
.
DescriptionStringYes (see description)This is the label for the lookup choice as it will appear in SmartOffice. Include this parameter when inserting or updating a lookup choice.
OperationStringYesValid values are: Insert, Update or Delete.

Examples


Inserting a Custom Choice


The following example inserts an "Internet" choice in the Source field of contact records. The Source lookup field is referred to as ContactSource in the API Dictionary; its ID is 178:


XML
<request version='1.0'>
  <header>...</header>
  <method>
    <ProcessCustomChoice>
      <ChoiceID>178</ChoiceID>
      <Description>Internet</Description>
      <Operation>Insert</Operation>
    </ProcessCustomChoice>
  </method>
</request>

The response returns the index value of the new choice in the ChoiceIndex element:


XML
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <method>
    <ProcessCustomChoice>
      <Insert status="ok">
        <ChoiceIndex>65536</ChoiceIndex>
      </Insert>
    </ProcessCustomChoice>
  </method>
  <_status>OK</_status>
  <_systime>2016-12-13T20:01:35</_systime>
  <!-- Cost 88 mill seconds. -->
</response>

Updating a Custom Choice


The following example updates the "Internet" choice that we previously inserted, renaming it "Web":


XML
<request version='1.0'>
  <header>...</header>
  <method>
    <ProcessCustomChoice>
      <ChoiceID>178</ChoiceID>
      <ChoiceIndex>65536</ChoiceIndex>
      <Description>Web</Description>
      <Operation>Update</Operation>
    </ProcessCustomChoice>
  </method>
</request>

The response returns the update status and the choice index value:


XML
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <method>
    <ProcessCustomChoice>
      <Update status="ok">
        <ChoiceIndex>65536</ChoiceIndex>
      </Update>
    </ProcessCustomChoice>
  </method>
  <_status>OK</_status>
  <_systime>2016-12-13T20:09:54</_systime>
  <!-- Cost 48 mill seconds. -->
</response>

Deleting a Custom Choice


This example deletes the lookup choice inserted and updated in the preceding examples:


XML
<request version='1.0'>
  <header>...</header>
  <method>
    <ProcessCustomChoice>
      <ChoiceID>178</ChoiceID>
      <ChoiceIndex>65536</ChoiceIndex>
      <Operation>Delete</Operation>
    </ProcessCustomChoice>
  </method>
</request>

The response confirms the deletion status and the choice index value:


XML
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <method>
    <ProcessCustomChoice>
      <Delete status="ok">
        <ChoiceIndex>65536</ChoiceIndex>
      </Delete>
    </ProcessCustomChoice>
  </method>
  <_status>OK</_status>
  <_systime>2016-12-13T20:14:52</_systime>
  <!-- Cost 39 mill seconds. -->
</response>

ProcessCustomChoice Method | SmartIntegrator Developer Documentation