Acumatica API - Creating an appointment detail marked for PO - json

I want to create an appointment detail line that is marked for PO. I'm setting the fields I think are relevant, but after the PUT, the MarkforPO field will reset to false. The detail record is created, but not marked for PO or any errors returned. Is there a process or specific field/value that I am missing?
Here is my Appointment PUT JSON:
{
"id": "[APPOINTMENT GUID]",
"Details": [
{
"LineRef": {
"value": "0003"
},
"LineNbr": {
"value": 3
},
"LineType": {
"value": "Non-stock item"
},
"MarkforPO": {
"value": true
},
"POSource": {
"value": "Purchase to Appointment"
},
"InventoryID": {
"value": "INVID"
},
"Description": {
"value": "INVENTORY DESC"
},
"EstimatedQty": {
"value": "1"
},
"Billable":{
"value":true
},
"UnitPrice": {
"value": "25"
},
"BillableQty": {
"value": "1"
},
"BillableAmount": {
"value": "25"
},
"UnitCost": {
"value": "25"
},
"VendorID": {
"value": "AASERVICES"
},
"VendorLocationID": {
"value": "MAIN"
}
}
]
}

The trouble was that the AppDetails.MarkforPO field was not linked to a field but mapped to FSSODet__EnablePO instead. I am not sure what this is but after adding adding another custom field directly mapped to Mark for PO I was able to modify this field through the API.

Related

Elastic search collapse with nested object

I have an elastic search index
like
{
"title": "A",
"comments": [
{
"id": "1"
},
{
"id": "2"
}
]
},
{
"title": "B",
"comments": [
{
"id": "1"
},
{
"id": "3"
}
]
},
{
"title": "C",
"comments": [
{
"id": "7"
},
{
"id": "3"
}
]
}
I want to collapse is the group by the nested object. In the above JSON, I want to group it by Id.
So the output will be like
hits:[{
"title": "A",
"comments": [
{
"id": "1"
},
{
"id": "2"
}
]
},
inner_hits {[
{
"title": "A",
"comments": [
{
"id": "1"
},
{
"id": "2"
}
]
},
{
"title": "B",
"comments": [
{
"id": "1"
},
{
"id": "3"
}
]
}
]}
}]
Baiscally I need collapse bases on the nested object property.
Tried this
/_search?track_total_hits=true
{
"collapse": {
"field": "comments.id",
"inner_hits": {
"name": "id",
"size": 10
},
"max_concurrent_group_searches": 3
}
}
But its always returing first object only in the inner hits
Within the mapping of the object comments , you should remove the nested type.

How to create DataTable based on dynamic row and columns list?

I want to create Grid using DataTable JQuery. Here I will have dynamics columns that means I don't have predefined columns. Normally, when I have predefined columns, I just create Table and apply ToDataTable() method to convert in DataTable. But here I will have dynamic columns. One way is to iterate through columns and create Table Cell. Is there any other easy way?
Here is example,
{
"Rows": [
{
"Columns": [
{
"DisplayName": "First Name",
"Value": "Ema",
},
{
"DisplayName": "Last Name",
"Value": "Sherik",
}
{
"DisplayName": "Status",
"Value": "Active",
}
]
},
{
"Columns": [
{
"DisplayName": "First Name",
"Value": "Jack",
},
{
"DisplayName": "Last Name",
"Value": "Mark",
},
{
"DisplayName": "Status",
"Value": "Active",
}
]
},
],
"TotalRows": 2,
}

Jsonpath querying only one item

I have a problem to find out only a determined value in a json using jsonpath.
I have this json:
{"tvs": {
{ "tv": [
{
"serial": "HD1300",
"data": [
{
"title": "manufacturer",
"value": "lg"
},
{
"title": "color",
"value": "silver"
},
{
"title": "inches",
"value": 32
},
{
"title": "connection",
"value": 220
},
{
"title": "connection",
"value": 400
}
]
}.. more tvs
And I want to know if the value connection:400 is present for serial hd1300
I already tried with:
$.tvs.[?(#.serial=='hd1340')].data.[?(#.title== 'connection'),(#.value==400)]
But my problem is that I retrieve also the "connection" with 200. How can I filter to get only this value?
I think you might have an error in your JSON (extra brace between tvs and tv). I was able to get this to work on http://jsonpath.com.
{"tvs":
{ "tv": [
{
"serial": "HD1300",
"data": [
{
"title": "manufacturer",
"value": "lg"
},
{
"title": "color",
"value": "silver"
},
{
"title": "inches",
"value": 32
},
{
"title": "connection",
"value": 220
},
{
"title": "connection",
"value": 400
}
]}
]}
}
$.tvs.tv.[?(#.serial=='HD1300')].data.[?(#.title=='connection' && #.value=='400')]

What is my JSON file consist of?

I have read tutorials on the syntax of JSON files but I am still not quite sure I got it. Here is my JSON file:
{
"dataset": [
{
"seriesname": "Item1 Price",
"data": [
{
"value": 4.72
},
{
"value": 2.81
},
{
"value": 6.18
},
{
"value": 5.17
},
{
"value": 2.94
},
{
"value": 3.77
},
{
"value": 1.7
},
{
"value": 6.72
},
{
"value": 4.61
}
]
},
{
"seriesname": "Item2 Price",
"data": [
{
"value": 2.49
},
{
"value": 0.72
},
{
"value": 4.06
},
{
"value": 1.74
},
{
"value": 7.23
},
{
"value": 5.83
},
{
"value": 2.59
},
{
"value": 7.54
},
{
"value": 7.02
}
]
}
],
"categories": [
{
"label": "Jan"
},
{
"label": "Feb"
},
{
"label": "Mar"
},
{
"label": "Apr"
},
{
"label": "May"
},
{
"label": "Jun"
},
{
"label": "Jul"
},
{
"label": "Aug"
},
{
"label": "Sept"
}
]
}
From what I understand, there are 2 JSONObjects here, one is "dataset" and another is "categories". The "dataset" object has 2 JSONObjects inside it (Item1 Price and Item2Price) and they both are arrays which have several values. "categories" is an array with several entries. Am I correct or am I misreading the file?
You're correct. You can use any of the JSON visualizers out there (just google that term) to 'see' the data structure of the JSON array...
for example the one I use often is located here.
if you paste your JSON data in the left column, then click the arrow in the middle pointing to the right, it will let you navigate and explore the data easily (see screenshot below).
When I started working with JSON it really helped me visualize the syntax and structure of some complex data I was working with.
Good luck!

AngularJS push element into existing json structure

I have a service that is missing an element I require in my checkbox form - productUsed = false.
How can I push that into my json so it becomes part of the model for a form page for a series of checkboxes.
The json structure is similar to the below:
"Data": [
{
"AcceptedValues": [
{
"Category": {
"Key": 2126,
"Value": "Category"
},
"ProfileOptions": [
{
"Key": 46546798,
"Value": "product Name"
},
{
"Key": 46546769,
"Value": "product Name"
},
{
"Key": 2164,
"Value": "product Name"
}
]
},
{
"Category": {
"Key": 4646789,
"Value": "Category Name"
},
"ProfileOptions": [
{
"Key": 464987946,
"Value": "Product Name"
},
{
"Key": 132465,
"Value": "Product Name"
}
]
}
]
}
]
If the value is always false (at the moment) you can directly bind it in the view : {{product.productUsed}}.
If a property does not exists, Angular sets up a new property on the scope instead (default value is false i guess)
If the data is edited later, this code will works well.
//let suppose the $scope.recordlist is the original json
$scope.UpdatedRecordlist = $scope.recordlist.map(function(obj) {
return angular.extend(obj, {productUsed:'false'});
});
// Now $scope.UpdatedRecordlist is the new updated json with productUsed element