Miles Hart Posted August 22, 2024 Posted August 22, 2024 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 Sterio, Louis Posted August 23, 2024 Members Posted August 23, 2024 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.
Preston, Charlie Posted August 27, 2024 Posted August 27, 2024 In the ReadByQuery class there is a function called setDocParId - try calling that with the appropriate type. https://github.com/intacct/intacct-sdk-php/blob/master/src/Intacct/Functions/Common/ReadByQuery.php 1
Miles Hart Posted September 5, 2024 Author Posted September 5, 2024 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?
Preston, Charlie Posted September 5, 2024 Posted September 5, 2024 Yes, have a look at the SDK documentation, here: https://intacct.github.io/intacct-sdk-php/class_intacct_1_1_functions_1_1_common_1_1_read_by_query.html
Recommended Posts