Does not accept a WITH clause - Salesforce - salesforce

When using below SOQL query in Salesforce for working with "WITH filteringExpression" referred from https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_with.htm
SELECT Id FROM Lead WITH Name='YYYYY'
I got below error. May I know why I got this error.
ERROR at Row:1:Column:26
Lead does not accept a WITH clause

WITH is a special filter for something else that would be hard to express in SOQL otherwise. It tries to hide a very complex JOIN operation you'd have to make. What you need is old-school WHERE Name = 'YYYYY'.
WITH is used to effectively retrieve records related to data categories. Categories are bit like picklists but hierarchical. I've never used them outside of Knowledge Base implementations. Imagine having FAQ articles and you want an article about lawnmower care to appear when searching for "Garden Care", "Home & Garden", "Consumer-grade products". That's kind of what that example in documentation tries to convey. Find me articles that are USA-related (which would be a very specific category) but also articles linked to more generic North America.

Related

Creating a Salesforce report on Master Detail relationship

I am trying to create a report on one to many Master-Detail relationships. I need to get results on Opportunity(Master) related to the many financiers(Detail). The financiers have a picklist field that can approve or deny or approve conditionally. Some opportunities can have one financier approved and others denied. some have denied by all the financiers. I need to get results for the opportunities that were denied by all the financiers they have applied for. When I tried to use the filter to show denied financiers I am getting results for opportunities that were denied but some of the results were approved by another financer. How do I run a logic to discard the opportunities that were approved by at least one financier and denied by all the financiers? I know that this can be achieved by creating a new field on opportunity or by creating a custom report using a visualforce page. Which is the more subtle and feasible solution?
This is a SF admin question rather than coding. You might have better luck at https://salesforce.stackexchange.com.
As a rule of thumb - si this report going to be the only place you need this kind of data. For "clean" solution I'd be tempted to make up to 3 rollup summary fields on Opportunity, something like "count all financiers", "count approved", "count rejected". And then your report gets significantly simpler.
But if it's one-off requirement or other reason you can't do rollups (for example reaching limit of rollup fields / not wanting to waste them on something considered trivial) you might still be able to pull it off with report.
I need to get results for the opportunities that were denied by all
the financiers they have applied for
I'd try with something called "cross filter". Try help articles or this might be a good start: https://salesforce.stackexchange.com/a/23697/799
Maybe "Opportunities with Financiers" report, filtered on Financiers.Status = Declined. Plus cross filter saying "Opportunities without Financiers where status != Declined".
Or maybe 2 cross filters. You'll have to experiment a bit.

How to specify multiple entities of different types in AlchemyData News?

I'm trying to query AlchemyData News for articles narrowed by multiple entities of different types (e.g.,both the Company "IBM" and the OperatingSystem "Linux" in the body of the article) without much luck.
I can find or figure out examples for multiple entity texts in the title:
q.enriched.url.title=A[IBM^Linux]
and for single texts and types in the title:
q.enriched.url.enrichedTitle.relations.relation=|object.entities.entity.text=IBM,object.entities.entity.type=Company|
but the combination eludes me.
I'm also unsure of which field name(s) to use when searching the body of the articles instead of just the title.
Unfortunately, top level search ie (IBM & Company) OR (Linux & OS) isn't possible at the time. To get around this you'll have to write to distinct queries. Alchemy is currently working on infrastructure improvements that will enable top level search.
In regards to searching the body you simple need to drop enrichedTitle. in the call.

Database search with a RESTful Web API

I am quite new to REST, but what I want to do is implement a (not that simple) search function to my API. I want to search a database using multiple keywords (e.g. author, booktitle, ...) and different search operators (e.g. ~, =, !=, ...).
What I'm looking for is something like a convention, an example or a "best-practice"-tutorial how to do this in an elegant way in terms of routing parameters etc.
EDIT: Basically I want to know how to include the operators belonging to each keyword in the URL in a nice way.
First check the URI template standard. If it is enough for you, and you can solve your problem with multiple links, then you got luck.
If not, then you have to send back some structure description about your search queries. First you have to choose a query language. It is probably better to choose a standard query language, so you don't have to create a new one. After that you have to send back some semantics (probably in RDF) about the constraints of your search queries. For example you can search for words in the articles titles and order the results by dates, and so on... this kind of stuff... So the client can generate the query using the details of the query language, the constraint descriptions and the user input.
After the query was synthesised by your client, you can send it in the following formats:
GET /blah?q="query details" - the query string serialized in a single query param, (the query language can be anything)
GET /blah?query=x|details=z - using an URI query language
SEARCH /blah ... - sending in the SEARCH body with the proper MIME type (the query language can be anything, but be aware that caching is probably not supported by the SEARCH method, because it is an old webdav method with not maintained standard)
So the key problem that we don't have currently a standard or an RDF vocab to describe the query structure for the client, and thus sending a query link will probably violate the self-descriptive constraint and couple the client to the service implementation. (By most of the current APIs the client reusability and fulfilling the REST constraints is not a concern.)

Quickbooks Data Schema?

I'm trying to develop a simple app for my staff to log their time and expenses on a remote (access) db, and then sync that with QuickbooksPro. I have managed to get QBFC to work, my problem now is understanding the underlying database structure (field names etc) in Quickbooks - e.g. so I know which elements to add to queries etc.
I have found the following (EntityRef, CustomerRef) by trial and error, and by looking at a table pulled using QOBDC; however, there must be documentation of this somewhere - anyone know where?
TimeDataQry.IncludeRetElementList.Add("EntityRef")
TimeDataQry.IncludeRetElementList.Add("CustomerRef")
TimeDataQry.IncludeRetElementList.Add("TxnDate")
TimeDataQry.IncludeRetElementList.Add("BillableStatus")
TimeDataQry.IncludeRetElementList.Add("Duration")
TimeDataQry.IncludeRetElementList.Add("TimeModified")
to be honest, the actual QB data schema is horrible - huge and confusing. It's not worth trying to figure out how to interact directly with their API. That's one of the reasons people like QODBC created simpler ways to interact with it. Have you purchased QODBC?
I've created apps using QODBC and RSSBus, and I like RSSBus better. There are many reasons, but for starters, QODBC is actually a driver that uses DNS's, which can be confusing and have to be set up on each computer that you want to use this on whereas RSSBus does not have any of that. What QODBC and RSSBus do is wrap the QB db in a sort of sqlserver-like db, so any table structures you pull from the QODBC tool will most likely have no correlation to anything you could use through QBFC.
I prefer RSSBus now, but here are links to documentation for both:
RSSBus - http://www.rssbus.com/kb/help/RQR3-A/pg_imetracking.rst
QODBC - http://doc.qodbc.com/qodbc/Qodbc_20_us.html
Also, this SO question may help - QuickBooks QBFC explanation. Notice that he says there are 300+ pages of documentation for this. A little too much imo.
Use the QuickBooks OSR (it works best in Chrome):
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Choose the request/object type you're dealing with from the "Select Message" drop-down, and click on any of the nodes to view documentation on the node.
For example, what you posted above looks like you're looking at Time Tracking entries. Here's what you get from the OSR about EntityRef:
Entity
A QuickBooks "entity" is a customer, vendor, employee, or
person on the QuickBooks "other names" list. Special cases to note:
In a BillToPayQuery message, EntityRef refers to the vendor name.
In
JournalCreditLine and JournalDebitLine messages for A/R accounts,
EntityRef must refer to a customer, or else the transaction will not
be recorded. For A/P accounts the EntityRef must refer to a vendor, or
else the transaction will not be recorded.
In a TimeTracking message,
EntityRef cannot refer to a customer, only to an employee, vendor, or
person on the "other names" list whose time is being tracked.
Pretty simple, pretty detailed.
It's also worth noting that the QuickBooks APIs almost exactly mirror the QuickBooks GUI. For example, when creating an invoice in the QuickBooks GUI, you'll see fields like:
Customer
Date
Invoice #
Item
PO Number
And then if you look at InvoiceAdd in the API, you'll find these fields:
CustomerRef
TxnDate
RefNumber
ItemRef
PONumber
It shouldn't be terribly difficult to put two and two together and figure out that these fields match the fields presented in the GUI.
Here is the QODBC documentation on table schemas:
All Tables.
If you want specific US related table groupings like Customer and AR then check here:
Tables by Group

Learning to query UniData

We have an IBM UniData server. I just installed UniObject .net. It looks like you just issue unidata queries through the .net classes.
Where can I learn the query language/syntax and to work with UniData in general? What books, sites, or videos do you recommend?
The best resource is going to be Rocket Software's UniData library.
Rocket recently acquired the U2 family of products, which includes UniData and UniVerse, from IBM. They've got a pretty extensive catalog of documentation for UniData. You might want to check out the "Using UniQuery" document, which discusses the UniQuery in particular.
Unfortunately, you won't find many books, screencasts, or programming communities devoted to UniData because it's pretty esoteric. If you run into anything specific that you've got questions on, it can't hurt to post here using the UniData tag and I'll do my best.
You can find a lot of information on the U2UG (U2 User Group). There is a learner pack:
http://212.241.202.162/cms/cmsview.wsp?id=learner_pack
This will help.
International Spectrum has webinars that cover the Query language, and can put in touch with a trainer if you are interested:
http://www.intl-spectrum.com/
Besides the Using UniQuery document, the UniQuery Commands Reference is also useful.
The general structure of the query is
verb table filter order display
SORT CUSTOMER IF HATSIZE = "7" BY SHOESIZE NAME CITY STATE ZIP
Where
verb = SORT
table = CUSTOMER
filter = IF HATSIZE = "7" (you can have multiple filters
order = BY SHOESIZE (you can have multiple order elements)
display = ID NAME CITY STATE ZIP (ID isn't on the list, but it is implied)
For this to work, the TABLE (also called a FILE) named CUSTOMER has to exist.
CUSTOMER must have a dictionary (schema/view repository) which defines HATSIZE SHOESIZE NAME CITY STATE and ZIP.
A more coherent example:
SORT CUSTOMER IF ORDER.LIMIT > "12,000.00" AND WITHOUT STATUS "INACTIVE" BY-DSND ORDER.LIMIT BY ZIP ORDER.LIMIT ZIP NAME STATUS
Which would select CUSTOMERs with $12K or more ORDER.LIMIT who are not INACTIVE and sort them form biggest limit to least... you get the idea.

Resources