Skip to main content
Solved

Update UDF using PUT API


Forum|alt.badge.img

Hi, All I am trying to update the UDF in the customer form. But when ever I am trying to use PUT API. It showing me the the Customer.AttributeAGDCRAN is not available in data set. I have also extend the API and populate this field in customer>>Attributes As you can see in below screenshot. I create AGDCRAN from attributes.

 

 

 

Can anyone help or guide me how can I update this UDF using PUT API.

 

 

 

http://accumaticaInstance/AcumaticaSB/entity/AGRAN/22.200.001/Customer?$select=CustomerID&$custom=Customer.Attribute.AGDCRAN”

 

but this query is not updating the UDF. There are other Attributes also.

Below is the body AGDCRAN is the udf

{ "CustomerID": { "value": "0018293851" }, "custom": { "Customer": { "AGDCRAN": { "type": "CustomStringField", "value": "Apple jam 8 oz." } } } }


 

 

Best answer by Vignesh Ponnusamy

Hi @tahayabali,

You can identify the right payload structure by doing a GET request first. You can custom $custom parameter to get the attribute you need to set.

/entity/Default/22.200.001/Customer?$filter=CustomerID eq 'AACUSTOMER'&$custom=BAccount.AttributeAMBATLEN

From the request, you can check/use the right DAC name to use it in the PUT request to update the value of the UDF.

Below is the screenshot of the response for the GET request,

 

So in to update the value of that specific attribute you can use the request payload below,

{
    "CustomerID": {
        "value": "AACUSTOMER"
    },
    "custom": {
        "BAccount": {
            "AttributeAMBATLEN": {
                "type": "CustomStringField",
                "value": "Test From API"
            }
        }
    }
}

You can use BAccount instead of Customer in the custom node.

Hope that helps.! Good Luck,

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

10 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 680 replies
  • September 16, 2024

Hi @tahayabali ,


try like below,

To get udf fields:

url: url/entity/Default/22.200.001/Customer?$filter=CustomerID eq '0018293851'&$custom=Customer.AttributeAGDCRAN

 

To update the udf fields

url: url/entity/Default/22.200.001/Customer

{
    "CustomerID": {
        "value": "0018293851"
    },
   
    "custom": {
        "Customer": {
            "AttributeAGDCRAN": {
                "type": "CustomStringField",
                "value": "XYZ"
            }
        }
    }
}


 

Refer to the below links for more information,

https://help.acumatica.com/(W(5))/Help?ScreenId=ShowWiki&pageid=01266cc0-6eb1-4e41-b049-246e5915496d

https://help.acumatica.com/(W(5))/Help?ScreenId=ShowWiki&pageid=6397c034-d191-4302-8f9d-0a0aec5b5ba8


Forum|alt.badge.img
  • Author
  • Varsity I
  • 112 replies
  • September 16, 2024

HI, @jinin I am using the same method But still column is not found Look at the below screen shot
 

 

 

Get returns with 200OK but the custom is still empty


Forum|alt.badge.img
  • Author
  • Varsity I
  • 112 replies
  • September 17, 2024

@jininAny suggestions will be appreciated


Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5
  • Acumatica Moderator
  • 322 replies
  • Answer
  • September 17, 2024

Hi @tahayabali,

You can identify the right payload structure by doing a GET request first. You can custom $custom parameter to get the attribute you need to set.

/entity/Default/22.200.001/Customer?$filter=CustomerID eq 'AACUSTOMER'&$custom=BAccount.AttributeAMBATLEN

From the request, you can check/use the right DAC name to use it in the PUT request to update the value of the UDF.

Below is the screenshot of the response for the GET request,

 

So in to update the value of that specific attribute you can use the request payload below,

{
    "CustomerID": {
        "value": "AACUSTOMER"
    },
    "custom": {
        "BAccount": {
            "AttributeAMBATLEN": {
                "type": "CustomStringField",
                "value": "Test From API"
            }
        }
    }
}

You can use BAccount instead of Customer in the custom node.

Hope that helps.! Good Luck,


  • Freshman I
  • 5 replies
  • December 6, 2024

any idea how I can update 2 user defined fields at the same time?  currently having issues and only 1 updates when i try to do both.


Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi ​@andersen,

Can you please share the request payload you are using?


  • Freshman I
  • 5 replies
  • December 6, 2024

Hi ​@Vignesh Ponnusamy 

 

I removed the sensitive information

 

{"note": "First Name: Eric\nLast Name: Andersen\nCity: Harrison\nState/Province: NJ\nEmail: eric@yahoo.com\nPhone: 9999999999\nDescription: 8315, 3-0in x 6-8in x 1 3/4in, Infinity Flush Moulding, UB\nUnit Details: I need the door component only. No jamb, hinges or door prep is necessary.\nApplication: Interior","custom": {"Lead": {"AttributeFOLLOWDT": {"type": "CustomStringField", "value": "2024-12-20"}},"Lead": {"AttributeWRSOURCE": {"type": "CustomStringField", "value": "Simpson" }}},"Address": { "AddressLine1" : {"value": ""},"AddressLine2" : {"value": ""},"City" : {"value": "Harrison"},"State" : {"value": "NJ"},"PostalCode" : {"value": "00000"},"Country":{"value":"US"}},"ContactID": {"value": "<NEW>"},"FirstName": {"value": "Eric"},"LastName": {"value": "Andersen"},"Email": {"value": "eric@yahoo.com"},"Phone1": {"value": "9999999999"},"Source": {"value": "Web"} }


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 680 replies
  • December 9, 2024

Hi ​@andersen ,

The custom field appears to be passed incorrectly. It should be structured as shown below.

"custom": {
  "Lead": {
    "AttributeFOLLOWDT": {
      "type": "CustomStringField",
      "value": "2024-12-20"
    },
    "AttributeWRSOURCE": {
      "type": "CustomStringField",
      "value": "Simpson"
    }
  }
}


  • Freshman I
  • 5 replies
  • December 9, 2024

Thank you very much ​@jinin , I thought I tried that combination but I guess my jSon was just off.


  • Freshman I
  • 5 replies
  • December 9, 2024

@jinin I guess I have one last question.  I am trying to change the OwnerID via restapi.  I thought including this in the payload would do it:

 

"OwnerID": {"value": "John Doe"},

 

I get this:

 

"Owner":{"value":"106498"},"OwnerEmployeeName":{"value":"Eric Andersen"},

 

Is this because of the login script to start the rest api?  Is there a way for me to set the owner to a different user within the system?  thanks in advance.


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