How can we create test record for "WebStoreNetwork" object in test class?- - salesforce

I need to create record of WebStoreNetwork in my test class.
SELECT WebStoreId
FROM WebStoreNetwork
WHERE NetworkId = :communityId
WITH SECURITY_ENFORCED
This is the query which is not getting covered in my test class. I am getting value in communityId variable in test class. Facing error "List has no rows to assignment".
Does anyone have any idea? Thanks.

I suggest you post to Salesforce StackExchange.
But a direct answer is that as of Dec-2022 is not possible.
As of the next release, it should be: see Spring'23 release notes.

Related

Want to pass in a string array into a WS.sendRequest using groovy

I am new to API testing and am using Katalon to develop the tests. I've Googled any question I could think of and couldn't find anything to answer my question.
We have an API with the following Body
[
"${idValue1}",
"${idValue2}",
"${idValue3}",
"${idValue4}",
"${idValue5}",
]
I believe the purpose of this one is to delete multiple records at once by id. The script that we have in the step definition is
response = WS.sendRequest(findTestObject('EquipmentAPI/data-objects/DELETE Equipment By Ids', [('host') : GlobalVariable.host, ('idValues') : GlobalVariable.equipId]))
GlobalVariable.equipId = WS.getElementPropertyValue(response, 'data[0].id')
There are other step definitions that run before this one to set the Global Variables for use. I was able to generate the string array without issue.
Is this something that's possible? Please help!
Please let me know if further information is needed. Thanks.

Quickbooks Online Api - Is there a way to get a list of all available custom fields for Invoice?

I have been going through the Intuit Developer documentation for about 10 hours trying to find a way to get a list of invoice "custom fields" that have been set up for a Quickbooks Online Company file. I'm not sure if it is even possible. It if is, can anyone point me to some code, documentation, or anything that could possibly help me get such a list. Is it available somehow through the QueryService? Any assistance is greatly appreciated!
This gets custom fields:
public static List<Preferences> getCustomFields()
{
ServiceContext serviceContext = getServiceContext();
QueryService<Preferences> preferencesQueryService = new QueryService<Preferences>(serviceContext);
return preferencesQueryService.ExecuteIdsQuery("Select * FROM Preferences").ToList<Preferences>();
}
List<Preferences> prefs = RestHelper.getCustomFields();
List<CustomFieldDefinition> cusfieldDefs = prefs[0].SalesFormsPrefs.CustomField.ToList() as List<CustomFieldDefinition>;
List<StringTypeCustomFieldDefinition> customFields = cusfieldDefs.OfType<StringTypeCustomFieldDefinition>().ToList();
I started here: API Reference.
As well, to grab all of the fields with values I made a query to the Quickbooks record, with a SELECT * statement. That brings everything back, with data.

in Watson Discovery News Feed API, limiting articles returned by date

Per the API documentation, manipulating the vales of "start" and "end" will result in different data sets being returned. Strangely, changing the values of start and end resulted in the same result being returned. What am I missing? Thanks!
qopts = {'query': '/automotive and vehicles',
'aggregation' : '[term(yyymmdd).term(docSentiment.type,count:3)]',
'return': 'docSentiment.type,yyyymmdd',
'count': '50',
'start': 'now-2w',
'end' : 'now-1w',
'offset': my_offset}
my_query = discovery.query(my_disc_environment_id, my_disc_collection_id, qopts)
I hope it is helpful for you.
I am not sure if this is right answer for you because I have limited information.
First of all, please check the number of return-sets. if the return-set has more then 50 dataset, result could be same. (might count param. -1 = unlimited in the rest API of WCA (Watson Context Analytics)
Second, if you can check the log from the server side, you can see the full query which manipulated from WATSON engine.
Last, I am not really sure that watson REST-API can recognize 'now-2w' style start-end form. Would you please link the tutorial? In my previous project, I wrote the start-end date by Y-M-D form.
Good Luck

How to delete record through query in ndb database(python)?

I am new to Google App Engine. Please bear with me if my questions look stupid to you.
I wanted to delete whole record by query . In this code I am passing access token of record which is one field of my model and delete all records having that access token, but I am getting error "there is no delete() in module". Please give me some solution. Thanks in advance.
class deletehandler(webapp2.RequestHandler):
def get(self):
access_token=self.request.get('access_token')
gprofiles=User.query(User.access_token==access_token)
for g in gprofiles:
ndb.key.delete(g)
self.response.out.write("Profile is deleted")
The delete() method is an instance method. Try this:
for g in gprofiles:
g.key.delete()
self.response.out.write("Profile is deleted")
As documented here
UPDATE:
As Patrick mentions, a batched keys only query is more efficient:
ndb.delete_multi([key for key in gprofiles.iter(keys_only=true)])

Select query of sqlite in metro app?

I have seen quite a number of examples describing the usage of SQLite in Metro app. Most of the examples have either Orderby/Insert/Delete statements. May I know how do I get the data from a pre-populated db using the Select statement?
Secondly, how does someone store the data into an array or arrayList after the execution of the query?
Kindly help me with this,
Thanks.
See if this example is what you're looking for:
return db.runAsync('SELECT * FROM Table');
Here is a pretty useful article on it.
Extending the example to C#:
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people");
var query = conn.Table<Person>().Select();
var result = await query.ToListAsync();

Resources