Acumatica - Updating User-Defined Field 'View' Error - acumatica

I am trying to update a Custom Attribute on the Contact entity. Here is the structure for the request body (which works to update regular fields when 'custom' is not included):
{
"ContactID": {
"value" : {{record.ContactID.value}}
},
"custom" : {
"Document":
{
"AttributeEXPORTEDMC" :
{
"type": "Checkbox",
"value": "True"
}
}
}
}
Getting this error: 'An error has occurred.","exceptionMessage":"view Document is not found","exceptionType":"System.InvalidOperationException","stackTrace":" at PX.Api.ContractBased.EntityExportContextBuilder.EnsureCustomField(CustomField customField, String[] views)\r\n at System.Monads.MaybeIEnumerable.Do[TSource](IEnumerable`1 source,'.
The documentation saying that the view will always be 'Document' for user defined fields.
'For any user-defined field, the view name is Document'
Field/View Name Documentation
From: https://help-2020r1.acumatica.com/(W(28))/Help?ScreenId=ShowWiki&pageid=bd0d8a36-b00b-44c8-bdcd-b2b4e4c86fd0
[Update]
Had to first create a UDF. Here is the working version for this case (v2 API):
{
"ContactID": {
"value": {{record.ContactID.value}}
},
"custom": {
"Contact": {
"AttributeEXPORTEDMC": {
"type": "CustomBooleanField",
"value": true
}
}
}
}

You can add a UDF to the endpoint as such and modify it like any other field

Related

Admin-graphql - Create private metafield on shopify

How do I create a private metafield on Shopify using Admin-graphql? In their docs, they have given example for retrieving a private metafield by its ID(ref: https://shopify.dev/api/admin-graphql/2022-01/queries/privateMetafield#section-examples), do you have any example for creating private metafield using Node.js?
I use https://www.npmjs.com/package/shopify-api-node, it has support for GraphQL calls. https://insomnia.rest/ has great GraphQL support, with field hinting, query eval etc.
An example of creating a product with a private metafield:
mutation productCreate($input: ProductInput!, $namespace: String!) {
productCreate(input: $input) {
product {
id
bufferProductId: privateMetafield(
key: "your_field_key"
namespace: $namespace
) {
value
}
tags
variants(first: 10) {
edges {
node {
id
sku
}
}
}
}
userErrors {
field
message
}
}
}
You need to pass these variables to the GraphQL query:
{
"input": {
"title": "Your product name",
"options": [
"Size",
"Colour"
],
"handle": "your-product-name",
"tags": [
"Product tag"
],
"vendor": "Lauri's sportin' goods",
"variants": [
{
"sku": "ABC123XL",
"options": [
"Large",
"Blue"
]
},
{
"sku": "ABC123L",
"options": [
"Large",
"Yellow"
]
}
],
"privateMetafields": [
{
"key": "your_field_key",
"namespace": "your_namespace",
"valueInput": {
"value": "Your field value",
"valueType": "STRING"
}
}
]
},
"namespace": "your_namespace"
}
This will return the private metafield value in the product creation response.
A few things that make private metafields different from public ones:
you can add / update the private metafield over and over using ProductUpdate, whereas
you can only access the private metafields through GraphQL. AFAIK, they're not visible anywhere in the Shopify Admin, or using the REST API.
even with GraphQL, those fields will be visible only to the API key that created them. So, you won't see them with another Shopify App.
You can use these field types to set the private metafield values.

Exported Azure Resource Group Template has null parameters

Trying to recreate a resource group from template I previously exported but getting this error :
The value of deployment parameter 'Redis_polyrediscachegraphicsxp_name' is null. Please specify the value or use the parameter reference.
Indeed the parameters.json file has null values :
"parameters": {
"Redis_polyrediscachegraphicsxp_name": {
"value": null
},
"storageAccounts_polystorgraphicsxp_name": {
"value": null
},
"databaseAccounts_polycosmosgraphicsxp_name": {
"value": null
}
}
How can this be fixed ?
The error already shows the mistake you made. Your parameters are null. So you need to change your parameters.json file with the right values like this:
"parameters": {
"Redis_polyrediscachegraphicsxp_name": {
"value": "xxxxxx"
},
"storageAccounts_polystorgraphicsxp_name": {
"value": "xxxxxx"
},
"databaseAccounts_polycosmosgraphicsxp_name": {
"value": "xxxxxx"
}
}
Take the example here.

Logic App : Finding element in Json Object array (like XPath fr XML)

In my logic app, I have a JSON object (parsed from an API response) and it contains an object array.
How can I find a specific element based on attribute values... Example below where I want to find the (first) active one
{
"MyList" : [
{
"Descrip" : "This is the first item",
"IsActive" : "N"
},
{
"Descrip" : "This is the second item",
"IsActive" : "N"
},
{
"Descrip" : "This is the third item",
"IsActive" : "Y"
}
]
}
Well... The answer is in plain sight ... There's a FILTER ARRAY action, which works on a JSON Object (from PARSE JSON action).. couple this with an #first() expression will give the desired outcome.
You can use the Parse JSON Task to parse your JSON and a Condition to filter for the IsActive attribute:
Use the following Schema to parse the JSON:
{
"type": "object",
"properties": {
"MyList": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Descrip": {
"type": "string"
},
"IsActive": {
"type": "string"
}
},
"required": [
"Descrip",
"IsActive"
]
}
}
}
}
Here how it looks like (I included the sample data you provided to test it):
Then you can add the Condition:
And perform whatever action you want within the If true section.

Angular formly: calculate value of one field based on other fields input

json configuration:
{
"moduleconfigs": {
"create": [
{
"key": "Committed",
"type": "horizontalInput",
"templateOptions": {
"label": "Committed"
}
},
{
"key": "Uncommitted",
"type": "horizontalInput",
"templateOptions": {
"label": "Uncommitted"
}
},
{
"key": "Line",
"type": "horizontalInput",
"templateOptions": {
"label": "Line"
}
},{
"key": "Total",
"type": "horizontalInput",
"templateOptions": {
"label": "Total"
},
"expressionProperties":{
"value": function($viewValue, $modelValue, scope){
return scope.model.lineFill+scope.model.uncommitedBPD+scope.model.commitedBPD;
}
}
}
]
}
}
html:
<form>
<formly-for model="vm.myModel" fields="vm.myFields"></formly-form> </form>
I am new to angular formly. I am creating form using angular formly json. Total field should display sum of values provided in Committed+Uncommitted+Line fields. i am using expressionProperties but is not working.
I'm guessing you've moved on from this issue... however...
You are doing two things wrong.
First (1): They key value in the formly field configuration object is setting the value by that name on the model.
So your first field configuration object is:
{
"key": "Committed",
"type": "horizontalInput",
"templateOptions": {
"label": "Committed"
}
},
Then later you try to access that value using the key commitedBPDso you'll always get undefined.
Basically formly is setting the value input in that field on the model object with the key of Committed you need to change the key to match.
Second (2): I could be wrong but I don't think you can use an expression property to set the value like that. Formly will automatically respect value changes on the model so you're better off putting on onChange on the other formly field configuration objects that does the parsing and addition something like this:
{
"key": "Committed",
"type": "horizontalInput",
"templateOptions": {
"label": "Committed"
"onChange": addTotal
}
}...
function addTotal() {
//You have access to the model here because it's in your controller
// NOTE: the parseInput function you'll have to write yourself
vm.model.Total = parseInput(vm.model.Committed) + ...
}
All in all your biggest problem is trying to access the values from the model object with the wrong key
Yes, updating the model does not change form.input.value
The only way I've found is like this:
item.fieldGroup['Import'].formControl.setValue(333.33)

Elasticsearch term filter on inner object field not matching

I have just organized my document structure to have a more OO design (e.g. moved top level properties like venueId and venueName into a venue object with id and name fields).
However I can now not get a simple term filter working for fields on the child venue inner object.
Here is my mapping:
{
"deal": {
"properties": {
"textId": {"type":"string","name":"textId","index":"no"},
"displayId": {"type":"string","name":"displayId","index":"no"},
"active": {"name":"active","type":"boolean","index":"not_analyzed"},
"venue": {
"type":"object",
"path":"full",
"properties": {
"textId": {"type":"string","name":"textId","index":"not_analyzed"},
"regionId": {"type":"string","name":"regionId","index":"not_analyzed"},
"displayId": {"type":"string","name":"displayId","index":"not_analyzed"},
"name": {"type":"string","name":"name"},
"address": {"type":"string","name":"address"},
"area": {
"type":"multi_field",
"fields": {
"area": {"type":"string","index":"not_analyzed"},
"area_search": {"type":"string","index":"analyzed"}}},
"location": {"type":"geo_point","lat_lon":true}}},
"tags": {
"type":"multi_field",
"fields": {
"tags":{"type":"string","index":"not_analyzed"},
"tags_search":{"type":"string","index":"analyzed"}}},
"days": {
"type":"multi_field",
"fields": {
"days":{"type":"string","index":"not_analyzed"},
"days_search":{"type":"string","index":"analyzed"}}},
"value": {"type":"string","name":"value"},
"title": {"type":"string","name":"title"},
"subtitle": {"type":"string","name":"subtitle"},
"description": {"type":"string","name":"description"},
"time": {"type":"string","name":"time"},
"link": {"type":"string","name":"link","index":"no"},
"previewImage": {"type":"string","name":"previewImage","index":"no"},
"detailImage": {"type":"string","name":"detailImage","index":"no"}}}
}
Here is an example document:
GET /production/deals/wa-au-some-venue-weekends-some-deal
{
"_index":"some-index-v1",
"_type":"deals",
"_id":"wa-au-some-venue-weekends-some-deal",
"_version":1,
"exists":true,
"_source" : {
"id":"921d5fe0-8867-4d5c-81b4-7c1caf11325f",
"textId":"wa-au-some-venue-weekends-some-deal",
"displayId":"some-venue-weekends-some-deal",
"active":true,
"venue":{
"id":"46a7cb64-395c-4bc4-814a-a7735591f9de",
"textId":"wa-au-some-venue",
"regionId":"wa-au",
"displayId":"some-venue",
"name":"Some Venue",
"address":"sdgfdg",
"area":"Swan Valley & Surrounds"},
"tags":["Lunch"],
"days":["Saturday","Sunday"],
"value":"$1",
"title":"Some Deal",
"subtitle":"",
"description":"",
"time":"5pm - Late"
}
}
And here is an 'explain' test on that same document:
POST /production/deals/wa-au-some-venue-weekends-some-deal/_explain
{
"query": {
"filtered": {
"filter": {
"term": {
"venue.regionId": "wa-au"
}
}
}
}
}
{
"ok":true,
"_index":"some-index-v1",
"_type":"deals",
"_id":"wa-au-some-venue-weekends-some-deal",
"matched":false,
"explanation":{
"value":0.0,
"description":"ConstantScore(cache(venue.regionId:wa-au)) doesn't match id 0"
}
}
Is there any way to get more useful debugging info?
Is there something wrong with the explain result description? Simply saying "doesn't match id 0" does not really make sense to me... the field is called 'regionId' (not 'id') and the value is definitely not 0...???
That happens because the type you submitted the mapping for is called deal, while the type you indexed the document in is called deals.
If you look at the mapping for your type deals, you'll see that was automatically generated and the field venue.regionId is analyzed, thus you most likely have two tokens in your index: wa and au. Only searching for those tokens on that type you would get back that document.
Anything else looks just great! Only a small character is wrong ;)

Resources