Creating a UD record using Rest

Hi All,

Anyone able to create a ud record using rest?

Ive tried the GetANewUd, the general UD post and the other custom methods but cant seem to get it to work.

I dont want to build the logic inside the ubaq and let the api do it.

Any help would be great

Thanks
Aaron

Don’t fully discount this. I use this method quite a bit because it’s easier to upgrade in the event that they change the REST signature. You’ll only be making a single REST call to your BAQ instead of multiple REST calls to create the record.
Food for thought.

Otherwise, I just tested this out and it worked fine using the UD10Svc.Update call:

{
  "ds": {
    "UD10": [
      {
        "Company": "C001",
        "Key1": "Test1",
        "Key2": "Test2",
        "Key3": "",
        "Key4": "",
        "Key5": "",
        "Character01": "Meep",
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "RowMod": "A"
      }
    ],
    "UD10Attch": [],
    "ExtensionTables": []
  }
}

Note–RowMode being set to “A” is essential to make the add work.

3 Likes

I’m getting this

Sorry! Something went wrong. Please contact your system administrator.
{
  "ds": {
    "UD02": [
      {
        "Company": "TEAGLE",
        "Key1": "4000",
        "Key2": "6000",
        "WebUserUID_c": "GDPR",
        "CreationDate_c": "2022-12-17:54:12.570Z",
        "Name_c": "GDPR",
        "Email_c":"GDPR",
        "Password_c": "GDPR",
        "Confirmed_c": false,
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "RowMod": "A"
      }
    ],
    "UD02Attch": [],
    "ExtensionTables": []
  }
}

Any ideas?

So I found the problem with the above error… It was my date.

Needs to be format 2022-12-31 now I’ve got another funny issue… I’ve just ran a BAQ on UD02 and no data is being returned but if I use Swagger… bam! Rows… WTF? :rofl:

Ignore me. I had a GetList custom code running hiding processed rows. -.-

Thank you…
All working :smiley:

[quote="aarong, post:5, topic:97865]
Ignore me. I had a GetList custom code running hiding processed rows. -.-
[/quote]

Don’t feel bad. I spent over an hour tracking down a very strange bug yesterday only to discover that I’m an idiot at the end. Not only that, I had reused the piece of code lower down, and was an idiot twice.

*nothing to see here

I just love those…

I had one while back… setting a field using a bpm from false to true but automatically setting back to false after. I spent 2 days working that one out… rewrote code multiple times… :rofl:

Luckily this time I only did a lot of /* */ :slight_smile:

Good morning,

I’m trying to use the Rest API to call UD11Svc/Update and post this

{
  "ds": {
    "UD11": [
      {
        "Company": "T300",
        "Key1": "1689774713881",
        "Key2": "",
        "Key3": "",
        "Key4": "",
        "Key5": "",
        "Character01": [
          {
            "JobNum": "J049340",
            "AsmSeq": 0,
            "OprSeq": 20
          },
          {
            "JobNum": "J049341",
            "AsmSeq": 0,
            "OprSeq": 20
          }
        ],
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "RowMod": "A"
      }
    ],
    "UD11Attch": [],
    "ExtensionTables": []
  }

I am getting the “Sorry! Something went wrong. Please contact your system administrator.” error message. Does any of the JSON above look incorrect? What might be the issue I can look into?

Check the Event Viewer on your server. It will tell you why it’s complaining.

Pff Maeldan Benenuts GIF - Pff Maeldan Benenuts Sheldon - Discover & Share GIFs

You’re trying to insert an object array into a string field.

Edit:
If you are wanting to store Json in that field:

{
	"ds": {
		"UD11": [{
			"Company": "T300",
			"Key1": "1689774713881",
			"Key2": "",
			"Key3": "",
			"Key4": "",
			"Key5": "",
			"Character01": "[{\"JobNum\": \"J049340\",\"AsmSeq\": 0,\"OprSeq\": 20},{\"JobNum\": \"J049341\",\"AsmSeq\": 0,\"OprSeq\": 20}]",
			"SysRowID": "00000000-0000-0000-0000-000000000000",
			"RowMod": "A"
		}],
		"UD11Attch": [],
		"ExtensionTables": []
	}
}
2 Likes

@skhan this will do what you were trying to do the other day. This was the post I was trying to find.