How to get the parent object field from Task standard object using relationship query. select whatid,what.Email__c from Task. Its showing error. How can I get the email field from various object which is related to Task. If anyone knows help.
Assuming What is a Custom field. Following line will work. __r is usd to refer to parent object.
select whatid ,what__r.Email__c from Task
The solution :
select whatid ,what__r.Email__c from Task
is wrong.
Try this : Select TYPEOF What When Case Then Email__c END from Task
See polymorphic relationships : http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_relationships.htm
Related
I am using mobile application i.e Appcenter for recording customevents AzureLogportal.
I am trying to fetch the records by using custom query.
Inside customDimensions Object of array i.e Properties i stored.
Properties = {"1":"Studentname","101":"id","John":"Title"}
I am trying to fetch all the records for title : John in the properties.
Query i tried is :
customEvents
|where customDimensions.Properties.TopicTitle == "John"
But it dont give any result.Please help.
if Properties within customDimensions is a property bag, then the bottom note in this document should have the answer
https://learn.microsoft.com/en-us/azure/kusto/query/parsejsonfunction
Notes
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. For example:
let d='{"a":123, "b":"{\\"c\\":456}"}';
print d
In such cases, it is not only necessary to invoke parse_json twice, but also to make sure that in the second call, tostring will be used. Otherwise, the second call to parse_json will simply pass-on the input to the output as-is, because its declared type is dynamic:
let d='{"a":123, "b":"{\\"c\\":456}"}';
print d_b_c=parse_json(tostring(parse_json(d).b)).c
I've extended the SalesTableListPage to include a new column taken from a display method on CustTable now my users are getting the error:
The required QueryBuildDataSource was not found in the Query associated with the FormDataSource . The QueryBuildDataSource should have the same name and table ID as the FormDataSource.
To gain access to the display method I had to:
Add CustTable to the SalesTableListPage Query
Re-Select the SalesTableListPage Query on the Data Sources node of the SalesTableListPage Form.
Add a new StringEdit on the grid and set it to CustTable CityName_BR
I can't replicate this error with my admin or my non-admin user and I don't understand where this error comes from.
One post says that if you have a Query on the menu item that opens the Form then that query needs the same data sources as the query on the form. But I don't have a query on my menu item
Other suggestions state that I need to add the new data source "in the Table related queries". I am unaware of such a setting in AX 2012
Other suggestions refer to queries written in code. mine are AOT queries
Update: It seems the reason I wasn't getting the error was that I had the CueGroup EPCustRelatedInfo or just CustRelatedInfo collapsed. When I unfold this part I am getting the error as well.
Resolving that Cue Group has led me to several menuitems with queries attached. The culprit seems to be the SalesTableListPageOpen menu item and query of the same name (which references the query I have changed).
I am however still confused as to how to actually fix the error since the SalesTableListPageOpen query just says Composite Query\SalesTableListPage. Unsetting/resetting the referenced query, restoring and re-compiling the query has not had any effect...
I think one of your suggested solutions is probably correct. Just investigate the query though and you should be able to figure out what's happening.
At the bottom of \Classes\SalesTableListPageInteraction\initializeQuery just put:
info(_query.toString());
Then open the menus All sales orders and Open sales orders and you'll see the query differences. Then repeat opening various menu items with different users and see what results.
You may need to move the location of the info line, but the concept is there.
I am using Symfony3 framework, and I have user entity, and file entity. I wanted to present in sonata administration user list with sum of all size files which are uploaded by user. When I want to make that field sortable I am getting error:
`Catchable Fatal Error: Argument 1 passed to Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery::entityJoin() must be of the type array, null given, called in /home/milos/sites/coinaphoto/vendor/sonata-project/doctrine-orm-admin-bundle/Datagrid/ProxyQuery.php on line 143 and defined`
I have custom function in User entity which is calculating sum of files. It returns string.
My question will be can I somehow pass dql to criteria in order to get sum. Or can you suggest some other way to implement this?
` public function getStoragge(){
$criteria = Criteria::create()
->where(Criteria::expr()->someexpression...);
$matches = $this->file->matching($criteria);
}`
Something similar like when you need to aggregate fields
` $dql = "SELECT SUM(e.amount) AS balance FROM Bank\Entities\Entry e " .
"WHERE e.account = ?1";
$balance = $em->createQuery($dql)
->setParameter(1, $myAccountId)
->getSingleScalarResult();`
I don't know about your dql thing, but some fact about sorting in Sonata Admin table views. The problem is, that sorting actions still be made in the background with database operations, no matter what you are doing "virtual" in your model. If you are adding just a method to your model, the datagrid is not able to involve this method/property in sorting.
My experience is, that you can't sort by fields which are not physically available in the corresponding table. Even if you write the whole query for yourself, if you click on the sort buttons, a complete other query is fired which is ignoring your request.
I'll be pleased if somebody tell me the contrary ...
See also this issue https://github.com/sonata-project/SonataAdminBundle/issues/1077
I'm trying to make a query against the table HcmWorker and related.
But i want to figure out how to get the result of the display method HcmWorker.primaryDepartmentName() into it's own field in my query.
I also tried creating a view to execute the function via a ViewMethod but that doesn't seem to work as ViewMethods only inject code into the final query against the view.
I'm NOT making a form. The end result has to come through the QueryService.
Sorry, but what you are trying to do is not possible.
You could calculate a non stored field in the postLoad method, but that would impact every access to your table, and it would most likely not work in the context of a query service.
I am trying to query the relationship "Assigned_To__r" within the "Case" object, so I can return the Name of the User that is currently assigned to the case.I have tried many different syntaxes, and read many different web pages on this, but can't seem to figure it out. Here is my current syntax that isn't working, but as I said, I've tried many different combinations
Please help.
`select Id,CaseNumber,Subject,(select Name from Assigned_To__r)
from Case
where Closure_Code__c <> 'Invalid Support Case'
and Closure_Code__c <> 'Duplicate Case'
and Closure_Code__c <> 'Spam''
This is the error I am getting:
INVALID_TYPE:
CaseNumber,Subject,(select Name from Assigned_To__r) from Case where
^
ERROR at Row:1:Column:48 Didn't understand relationship
'Assigned_To_r' in FROM part of query call. If you are attempting to
use a custom relationship, be sure to append the '_r' after the
custom relationship name. Please reference your WSDL or the describe
call for the appropriate names.
Your SOQL has a few formatting issues.
If you can clarify how the Assigned_To__c custom field relates to a Case, I can be a bit clearer in how to help solve your problem. However, based upon my best guess of your situation (specifically, Closure_Code__c is a standard picklist and Assigned_To__r is a custom child-to-parent relationship field on the Case), I'll wager your desired SOQL looks something like this:
SELECT Id, CaseNumber, Subject, Assigned_To__r.Name
FROM Case
WHERE Closure_Code__c NOT IN ('Invalid Support Case', 'Duplicate Case', 'Spam')