Skip to main content
Solved

Attributes not updated in PUT Request(creation of record)



    {
        "Date": {
            "value": "2022-05-12T00:00:00+00:00"
        },
          "PostPeriod": {
            "value": "062022"
        },
        "Description": {
             "value": "2022-05-12T00:00:00+00:00"
        },

        "Details": [
            {
                "InventoryID": {
                    "value": "SAM-GAL-NOT-5-32"
                },
                "Warehouse": {
                    "value": "IMMDFW"
                },
                "ReasonCode":{
                     "value": "IN RECEIPT"
                },

                "LineDetails": {
                    "LotSerialAttributes": [
                        {
                            "Attribute": {
                                "value": "ASSETTAG"
                            },
                            "Value": {
                                "value": "Passed000ggg"
                            },
                            "custom": {}
                        }

                    ],
                    "LotSerialNbr": {
                        "value": "990007008212133999910044433"
                    },
                    "Quantity": {
                        "value": 1.000000
                    }
                }
            }
        ]
    }

 

I build custom endpoint to allow update of attributes along with serial numbers and Library used is https://github.com/Acumatica/Acumatica-LotSerialNbrAttribute

 

In Receipt Screen Attribute values are not updated..

 

 

 

Custom endpoint screen..

Am I missing anything in Json Request?

 

 

Best answer by RohitRattan88

@nirmal198939 

Not sure if you still looking for a solution for this one but @Dhiren Chhapgar added support to add attributes values in his updated customization at GitHub - Acumatica/Acumatica-LotSerialNbrAttribute-2023R1-ONWARD: Adding Attribute Support to Lot/Serial Number

As per documentation: 

  1. Lot/Serial Screen (IN202501) is available for REST API via custom Web Services Endpoint (eCommerceLotSerial)

Example:

POSTMAN Call
Result

 

Hopefully it helps.

View original
Did this topic help you find an answer to your question?

13 replies

Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • June 5, 2022

Understand that Acumatica is a “pseudo-RESTful” API. In my experience, it doesn’t follow normal RESTful conventions very well, and especially with doing updates on parent-child relationships, doing this the way you’re triyng to do it often doesn’t work. I would write an API against the LineDetails DAC by itself, and only update details that are in that table. So you would query the information you need with GET to figure out which line detail record you want to update, and then do an update only against that data (not as a subitem of the “Posting period” or whatever you’re doing here. If you need to update a parent record, then make it two requests and update parent and child.


  • Author
  • Freshman I
  • 7 replies
  • June 5, 2022

@rosenjon Update of Attributes is working using the ‘row session id’ .. but I cant insert an attribute of a line detail in PUT request of the Receipts.

I want to create a receipt via API and also insert line details with insertion of attributes ..(using pUT request) Receipt is created with line details but attributes are not inserted.


Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • June 6, 2022
Can you make a request for the adHocSchema of the PurchaseReceipt entity and post it here?
    "/PurchaseReceipt/$adHocSchema": {
      "get": {
        "tags": [
          "PurchaseReceipt"
        ],
        "summary": "Retrieves the schema of custom fields of the entity from the system.",
        "operationId": "PurchaseReceipt_GetAdHocSchema",
        "consumes": [],
        "produces": [
          "application/json",
          "text/json"
        ],
        "responses": {
          "200": {
            "description": "The field name, view name, and type of the fields that are not defined in the contract of the endpoint for this entity.",
            "schema": {
              "$ref": "#/definitions/PurchaseReceipt"
            }
          },
          "401": {
            "description": "The user is not logged in to the system.",
            "schema": {
              "$ref": "#/definitions/HttpError"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/HttpError"
            }
          }
        }
      }
    },

 


  • Author
  • Freshman I
  • 7 replies
  • June 6, 2022
{
    "id": "779b0f7a-62f9-475e-9afc-daff844a1670",
    "rowNumber": 1,
    "note": null,
    "ControlCost": {},
    "ControlQty": {},
    "Date": {},
    "Description": {},
    "Details": [
        {
            "id": "0930cc8d-fc9f-4cf0-961c-4215c1439b4a",
            "rowNumber": 1,
            "note": null,
            "Allocations": [
                {
                    "id": "97f66bd7-d184-46c6-b4c5-1db7d4e0d9a3",
                    "rowNumber": 1,
                    "note": null,
                    "ExpirationDate": {},
                    "InventoryID": {},
                    "Location": {},
                    "LotSerialNbr": {},
                    "Qty": {},
                    "SplitLineNumber": {},
                    "Subitem": {},
                    "UOM": {},
                    "custom": {
                        "splits": {
                            "DocType": {
                                "type": "CustomStringField",
                                "value": null
                            }
                        }
                    }
                }
            ],
            "CostCode": {},
            "Description": {},
            "ExpirationDate": {},
            "ExtCost": {},
            "InventoryID": {},
            "LineDetails": [
                {
                    "id": "a66102a9-b71d-4109-b223-f6d7df698b73",
                    "rowNumber": 1,
                    "note": null,
                    "InventoryID": {},
                    "LineAttributes": [
                        {
                            "id": "6206d0fa-cc3f-4bf0-9f74-e0f93bf4f87a",
                            "rowNumber": 1,
                            "note": null,
                            "Attribute": {},
                            "RefNoteID": {},
                            "Required": {},
                            "Value": {},
                            "custom": {
                                "Attributes": {
                                    "NoteID": {
                                        "type": "CustomGuidField",
                                        "value": null
                                    }
                                }
                            }
                        }
                    ],
                    "LineNumber": {},
                    "LotSerialNbr": {},
                    "RefNumber": {},
                    "custom": {}
                }
            ],
            "LineNumber": {},
            "Location": {},
            "LotSerialNbr": {},
            "POReceiptNbr": {},
            "Project": {},
            "ProjectTask": {},
            "Qty": {},
            "Subitem": {},
            "UnitCost": {},
            "UOM": {},
            "WarehouseID": {},
            "custom": {
                "transactions": {
                    "BranchID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "ReasonCode": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "DocType": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "RefNbr": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "Availability": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "NoteText": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "NoteID": {
                        "type": "CustomGuidField",
                        "value": null
                    }
                }
            }
        }
    ],
    "Hold": {},
    "LastModifiedDateTime": {},
    "PostPeriod": {},
    "ReferenceNbr": {},
    "Status": {},
    "TotalCost": {},
    "TotalQty": {},
    "TransferNbr": {},
    "custom": {
        "receipt": {
            "ExtRefNbr": {
                "type": "CustomStringField",
                "value": null
            },
            "BranchID": {
                "type": "CustomStringField",
                "value": null
            },
            "NoteText": {
                "type": "CustomStringField",
                "value": null
            },
            "NoteID": {
                "type": "CustomGuidField",
                "value": null
            }
        }
    }
}

I am using Inventory Receipt Screen here. I have extended to include Line Detail Attributes as shown above and I cant insert attributes in   "Attribute": {}, value in LineAttributes field.


Screen given below.

@rosenjon 

 

 


Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • June 6, 2022

Please query the /Purchase Receipt endpoint like below, and post the results….

/PurchaseReceipt/?$expand=Details


  • Author
  • Freshman I
  • 7 replies
  • June 6, 2022

Please ignore my above schema..

 

This is custom endpoint that i use now and its adhoc schema..

 

{{baseUrl}}/ReceiptsIN/$adHocSchema

{
    "id": "979b2903-fb40-4ff3-953d-38ed33c08445",
    "rowNumber": 1,
    "note": null,
    "Branch": {},
    "ControlCost": {},
    "ControlQty": {},
    "Date": {},
    "Description": {},
    "Details": [
        {
            "id": "333063eb-8ad8-440a-866a-55d9f4760daf",
            "rowNumber": 1,
            "note": null,
            "InventoryID": {},
            "LineDetails": {
                "id": "fd2c27e1-639e-4459-a009-aa0c6bc420ea",
                "rowNumber": 1,
                "note": null,
                "LotSerialAttributes": [
                    {
                        "id": "7e305915-48e7-45a9-8e9e-4a23955b80dc",
                        "rowNumber": 1,
                        "note": null,
                        "Attribute": {},
                        "Value": {},
                        "custom": {
                            "Attributes": {
                                "isRequired": {
                                    "type": "CustomBooleanField",
                                    "value": null
                                },
                                "RefNoteID": {
                                    "type": "CustomGuidField",
                                    "value": null
                                },
                                "NoteID": {
                                    "type": "CustomGuidField",
                                    "value": null
                                }
                            }
                        }
                    }
                ],
                "LotSerialNbr": {},
                "Quantity": {},
                "custom": {
                    "splits": {
                        "InventoryID": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "SubItemID": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "LocationID": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "UOM": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "ExpireDate": {
                            "type": "CustomDateTimeField",
                            "value": null
                        },
                        "DocType": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "RefNbr": {
                            "type": "CustomStringField",
                            "value": null
                        },
                        "LineNbr": {
                            "type": "CustomIntField",
                            "value": null
                        },
                        "SplitLineNbr": {
                            "type": "CustomIntField",
                            "value": null
                        }
                    }
                }
            },
            "ReasonCode": {},
            "Warehouse": {},
            "custom": {
                "transactions": {
                    "BranchID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "SubItemID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "LocationID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "Qty": {
                        "type": "CustomDecimalField",
                        "value": null
                    },
                    "UOM": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "UnitCost": {
                        "type": "CustomDecimalField",
                        "value": null
                    },
                    "TranCost": {
                        "type": "CustomDecimalField",
                        "value": null
                    },
                    "LotSerialNbr": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "ExpireDate": {
                        "type": "CustomDateTimeField",
                        "value": null
                    },
                    "ProjectID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "TaskID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "CostCodeID": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "TranDesc": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "POReceiptNbr": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "DocType": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "RefNbr": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "LineNbr": {
                        "type": "CustomIntField",
                        "value": null
                    },
                    "Availability": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "NoteText": {
                        "type": "CustomStringField",
                        "value": null
                    },
                    "NoteID": {
                        "type": "CustomGuidField",
                        "value": null
                    }
                }
            }
        }
    ],
    "ExternalRef": {},
    "PostPeriod": {},
    "ReferenceNbr": {},
    "Status": {},
    "TotalCost": {},
    "TotalQty": {},
    "custom": {
        "receipt": {
            "TransferNbr": {
                "type": "CustomStringField",
                "value": null
            },
            "NoteText": {
                "type": "CustomStringField",
                "value": null
            },
            "NoteID": {
                "type": "CustomGuidField",
                "value": null
            }
        }
    }
}

 

{{baseUrl}}/ReceiptsIN/?$expand=Details,Details/LineDetails,Details/LineDetails/LotSerialAttributes&$filter=ReferenceNbr eq '000035'


sample json data

[
    {
        "id": "fbcf44d9-5cdc-ec11-8189-12ab715c9afd",
        "rowNumber": 1,
        "note": {
            "value": ""
        },
        "ControlCost": {
            "value": 17.1000
        },
        "ControlQty": {
            "value": 1.000000
        },
        "Date": {
            "value": "2022-05-12T00:00:00+00:00"
        },
        "Description": {
            "value": "5/12/2022 8:29:48 AM"
        },
        "Details": [
            {
                "id": "fdcf44d9-5cdc-ec11-8189-12ab715c9afd",
                "rowNumber": 1,
                "note": {
                    "value": ""
                },
                "InventoryID": {
                    "value": "SAM-GAL-NOT-5-32"
                },
                "LineDetails": {
                    "id": "4cafcf3a-2173-4337-b8f4-49ce4261273a",
                    "rowNumber": 1,
                    "note": null,
                    "LotSerialAttributes": [
                        {
                            "id": "01248da2-4ae2-4237-83e3-77145d4aefe6",
                            "rowNumber": 1,
                            "note": null,
                            "Attribute": {
                                "value": "Accelerometer Test"
                            },
                            "Value": {
                                "value": "fhfhffhfhffhfhfgggggggggssssss"
                            },
                            "custom": {}
                        }
                    ],
                    "LotSerialNbr": {
                        "value": "99000788212133"
                    },
                    "Quantity": {
                        "value": 1.000000
                    },
                    "custom": {}
                },
                "ReasonCode": {},
                "Warehouse": {
                    "value": "IMMDFW"
                },
                "custom": {}
            }
        ],
        "ExternalRef": {},
        "PostPeriod": {
            "value": "052022"
        },
        "ReferenceNbr": {
            "value": "000035"
        },
        "Status": {
            "value": "Balanced"
        },
        "TotalCost": {
            "value": 17.1000
        },
        "TotalQty": {
            "value": 1.000000
        },
        "custom": {}
    }
]

 

 

I can only update Attributes in UI ,but I cant insert via API

 

 


Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • June 6, 2022

I’ve never done one this nested before, but I have some model code for a similar situation. See if the below JSON object works (send it exactly like this...you can test in Postman).

    {
        "id": "fbcf44d9-5cdc-ec11-8189-12ab715c9afd",
        "Details": [
            {
                "id": "fdcf44d9-5cdc-ec11-8189-12ab715c9afd",
                "LineDetails": {
                    "id": "4cafcf3a-2173-4337-b8f4-49ce4261273a",
                    "LotSerialAttributes": [
                        {
                            "id": "01248da2-4ae2-4237-83e3-77145d4aefe6",
                            "Attribute": {
                                "value": "Accelerometer Test"
                            },
                            "Value": {
                                "value": "fhfhffhfhffhfhfgggggggggssssss"
                            }
                        }
                    ]
                }
            }
        ],
        "ReferenceNbr": {
            "value": "000035"
        }
    }

 


  • Author
  • Freshman I
  • 7 replies
  • June 6, 2022

@rosenjon oh this works as you are trying to update an existing attribute thats already inserted(using UI) before…

I cant insert a new attribute like “Asset Tag Data”  through REST API if it doesnt come via GET Request. but that attribute ID exists as you can see in the Receipt Screen. (UI)


Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • June 6, 2022
    {
        "id": "fbcf44d9-5cdc-ec11-8189-12ab715c9afd",
        "Details": [
            {
                "id": "fdcf44d9-5cdc-ec11-8189-12ab715c9afd",
                "LineDetails": {
                    "id": "4cafcf3a-2173-4337-b8f4-49ce4261273a",
                    "LotSerialAttributes": [
                        {
                            "Attribute": {
                                "value": "Some new value"
                            },
                            "Value": {
                                "value": "blahblahblah"
                            }
                        }
                    ]
                }
            }
        ],
        "ReferenceNbr": {
            "value": "000035"
        }
    }

Try this?


  • Author
  • Freshman I
  • 7 replies
  • June 6, 2022

Nope it is not working :( i tried with AttributeID value and Attribute Description .. but nothing works.. here..


  • Author
  • Freshman I
  • 7 replies
  • April 25, 2023

@rosenjon @aaghaei Can you please anyone help here on this attribute update? or do you think it is a bug on Acumatica side?


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 253 replies
  • Answer
  • August 14, 2023

@nirmal198939 

Not sure if you still looking for a solution for this one but @Dhiren Chhapgar added support to add attributes values in his updated customization at GitHub - Acumatica/Acumatica-LotSerialNbrAttribute-2023R1-ONWARD: Adding Attribute Support to Lot/Serial Number

As per documentation: 

  1. Lot/Serial Screen (IN202501) is available for REST API via custom Web Services Endpoint (eCommerceLotSerial)

Example:

POSTMAN Call
Result

 

Hopefully it helps.


Forum|alt.badge.img+5
  • Semi-Pro III
  • 294 replies
  • August 14, 2023

@RohitRattan88 Thanks for the update. The more I’ve played with the Acumatica lot tracking features, the more I think that it was a mistake to tie lot and serial tracking to attributes. Products have attributes (i.e. color, size, thickness, etc). But lot and serial tracking is specific to RECEIPTS of material, not the material itself. The problem is that you don’t want to be able to choose a different lot/serial number from a list once a product is received. That is not a robust way to track lots and serials. Those tags should travel with that individual receipt of material, not be a tag against the item itself. Acuamtica has made some system changes that would allow this to be rearchitected against the individual item receipts, and I think that’s the direction they should go in the future.


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