Within Logic Apps trying to set a Dynamics 365 field to 'null', which effectively clears out the DateTime offset. (see attached image)
Code View looks like the following:
...
"body" : {
"delayuntil" : null
}
...
Logic Apps designer, tries to set the field as follows:
...
"body" : {
"delayuntil" : "null"
}
...
But, this is incorrect, as I need it to be null
Help?
Related
When I use the dataverse connector 'create a row (preview)', I can create a row in the table 'Account' with the field 'primarycontactid' null. When I try do this with 'update a row (preview)' however, I get an error:
{
"error": {
"code": "0x80060888",
"message": "The supplied reference link -- -- is invalid. Expecting a reference link of the form /entityset(key)."
}
}
this is the body:
"body": {
"name": "Test2",
"primarycontactid#odata.bind": ""
}
When I adjust the code itself to "primarycontactid#odata.bind": null, it works.
but i need to have something like this (so this works on create, not update):
"primarycontactid#odata.bind": "#{if(empty(body('Get_Contact')?['value']),null,concat('contacts(',body('Get_Contact')?['value']?[0]?['contactid'] ,')'))}"
I tried filling it with null, with empty quotes, with contacts(00000000-0000-0000-0000-000000000000) but nothing works.
After reproducing from my end, I have received the same error but after following the below process, I could able to update the field with null value. Below is the flow of my Logic app.
In my codeview
"body": {
"crc76_primarycontactid": "#{null}"
}
Results
Before updating
After updating
I am looking for way to get fields and picklists for a salesforce object. I can do it with a REAT API call using /describe after the object name. But sometimes the returned JSON data is really big with 95% extra data I don't want, with repetitive pattern strings.
This would be too inefficient to pull all that data, which could actually be as large as 2.8Mb, just to get small info I require.
How can I query query filter this data to get more specific results? Or is there a better way to get picklists for a field, or any other sub data from that big json at /describe?
Here is what I am using currently
https://[myinstance].salesforce.com/services/data/v51.0/sobjects/Casedata/describe
You can query FieldDefinition table in Tooling API, for example
/services/data/v52.0/tooling/query?q=SELECT+Metadata+FROM+FieldDefinition+WHERE+EntityDefinitionId+=+'Account'+AND+QualifiedApiName+=+'Status__c'
(...)
"valueSet" : {
"controllingField" : null,
"restricted" : true,
"valueSetDefinition" : {
"sorted" : false,
"value" : [ {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "Prospect",
"urls" : null,
"valueName" : "Prospect"
}, {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "Live",
"urls" : null,
"valueName" : "Live"
}, {
"color" : null,
"default" : false,
"description" : null,
"isActive" : null,
"label" : "Cancelled",
"urls" : null,
"valueName" : "Cancelled"
}
(...)
The picklist values will be in the Metadata field but to query it you need to ensure only 1 row is returned. So if you need 3 picklists - that's 3 API calls...
It'll return the "master" picklist, not filtered by record type.
There's also interesting table called PicklistValueInfo. It's not described too well, it's a related list to EntityParticle. You can query to get multiple picklist values in 1 go
SELECT DurableId,EntityParticleId,IsActive,Label,Value
FROM PicklistValueInfo
WHERE EntityParticle.EntityDefinition.DeveloperName = 'Account' AND
(DurableId LIKE 'Account.Industry%' OR DurableId LIKE 'Account.Type%')
ORDER BY DurableId
Or use it related list style (which might be closer to results of describe call?)
SELECT DataType, FieldDefinition.QualifiedApiName,
(SELECT Value, Label FROM PicklistValues)
FROM EntityParticle
WHERE EntityDefinition.QualifiedApiName ='Account'
AND QualifiedApiName IN ('Industry', 'Type', 'Status__c')
If you use record types - UI API David linked to is easiest.
https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values_collection.htm
You can grab them all
/services/data/v52.0/ui-api/object-info/Account/picklist-values/012...
Or build links like shown on the screenshot to get data for single field.
The only other API that might be applicable to your use case is the UI API, which is intended to provide the information a client would need to render the UI for a record or object. For example, the Get Object Metadata endpoint might (or might not) suit your needs. Its response body is also not particularly small.
You cannot filter describe data. You're already using the smallest-scoped version of that API.
If you are puzzled which recordTypeId to use in UI API query you can try 012000000000000AAA as specified in this sample request
Record type Id. Use 012000000000000AAA as default when there are no custom record types.
Works well in my case where I do not have Record Types created.
Is there a possibility to "override" the equality check of the generated property setters?
I like to have a (integer) property that can distinguish 0 (zero) from -0 (negative zero).
For example this:
qx.Class.define("io.Dummy",
{
extend : qx.core.Object,
properties :
{
value : {
check : "Integer",
nullable : true,
init : null,
event : "changeValue"
}
}
});
so that following code will fire 3 events (instead of only 1):
var dummy = new infodesk.Dummy();
dummy.addListener("changeValue", function (e) {
this.info("changed!");
}, this);
dummy.setValue(-0); // <= changed!
dummy.setValue(-0);
dummy.setValue(+0); // <= changed!
dummy.setValue(+0);
dummy.setValue(-0); // <= changed!
dummy.setValue(-0);
When I "patch" the equality-checks in the framework (qx.core.Property's __emitXxx methods) by replacing code like "if (a===b)" with "if(Object.is(a,b))"[1] it works,
...but it would be nice if there's a nicer -more clean- way of doing this.
Maybe this is a feature request?
For a property definition attribute like "compare" (Function) or "altCheck" (Boolean)?
properties :
{
value : {
check : "Integer",
nullable : true,
init : null,
event : "changeValue",
altCheck : true // 'alternative check enabled'
// rsp.:
compare : function (a, b) { return Object.is(a, b); }
}
}
[1] ECMA-Script 6
As qooxdoo does not offer the functionality of defining a custom value comparer, please open an issue at the github issue tracker at https://github.com/qooxdoo/qooxdoo/ .
I think the idea of having a compare attribute which allows to define a custom comparer is a good idea. If the compare attribute is omitted, the default comparer should be used.
The best way of getting the functionality you need into qooxdoo is to create a pull request which implements the feature, accompanied by unit tests.
I copied the code you mentioned above and found that "changeValue" event happened only once, not 3 times! I use Qooxdoo Playground v5.0.1, Firefox 47.0, Win7.
What's wrong?
You can solve the problem by using the transform key of qooxdoo property, saving the data as string instead of an integer.
Just started using ATK4 and appreciating it very much so far, but not sure how to do this...
What I am trying to accomplish:
I am outputting a query's results to a grid, one of the fields is 'status', the data will either be '-1' or '1'.
Instead of outputting -1 or 1 to the column, how do I output an HTML snippet (or whatever I need to to get what I want) instead that shows a different icon for each value?
In short:
In column 'status':
if the value is -1, display iconDown.gif;
if the value is 1, display iconUp.gif
Code so far:
class page_showlist extends Page {
function init(){
parent::init();
$q=$this->api->db->dsql();
$q->table('remote_system')
->join('customers.id','customer_id')
->field('customer_id')
->field('ip')
->field('nickname')
->field('name','customers')
->field('status')
;
$grid = $this->add('Grid');
$grid->addColumn('text','status')->makeSortable();
$grid->addColumn('text','name')->makeSortable();
$grid->addColumn('text','ip');
$grid->addColumn('text','nickname');
$grid->addButton('Reload Grid')->js('click',$grid->js()->reload());
$grid->addQuickSearch(array('name'));
$grid->setSource( $q );
}
}
Any pointers/tips?
To add column with icons in Grid you can use custom template.
In one of my projects I do like this:
$url = $this->api->pm->base_url . $this->api->locateURL('template', 'images/');
$grid->addColumn('template', 'type', false)
->setTemplate('<img src="' . $url . 'icon_object_<?$type?>.png">');
It'll use model field named type (in your case use status) and show icons in that column. Icon source URL is generated dynamically and it'll search for image files in your template/images directory named icon_object_XXX.png where XXX value will be taken from field type value.
In my case type is like this: array('building','apartment','land','garage') etc.
And one more thing - you should start using Models whenever possible! That way you'll ease your life later when your project becomes bigger. Also can have extra security (conditions, etc.) with them.
I have been trying out backbone.js and have been stymied when I create a new model object then call model.save(). I am expecting the backbone.js default behavior to update the model object with the id from the database but it is not. Is this not supposed to happen? I have verified that I am getting a post with the attributes in json format. My server saves the json to a table and then returns the json with a new id field to backbone.js. Is this correct? Should my server return the entire new object or just the id or what?
//contents of the POST from backbone.js
{ "text":"this is a test" }
//reply from my server
{ id:"15", text:"this is a test" }
My sample code is below
var SQLRow = Backbone.Model.extend({
table:"",
urlRoot:'db',
url:function () {
return "/" + this.urlRoot + "?table=" + this.table +
"&id=" + this.attributes.id;
}
});
var Xtra = SQLRow.extend ({
table:'Xtra'
});
var row = new Xtra({
text: "this is a test"
});
alert(row.url());
row.save()
alert("row:" + row.get("id"));
Tough to tell from your post. Two ideas :
1) the response from the server isn't successful What does your save call return ?
2) Your "id" attribute is named something other than ID. To account for the different name add the following to your model :
idAttribute : "MyModelsID",
EDIT
You're likely facing a timing issue, where the alert fires before the ID has returned. Instead of your last two lines try this :
row.save( null,
{
success : function(model, response) { alert(model.get('id'); }
}
);
ALTERNATIVE
As #mu_is_too_short mentioned, another way is to listen for the change even on the model and respond to the event. (i was just trying to keep the answer as close to your code as possible). But something like the following pseudo code should get you started...
var myView = Backbone.View.extend({
....
initialize : function () {
this.collection.bind('change', this.SOME_LISTENING_FUNC );
}
});
OR, if you're in a collection/view-less world something like this creates a listenr ...
row.on('change', function() { /* do stuff */ }, this);
This answer is based on one comment of Cjolly in the answer above.
It is essential for making the Backbone.Model.save([attributes],[options]) successful in assiging the model with the newly generated model's id from the server, that the server returns the model's id in a JSON string like this { "id" : <the id> }. (note it is "id" and not id).
In essence backbone rightly expects a JSON string and in contrast to how objects may be defined in Javascript without quoted keys, JSON requires the object keys to be quoted (see JSON Spec - does the key have to be surrounded with quotes?)
Since according to Cjolly's comment this has been the essential problem, I want to hightlight this solution in an second answer. Partially because I was hit by the very same problem and only by reading througth the comments I was able to receive the insight.
I've faced the same issue and what I've found is that my validate function of the saved model actually invalidates the model returned from the back end. That's why my fields were not updated properly.
Maybe its a little outtimed, but today I had the same missing id.
It turns out, that the server just sends a Header 'Location' with a redirect containing the new id, but dosen't return the persisted object.
Adding the object to the response was the solution.
It seems, that not returning the object is standard behavier with Roo(Spring) generated Json-Controllers.