Jump to content

Recommended Posts

Posted

We have a custom field added to our Sales Orders (SODOCUMENT) called PLOT as a Text type. This showing and we're able to add data through the UI. However when read this object VIA the API, this field is not being returned.

I as using the Sage PHP SDK, and basic code:

 

$where1 = new EqualToString();
$where1->setField('DOCNO');
$where1->setValue($doc_id);
$query1 = new ReadByQuery();
$query1->setObjectName("SODOCUMENT");
$query1->setQuery($where1);

Am I missing something?

  • Members
Posted

The SODOCUMENT object represents all header-level Order Entry transaction types. Each transaction type, such as "Sales Order" or "Sales Invoice," can have its own custom fields. To specify which type of Order Entry transaction you're querying, use the docparid field.

For example:

<content>
  <function controlid="testControlId">
    <readByQuery>
      <object>SODOCUMENT</object>
      <fields>*</fields>
      <query></query>
      <returnFormat>xml</returnFormat>
      <pagesize>100</pagesize>
      <docparid>Sales Invoice</docparid>
    </readByQuery>
  </function>
</content>
 

This query will return the custom fields specific to the "Sales Invoice" transaction type.

If the SDK doesn't support this out-of-the-box, you may need to extend the SDK to handle it, as it ultimately generates XML requests like the one above.

  • 2 weeks later...
Posted

I appreciate the support... all working now. I had to get the case correct otherwise nothing returns... 

I'm amending my solution for the next person 🙂

 

$where1 = new EqualToString();
$where1->setField('DOCNO');
$where1->setValue($doc_id);
$query1 = new ReadByQuery();
$query1->setObjectName("SODOCUMENT");
$query1->setDocParId("Sales order");
$query1->setQuery($where1);

I'm guessing this ties back to object inheritance?

×
×
  • Create New...