Skip to main content
Question

How to create bill for a subcontract through API

  • June 7, 2024
  • 1 reply
  • 90 views

I want to create a bill related to a subcontract. I am able to create bill for PO receipts but can not create for subcontract using the same steps.

I have added SubcontractNbr and SubcontractLine in the Bill.Details entity like 

 

After that if a bill is created through Subcontract via “CREATE AP BILL” button and we try to GET that bill through API, we get these fields (SubcontractNbr and SubcontractLine) in the response.

 

But when we try to add these data while creating bill through PUT request, the items are not linked to the Subcontract.

 

Payload:

{
  "Vendor": {
    "value": "20119"
  },
  "VendorRef": {
    "value": "IX00614958-C"
  },
  "Date": {
    "value": "04/06/2024"
  },
  "VendorDocDate": {
    "value": "04/06/2024"
  },
  "BranchID": {
    "value": "TESTCOMPAN"
  },
  "DocDesc": {
    "value": "V004651-2"
  },
  "CashDiscountDate": {
    "value": "04/06/2024"
  },
  "PostPeriod": {
    "value": "06-2024"
  },
  "DueDate": {
    "value": "02/06/2024"
  },
  "Amount": {
    "value": 750
  },
  "Details": [
    {
      "ExtendedCost": {
        "value": 750
      },
      "TransactionDescription": {
        "value": "sheet"
      },
      "Account": {
        "value": "10100"
      },
      "Branch": {
        "value": "TESTCOMPAN"
      },
      "SubcontractNbr": {
        "value": "SC-000005"
      },
      "SubcontractLine": {
        "value": 1
      },
      "Qty": {
        "value": 3
      },
      "UnitCost": {
        "value": 250
      },
      "UOM": {
        "value": "PIECE"
      },
      "Project": {
        "value": "X"
      }
    }
  ],
  "Description": {
    "value": "Subcontract link test"
  },
  "Hold": {
    "value": false
  }
}

Response:

{
  "id": "1efe1be1-ce24-ef11-835e-0652b44234a3",
  "rowNumber": 1,
  "note": {
    "value": ""
  },
  "Amount": {
    "value": 750
  },
  "ApprovedForPayment": {
    "value": false
  },
  "Balance": {
    "value": 750
  },
  "BranchID": {
    "value": "TESTCOMPAN"
  },
  "CashAccount": {},
  "CurrencyID": {
    "value": "USD"
  },
  "Date": {
    "value": "2024-04-06T00:00:00+00:00"
  },
  "Description": {
    "value": "Subcontract link test"
  },
  "Details": [
    {
      "id": "20fe1be1-ce24-ef11-835e-0652b44234a3",
      "rowNumber": 1,
      "note": {
        "value": ""
      },
      "Account": {
        "value": "10100"
      },
      "Amount": {
        "value": 750
      },
      "Branch": {
        "value": "TESTCOMPAN"
      },
      "CalculateDiscountsOnImport": {},
      "CostCode": {},
      "Description": {
        "value": "Petty Cash"
      },
      "ExtendedCost": {
        "value": 750
      },
      "InventoryID": {},
      "NonBillable": {
        "value": false
      },
      "POLine": {},
      "POOrderNbr": {},
      "POOrderType": {},
      "POReceiptLine": {},
      "POReceiptNbr": {},
      "POReceiptType": {},
      "Project": {
        "value": "X"
      },
      "ProjectTask": {},
      "Qty": {
        "value": 3
      },
      "Subaccount": {
        "value": "0"
      },
      "SubcontractLine": {},
      "SubcontractNbr": {},
      "TaxCategory": {},
      "TransactionDescription": {
        "value": "sheet"
      },
      "UnitCost": {
        "value": 250
      },
      "UOM": {
        "value": "PIECE"
      },
      "custom": {},
      "_links": {
        "files:put": "/entity/Test/23.200.001/files/PX.Objects.AP.APInvoiceEntry/Transactions/20fe1be1-ce24-ef11-835e-0652b44234a3/{filename}"
      }
    }
  ],
  "DueDate": {
    "value": "2024-02-06T00:00:00+00:00"
  },
  "Hold": {
    "value": false
  },
  "IsTaxValid": {
    "value": false
  },
  "LastModifiedDateTime": {
    "value": "2024-06-07T13:07:26.943+00:00"
  },
  "LocationID": {
    "value": "MAIN"
  },
  "PostPeriod": {
    "value": "062024"
  },
  "Project": {
    "value": "X"
  },
  "ReferenceNbr": {
    "value": "000185"
  },
  "Status": {
    "value": "Balanced"
  },
  "TaxTotal": {
    "value": 0
  },
  "Terms": {
    "value": "1"
  },
  "Type": {
    "value": "Bill"
  },
  "Vendor": {
    "value": "20119"
  },
  "VendorRef": {
    "value": "IX00614958-C"
  },
  "custom": {},
  "_links": {
    "self": "/entity/Test/23.200.001/Bill/1efe1be1-ce24-ef11-835e-0652b44234a3",
    "files:put": "/entity/Test/23.200.001/files/PX.Objects.AP.APInvoiceEntry/Document/1efe1be1-ce24-ef11-835e-0652b44234a3/{filename}"
  }
}

I have also tried action

Added a new action under bill “addSubcontractLine”

When I try this action, after creating a bill, it returns 204 but no line item gets added.

I can add a Subcontract Line through the UI

 

1 reply

  • Freshman I
  • 1 reply
  • September 18, 2024

@aniket31 Were you able to get this resolved? I’m not even able to see the SubcontractNbr field when I call GET /entity/Default/23.200.001/Bill.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings