NetSuite REST API with Postman: Record not found while using Suiteql - postman

I'm trying to query some records like vendor and customer using suiteql with REST API using Postman.
The issue is that it return everytime the same error:
"Invalid search query. Detailed unprocessed description follows. Search error occurred: Record 'customer' was not found."
I tried:
differents syntax like Customer, CUSTOMER, customers, Customers, CUSTOMERS
but no change.
I added customer access to the role.
Is there something to activate while using suiteql with rest api?

Can you first try with select * from customer and see if any results are returned and then go on appending your conditions like date created greater than this year start

SELECT id, companyname, email, datecreated
FROM customer
WHERE datecreated >= BUILTIN.RELATIVE_RANGES('TFY', 'START')
AND datecreated <= BUILTIN.RELATIVE_RANGES('TFY', 'END');

NetSuite doesn't say it but for a record to be searchable, the user needs to have the following permissions:
Transactions:
Find Transaction
All the records needed
Lists:
Perform search
All the records needed
Setup:
REST WEB Services
Log in using Access Tokens or Oauth 2.0
Reports:
SuiteAnalytics WorkBook

Related

Can't Get 1:m VTiger Relationship to Show on "1" Side

I am trying to implement a 1:m relationship between Contacts & Service Contracts in VTiger 6. We will use the relationship to track Users of our system. Each Contact should only be allowed to be link to 1 Service Contract at a time (1:m).
I was able to get the ServiceContract side of this working by using the following code:
require_once 'vtlib/Vtiger/Module.php';
$scmodule=Vtiger_Module::getInstance('ServiceContracts');
$scmodule->setRelatedList(Vtiger_Module::getInstance('Contacts'), 'Users',Array('SELECT'),'get_related_list');
This added a tab on the right side of Service Contracts titled "Users" with a SELECT button and allows us to ADD/REMOVE Contacts from the list.
However, what we would also like is to have a field on the Contacts page that shows which Service Contract they are linked to.
UPDATE:
I used the following code to add a single Service Contract field to Contacts:
`
include_once('vtlib/Vtiger/Module.php');
$module = Vtiger_Module::getInstance('Contacts');
$blockInstance = Vtiger_Block::getInstance('LBL_CONTACT_INFORMATION', $module);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'SelectYourAccount';
$fieldInstance->label = 'Account';
$fieldInstance->uitype = 10;
$fieldInstance->typeofdata = 'V~O';
$blockInstance->addField($fieldInstance);
$fieldInstance->setRelatedModules(Array('ServiceContracts'));`
The above code worked fine and I have an Account field in contact details that I can link to a single Service Contract; however, when I select a Service Contract for a Contact and then go to the Users list on the Service Contract, the Contact isn't listed.
Any help would be greatly appreciated!
What i understand from your Question is that Contact is your "1" module and Service Contract is "M(Multi Record)" module. Which means 1 Contact will have multiple Service Contract. So in vtiger Service Contract Related List is already given under Contact Module.Please check this image below.
Next in Service Contract you will have Option to select Contact so that Contract will be liked with "1" Contact. See Screenshot here.
I Hope you will get clear picture after reading this of Relation in Vtiger.

Sitecore ECM op-tin and opt-out roles dates

I want to know is there any way to get user subscrition / unsubscrition to email campaign ?
Is it saved in one of databases/tables in MSSQL ?
If you use the approach with opting in and out being determined on the fact if user is in role, then it is stored in the aspnet_UsersInRoles table in your core database. This table does not keep the information when role was assigned to the user. That's why you cannot get information when user subscribed or unsubscribed to email campaign.
The only thing you can check is if user is in the role:
user.IsInRole(roleName)
The user's subscription is driven by the users role, but It is possible to get the users subscriptions in ECM, You just have to use the api.
You can get the contact from the email address:
string fullName = commonDomain + "\\" + Util.AddressToUserName(username);
var contact = Contact.FromName(fullName);
var subscriptions = contact.GetSubscriptions();
Once you have a contact you can call the GetSubscriptions() method which will return the recipient lists the user is signed up to. There are a host of other methods you can call on a contact and if there is a a way to get the date unsubscribed/subscribed it will be here.
If not reflect Sitecore.EmailCampaign.dll and keep looking! There might be some extra information in the automation states table in the Analytics database. More info on automation state here:
https://www.sitecore.net/learn/blogs/technical-blogs/sitecore-magnified/posts/2013/09/ecm-automation-states-magic.aspx
Also noticed there is a method GetUnsubscribersStatistics on the Sitecore.Modules.EmailCampaign.Core.Analytics.AnalyticsHelper class. This will have the date of unsubscription.

List of users who registered in the same month as the logged user

I need to create a custom module which shows a list of users who registered in the same month as the logged user.
You have to start with learning how to create a joomla module.
Then to get familiar with joomla database functions.
Once you create the module, you have to get the active user using current user object.
Next step is to run a query to #__user_profiles table to get the active user register date. The query will be like:
SELECT `registerDate` FROM `#__user_profiles` WHERE `username` = $user_id
And then run a second query to get all users registered the same month as active user:
SELECT `username` FROM `#__user_profiles` WHERE MONTH(registerDate) = MONTH($current_user_register_date)
Good Luck!

Is it possible to list users in a specific orgunit with the google admin sdk directory api?

Im using the Directory API in the Google admin SDK to manage users in Google domains.
I'm looking for a way to list users in a specific orgunit in the domain but I don't find any examples on how to achieve this.
According to the documentation https://developers.google.com/admin-sdk/directory/v1/reference/users/list the only valid query attributes are email, familyName and givenName.
The workaround im using today is to get all users in the domain and then filter the response.
This is possible using the query parameter.
Example:
/admin/directory/v1/users?domain=domain.com&query=orgUnitPath=/Sales
or, url encoded:
/admin/directory/v1/users?domain=example.com&query=orgUnitPath%3D%2FSales
Will return all users in the /Sales orgunit.
Full docs here.
Your findings are correct, there's no way to retrieve only users in a given OU. You can retrieve just email and OrgUnit using the fields parameter and then filter locally. Using fields should reduce traffic and improve efficiency somewhat.
I used the 'query' parameter as explained in https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list and it works.
var optionalArgs = {
customer: 'my_customer',
orderBy: 'email',
query: "orgUnitPath='/A1 - Current Members'"
};
var response = AdminDirectory.Users.list(optionalArgs);

Ability to add user-data to Facebook post and use it while quering thru FQL or Graph API

Is there a way to add user-data (a number or a string) and use it while querying posts from the stream of that page ?
Essentially I am trying to make posts with certain attributes on a Facebook page thru an App and would like to query the stream (newsfeed) on that page using FQL or Graph API and just select the specific posts based on the attributes added to the posts.
SELECT post_id FROM stream WHERE **user_data** ='tag-specified-with-post' app_id='APP_ID'.
Thanks for your help.
Use FQL to get posts from your app. This query will get posts made in the account of the user by the Photos app:
SELECT app_id, post_id, actor_id, target_id, message FROM stream WHERE filter_key ='owner' AND is_hidden = 0 AND app_id='YOUR_APP_ID'
Replace that app_id with yours. And replace filter_key with 'others' to get other people's posts that the user can view.