Filling multiple Text Tabs with the same label - docusignapi

According to DocuSign: How to prefill multiple text tabs with the same label?, by appending \\* to my Text Tab label will make it work and it does.
However, when I have Text Tab labels that end with the same character sequence, the incorrect value will be set: ServiceName and Name Text Tabs will both get populated with the value I set for Name.
Is there a way for this not to happen?

The \\* syntax is a wildcard, so if you want your API request to populate the Name field but not the ServiceName field, then you can do so by having your API request specify tabLabel = Name\\* (this will populate any field that has a label starting with the value "Name").
For example, this JSON within my Create Envelope API request...
"tabs": {
"textTabs": [
{
"tabLabel": "Name\\*",
"value": "value_inserted_via_API"
}
]
}
...populates the Name field in the Envelope, but not the ServiceName field:

Related

Rest API - GET request help - Need help in constructing a URI with parameters

I am new to constructing Rest API GET queries.
Need help in GET request of Rest API by passing the fields in sysparm_fields.
I trying to query a Table via Rest API URI by passing only a limited number of columns of the table using Sysparam_fields.
However few column names have Spaces and parenthesis in it. So the JSON result set is excluding those columns and respective data when I do a GET request.
So if I am querying with column names "assigned_to (need the empid)" and "Number", I only get "Number" data.
If I dont pass, sysparm_fields it is returning the result set with all the columns including "assigned_to (need the empid)"
My end point looks like this
https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_fields=number,assigned_to (need the empid)&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')#javascript:gs.dateGenerate('2020-09-01','23:59:59')
The result is only
{
"result": [
{
"number": "TK00001"
}
}
If my URI is
https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')#javascript:gs.dateGenerate('2020-09-01','23:59:59')
Then I get the result
{
"result": [
{
"number": "TK00001",
"assigned_to (need the empid)":"MYQ001",
"Other_Field1":"Other Value 1",
:
"Other_FieldN":"Other Value N"
}
}
So how do I pass the column names that has Spaces and parenthesis like "assigned_to (need the empid)"
Thanks for the Help in Advance

API Call from Custom field not showing the same data type

Tried to do an API Call from a custom field that I published in one of our instance. The result value of the corresponding field didn't match the data type in our Data class. My field data type is Int but through the API, I got String instead. Also the field control element for this field is ComboBox
What I expect for the Kundengruppe value:
{
"id": "4b2758c6-8d86-4357-871e-70621d09719d",
"rowNumber": 3,
"note": null,
"Kundengruppe": {
"value": "1" //
},
"UUID": {},
"custom": {}
}
What I get:
{
"id": "4b2758c6-8d86-4357-871e-70621d09719d",
"rowNumber": 3,
"note": null,
"Kundengruppe": {
"value": "bis 25.000,- 0,00%" //
},
"UUID": {},
"custom": {}
}
ASPX & Data class attribute for custom field Kundengruppe
<px:PXDropDown runat="server" ID="CstPXDropDown40" DataField="UsrKundengruppe" CommitChanges="True" Enabled="True" SelectMethod="" />
------
[PXDBInt]
[PXIntList(new int[] {0,1,2,3,4,5,6,7,8}, new string[] {"bis 25.000,- 0,00%", "25.001,- bis 50.000,- 3,75%", "50.001,- bis 100.000,- 7,50%", "100.001,- bis 200.000,- 10,00%", "200.001,- bis 300.000,- 12,00%", "300.001,- bis 500.000,- 14,50%", "500.001,- bis 750.000,- 16,50%", "750.001,- bis 1.000.000,- 18,50%", "ab 1.000.000,- 20,00%"})]
[PXUIField(DisplayName="Kundengruppe Jahresumsatz von - bis Rabatt")]
Screenshots of some screens
Dropdown list, Element properties
Is there anyway to fixing this? I am not really familiar with C# in general. I also made a new fresh Endpoint to specifically for this custom field.
Note: I am using german localized version of Acumatica called Haufe x360
You need to set the data type on the web service endpoint screen, it defaults to string regardless of the column type:
I looked at the backend SQL Server tables for a stock PXDropDown (i.e. Shipping Rule property in Sales Order). If you set the Shipping Rule to "Ship Complete", then this sets "Ship Complete" in the database table as well. However, if you use a PXSelector, then the value is stored by reference in the database.
I don't think you are going to be able to do what you want to do with a PXDropDown. The framework doesn't have a way to go from the stored text database value back to the index value, and the REST API is just looking at what's in the database for the most part.
I would say change it to a PXSelector. Or you could write a graph extension that grabs the attribute values for the PXDropdown and saves the reference value to the database instead of the text value/saves it to another custom field (although you would have to make sure that the referential integrity will hold....for example if you add another dropdown value and that becomes value #1, then you've broken your referential integrity to the previous #1 value). The bottom line is that this can be done with a graph extension and a little bit of planning, but that will require C# code.

I am having trouble parsing the JSON in livecode

I'm trying to create a simple mobile app that queries an API and parses the response to display certain values.
The mobile has 2 fields viz:
Button to query the api
Large text box to display the contents
In my livecode stack, I've the following inclusions:
JSON Library
mergJSON
tsNet
The api response is as follows:
{
"data": [
{
"id": 1,
"date_created": "2021-11-08T17:12:03Z",
"date_updated": "2021-11-22T16:08:55Z",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe#unknown.com",
"phone": "9876543210",
"dob": "1980-01-01",
"password": "xxxxxxxxx",
"plan_start": "2021-11-22T16:07:46Z",
"plan_expiry": "2021-12-21T16:06:25Z"
}
]
}
I want to parse the JSON to display the email field value in the textbox.
In my livecode stack:
The button is named as "getdata"
The textbox is named as "flddata"
In the button script, I've added the following code:
put "<api url endpoint>" into tUrl
put "Authorization: Bearer xxxxxxxxx" into tHeaders
put tsNetGetSync(tUrl, tHeaders, tRecvHeaders, tResult, tBytes) into tData
put JSONToArray(tData) into tDataArray
put tDataArray["email"] into field "flddata"
But this doesn't work. Nothing happens. For the life of me, I can't figure out what's wrong. Any help would be appreciated. Thanks a ton!
To access the "email" key of the array that is built from the JSON you shared. You must first access the "data" key and then key 1. So the last line of your code would be as follows:
put tDataArray ["data"] [1] ["email"] into field "flddata"
Tips:
Put a break point on that line. This will allow you to see the contents of the variables so that you can see the structure of the array.
It looks like it might be a multidimensional array. Here's a simple way to get a look at how it's structured:
Drag a Tree View widget onto your card.
Set the arrayData property of the widget to your array tDataArray. Like this:
set the arrayData of widget "Tree View" to tDataArray
You should see the structure of the array in your tree view widget. It's possible that the array that was created looks something like this:
put tDataArray[1]["email"] into field "flddata"

Whats the best way to handle related data ids using Tabulator

Using Tabulator, if you have a 'select' editor and want it to link to values 'Male' and 'Female' but underneath male and female are values from another physical database table with id values of 1 and 2 (which are different than the 'row' id), whats the best way to do something like this?
The 'select' editor has ways to specify the display of items in the drop down and a literal display of the selected value, but no place for a hidden (not displayed) underlying ID of the selected value to pass when saving the data.
We could wrap the select data values in divs with a data attribute for the selects values ids and then pass that when updating, but are not sure this is the best option considering how Tabulator works. We could also just pass the raw selected value and then look it up on the server to get the associated ID, but that seems like a lot of overhead and tightly couples the server to the client, which wouldn't work for something like a 3rd party API where we have no server control.
Any thoughts on how best to handle something like this are appreciated!
The select editor allows for values to be passed in a number of ways, including specifying both the items value and its user visible label
If you want to show a different lable to the value you want to store, you can pass in an object, where the key of each property is the value that will be stored if it is selected, and the value of each property will be the lable displayed for it in the list.
{title:"Name", field:"name", editor:"select", editorParams:{
values:{
"steve":"Steve Boberson",
"bob":"Bob Jimmerson",
"jim":"Jim Stevenson",
}
}}
For more complex option lists you can use an array of objects, that allows you to define option groups, and disabled options.
{title:"Name", field:"name", editor:"select", editorParams:{
values:[
{ //option group
label:"Men",
options:[ //options in option group
{
label:"Steve Boberson",
value:"steve",
},
{
label:"Bob Jimmerson",
value:"bob",
},
]
},
{ //option group
label:"Women",
options:[ //options in option group
{
label:"Jenny Jillerson",
value:"jenny",
},
{
label:"Jill Betterson",
value:"jill",
},
]
},
{//ungrouped option
label:"Other",
value:"other",
},
]
}}
For full details on how to use this editor, checkout the Editor Documentation
Finally figured this out. You need to use the lookup formatter to display the text value using the same params as the select editor. This is not obvious since none of the select editor examples in the docs show use of it. Anyway, here is a simple example showing it in both directions. Of course you would want to abstract the data out instead of literally duplicating it, but here to help show the literal use, it is duplicated:
{
title:"Example",
field:"example",
editor: "select",
editorParams:{
"1": "Cute",
"2": "Fine",
"3": "Scary",
},
formatter:"lookup", // display option, but store value
formatterParams:{
"1": "Cute",
"2": "Fine",
"3": "Scary",
}
}

Only one custom field been populated out of many

I have a document that I’d like to pre-populate. In the document the person’s name is repeated multiple times so I’ve set up a text fields, given them the same label e.g. “CandidateName” and set them all to not required and read only.
The reason why all of them are set to read only is because I programmatically set them when I call DocuSign via API (TextTabs). As result only the final field is populated. All the previous ones are blank.
Cheers
If your template contains multiple fields that have the same tabLabel and you want to populate all of those fields with the same value by using the API, you need to prefix the tabLabel value with \\*.
For example, here's the JSON for the tabs portion of a CreateEnvelope request that would populate every field which has the label CandidateName with the value John Smith.
"tabs":
{
"textTabs": [
{
"tabLabel": "\\*CandidateName",
"value": "John Smith"
}
]
}

Resources