Can't get from CUSTOMERS table by CUST - priority-web-sdk

I'm trying to get data from CUSTOMERS table by CUST field, but I get a 404 error. Here is the requesting endpoint:
I priority web there is no problem to get customer by this id…
Anyone can help?

After you get the customer with $filter, you'll know its id ("CUSTNAME"), so you'll be able to do all the updates needed using it instead of "CUST"

You can use $filter in order to get the requested customer by CUST
Try the following:
/CUSTOMERS?$filter=CUST eq 1217
More information and examples can be found in the API documentation on github

can you try using /CUSTOMERS('1217') instead of /CUSTOMERS(CUST=1217)


SOQL Query Like Operator not returning results

I have ran into what seems to be a SOQL issue in either: query syntax or I've discovered a bug. I state that this might be a either a query syntax issue or a bug based on the premise that I've searched for clues and I've found nothing.
Anyways, I have created a custom view. This custom view is titled "Leads Test Cadinal". In this, I have added only 1 contact. I've populated the company field with "Cadinal Inc".
Now what I'm trying to do is fetch that contact with the company name "Cadinal Inc" (for that particular view obviously). When I execute the SOQL I get no hits returned from Salesforce despite the contact existing in the list.
Now onto the more techincal details:
I invoke the describe query in order to find the query that I want to execute to get that particular contact out. This is the query I receive after invoking the describe call
Name, Company, State, Email, toLabel(Status),
CreatedDate, Owner.Alias, IsUnreadByOwner, Id, LastModifiedDate,
SystemModstamp, Owner.Id, OwnerId
IsConverted = false AND
Company like '%Cadinal%'
When I receive the query from the describe call, the query that I will use to fetch the contact in the list is the following:
/services/data/v38.0/query?q=SELECT id , email, Company FROM Lead WHERE IsConverted = false AND Company like '%Cadinal%' ORDER BY Name ASC NULLS FIRST, Id ASC NULLS FIRST
Now what I am confused in is why the query fails to fetch the record? My hypothesis is that Salesforce keeps
As a reserved word. I do not know why this query fails, can someone point me in the right direction on how to correctly query this.
The following is a screen shot of my sample lead:
Thanks, looking forward to some responses.
Please URL Encode the SOQL Query before making the REST call. Something like below should work :
Reference :

Netsuite bug when creating customerdeposit record

Im trying to create a customer deposit record in Netsuite using suitescript 1.0.
The original code I had in place which had been working perfectly up until the 2016.2 release broke it.
The update broke it, in that it would override the value submitted in the payment field and instantly make it the full amount of the sales order from the sales order ID. Which is not what we need it to do.
Original Code
function createDeposit(request,response)
var record = nlapiCreateRecord('customerdeposit');
record.setFieldValue('memo','this is a test');
deposit = nlapiSubmitRecord(record,true,false);
After a reply on the Netsuite user group prompted me to use the {recordmode:'dynamic'} attributes I am getting a strange error..
Test Replacement Function which doesnt work
function createDeposit(request,response)
var record = nlapiCreateRecord('customerdeposit',{recordmode:'dynamic'});
record.setFieldValue('memo','this is a test');
deposit = nlapiSubmitRecord(record,true,false);
The error message Im getting now is
Invalid salesorder reference key 1260 for customer .
The thing I dont get is how it is now considered NULL, when the value is hardcoded into this test script after I apply the {recordmode:'dynamic'} value.
Ive tried a wide variety of things, but as I dont have Netsuite support, its proving to be something I simply cant figure out.
Any hints, suggestions would be greatly appreciated as Ive been on this for several days
When you use dynamic the order you set fields makes a difference. So when you set the sales order prior to setting the customer you are actually getting the error message "Invalid salesorder reference key 1260 for customer blank"
What I do is create the customer deposit like:
var depRec = nlapiCreateRecord('customerdeposit', {entity:soRec.getFieldValue('entity'), salesorder:soId});
also setting the undeposited funds flag seems to be required (but not always for some reason) so since you are supplying an account id also do this:
depRec.setFieldValue('undepfunds', 'F');

MDX Query to get employee ID based on their login ID

I'm trying to implement dynamic security on a cube where an employer should be able to see the measures associated with all the employees under him.
I'm doing this by first getting the login credentials of the logged in user using USERNAME() and then getting the descendants of that user.
However , I'm having an issue because the descendants in the employee dimension are defined on empID attribute whereas the USERNAME() gives the login ID attribute.
I'm not able to use descendants function on Login ID attribute.
{DESCENDANTS(STRTOMEMBER("[Employee].[Emp ID].&[3]"), , SELF_BEFORE_AFTER)} works but
doesn't work.
So , how can I get the empID attribute based on the login ID ?
Any ideas please ?
There are multiple solutions for achieving this. One of the solutions is to set LoginID as NameColumn for [Employee].[Emp ID] attribute and then use the following query.
{} ON 0,
[Employee].[Emp ID].MEMBERS,
ON 1
FROM [Your Cube Name]
Yeah I'm using roles , I was just trying to make up a query first in ssms and then put it in the roles allowed set. Btw , I managed to achieve what I was trying to by using name column just like Akshay mentioned. I set Login ID as the name column and instead of using & operator used . operator in my query. It works. Thanks.
This should be done via a dynamic Role, not in a query.
Using a role will lock in the user and when looking at empID they would only see numbers for those that are mapped to their login.
This is one of the better explanations for this concept:
Another reason to fix this in the cube role is that your data is not secure if you just do it via query. Anyone will be able to connect to the cube via excel and browse all emploee data.

StructureGroup Details using the Content Delivery/Broker API

I am trying to get all the structure groups published in a given publication using the PublicationID. I am expecting to get the structure groups with StructureGroupCriteria by passing the Root Structure Group TCM ID but getting page ids (I am expecting SGs).
Now I am trying to loop through the list and get details of each structuregroup. I did not find any API (.net) to get these details and also the API is returning only Pages.
What I have done and working so far using StructureGroupCriteria, returns list of Page IDs instead of SG IDs
PublicationCriteria pubCriteria = new PublicationCriteria(pubID);
// Root StructureGroup TCM ID -- tcm:45-3-4
StructureGroupCriteria sgCriteria = new StructureGroupCriteria("tcm:45-3-4", true);
Criteria allSGsInPub = CriteriaFactory.And(pubCriteria, sgCriteria);
Query allSGs = new Query(allSGsInPub);
string[] sgInfo = allSGs.ExecuteQuery();
Response.Write("Total : " + sgInfo.Length);
foreach (string sgid in sgInfo ) {
// HOW DO I get the Structure Group Details here
//TCMURI sgURI = new TCMURI(sgid);
Q # 1 : How to get the all the structuregroups and individual structure group details? (May be something simple, I am not able to find right API).
Q # 2 : How can I get all the structuregroups using ItemTypeCriteria sgCriteria = new ItemTypeCriteria(4); // 4 is SG Item Type .
When I tried this option, the query worked successfully but no results returned. Is this the expected behavior and should we always use StructureGroupCriteria instead of ItemTypeCriteria?
The reason for this approach, I want to avoid using the Root StructureGroup ID which is required with the above code. But at the moment, none of the approaches returning StructureGroup information and I always get Page Information.
Tridion Version: 2011 SP1, .net API.
Note: When I publish I am checking the publish SG info checkbox and published successfully. On Broker DB side, I can see the information on the taxnonomy table as well.
I was playing with Odata service and accidentally I found that I can get all my structure group information from Odata web service.
Also, the results are returning child structure groups with a depth parameter.
Just to clarify , using Broker API it is not feasible to get the structure groups (my original question). However, the workaround solution is to use OData Service to get the Structure Groups.
I don't think you will get Structure Groups returned by the Query object.
According to the documentation, when you publish Structure Group information the Structure Group hierarchy is published to the Content Delivery side where it is stored as a taxonomy.
Have you tried using the Taxonomy APIs to get the information you need?

Find the name and email address of non-members who used coupon code in Magento

We would like to be able to pull the name and email address of customers who purchased items as a guest. Has anyone had any luck in doing so?
I've seen a few posts of how to pull the names of customers who have used the coupon code, but nothing about non-customers!
Thank you guys very much for your help!
This should work:
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('customer_group_id', Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
You can then access the values by iterating over the collection...
foreach($orderCollection as $order) {
$customerFirstname = $order->getData('customer_firstname');
$customerLastname = $order->getData('customer_lastname');
$customerEmail = $order->getData('customer_email');
//Do what you want with the values here
The above code answers the first paragraph of your question. The second paragraph suggests you are looking for something different though. Are you looking for guest customers who have used a particular coupon code? If so then you should load the collection like this:
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('customer_group_id', Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
->addAttributeToFilter('coupon_code', 'your_awesome_coupon_code')
Drew gave me a SQL statement for names and emails of the existing customers in another similar post. To get all orders including registered users and guests you can use this SQL:
SELECT `customer_firstname`, `customer_lastname`, `customer_email` FROM `sales_flat_order` WHERE `coupon_code` = 'your_awesome_coupon_code'
Worked like a charm! Double-checked in 'salesrule_coupon' and the rows returned in the sql matches the number of times the coupon was used.
I will leave Drew's answer marked as correct, since it is probably better to do it in magento. Anyone looking for the SQL though, use this one!
The SQL statement for registered users only can be found here: How can I see full order details for each time a certain coupon code was used in magento?