Is there a way to set a specific collection to use for a DocumentChooserBlock? - wagtail

The aim is that only the specified collection can be browsed or uploaded to.
It would be useful if it could be set like other options i.e. DocumentChooserBlock(collection="collection name") but this does not work
I have searched the wagtail docs but there does not seem to be any documentation on DocumentChooserBlock (https://docs.wagtail.org/en/stable/search.html?q=DocumentChooserBlock#)

Related

React/Redux: Loading/merging all options and selected values

Using React and Redux...
I have an endpoint that returns the following model:
Name (String), and
Colors (Array)
And another endpoint that lists all the color options the user can choose from.
Now I want to make a multi-select that lists all the color options, which the appropriate ones selected based on what the first endpoint returns.
My questions are around how to best handle this.
1) Should I just instead create one endpoint that returns the model along with all the color options already included?
2) Or should I call both endpoints from one action creator, wait for both responses somewhere, then merge the data added a 'selected' property to those that should be selected?
3) Or something else?
Any help in how to design this would be much appreciated. Or a link to an example..I've searched and surprisingly can't find one.

Fetch only users and not resources

I made a get req to /v1.0/users to fetch users but on the response I got resources too.
{"id"=>"e7cae970-f906-49f9-b080-8ec0b487c999",
"businessPhones"=>[],
"displayName"=>"meeting room 1",
"givenName"=>nil,
"jobTitle"=>nil,
"mail"=>"meetingroom1#test.onmicrosoft.com",
"mobilePhone"=>nil,
"officeLocation"=>"location",
"preferredLanguage"=>nil,
"surname"=>nil,
"userPrincipalName"=>"meetingroom1#test.onmicrosoft.com"},
How can I only list users and not resources?
You can do a couple of things here, but it depends on how resources are defined in your directory. Often times, directory resources (conference rooms, etc) are missing certain properties that are set for actual users, like givenName and jobTitle. You can prune resources missing these properties client-side by iterating through and checking what values are present.
For other Graph resources, you can use OData query options to filter down to just the subset of resources you want. However, support for filtering on properties of users is limited to a few operators like startsWith.

SuiteCommerce Advanced - Show a custom record on the PDP

I am looking to create a feature whereby a User can download any available documents related to the item from a tab on the PDP.
So far I have created a custom record called Documentation (customrecord_documentation) containing the following fields:
Related item : custrecord_documentation_related_item
Type : custrecord_documentation_type
Document : custrecord_documentation_document
Description : custrecord_documentation_description
Related Item ID : custrecord_documentation_related_item_id
The functionality works fine on the backend of NetSuite where I can assign documents to an Inventory item. The stumbling block is trying to fetch the data to the front end of the SCA webstore.
Any help on the above would be much appreciated.
I've come at this a number of ways.
One way is to create a Suitelet that returns JSON of the document names and urls. The urls can be the real Netsuite urls or they can be the urls of your suitelet where you set up the suitelet to return the doc when accessed with action=doc&id=_docid_ query params.
Add a target <div id="relatedDocs"></div> to the item_details.tpl
In your ItemDetailsView's init_Plugins add
$.getJSON('app/site/hosting/scriptlet.nl...?action=availabledoc').
then(function(data){
var asHtml = format(data); //however you like
$("#relatedDocs").html(asHtml);
});
You can also go the whole module route. If you created a third party module DocsView then you would add DocsView as a child view to ItemDetailsView.
That's a little more involved so try the option above first to see if it fits your needs. The nice thing is you can just about ignore Backbone with this approach. You can make this a little more portable by using a service.ss instead of the suitelet. You can create your own ssp app for the function so you don't have to deal with SCAs url structure.
It's been a while, but you should be able to access the JSON data from within the related Backbone View class. From there, within the return context, output the value you're wanting to the PDP. Hopefully you're extending the original class and not overwriting / altering the core code :P.
The model associated with the PDP should hold all the JSON data you're looking for. Model.get('...') sort of syntax.
I'd recommend against Suitelets for this, as that's extra execution time, and is a bit slower.
I'm sure you know, but you need to set the documents to be available as public as well.
Hope this helps, thanks.

Salesforce: How to add a Custom Object to Search results

Seems like a simple question, but I can't see where this is set.
I created a custom object, Account Thing, which is related to Accounts with a Master-Detail relationship.
It has a text area field, Body.
It has a Search Results Layout, and if i search for something contained in Body, a result returns.
I created another analogous custom object, Contact Thing. It also has a text area field, Body.
It does not have a Search Results Layout. If i search for something contained in Body, nothing returns. Looking at the list of objects being searched in the results page, Account Thing is listed, but not Contact Thing (or any other custom object i have created)
I'm thinking there must be a flag or search setting that i set for Account Thing, but I can't find it now.
I looked under App Setup > Customize > Search > Search Settings,
but there is no relevant config there.
Any help is appriciated!
I did some digging and found the solution to this issue.
Apparently only Custom Objects that have their own tab are included in search results.
I had somehow created a tab for Account Thing (but removed it from view), but not for
any of the other Custom Objects. After I added a tab, Contact Things were returned in relevant searches.
One other side piece of info is that the body was a Rich Text type, not a standard Text Area. So that explains why it is searchable.
Are you sure the Body on Account think uses a text area? I didn't think those would be searchable as you can't use them in the where clause of a SOQL query so would be surprised if the system did search them. Other than that, is the object marked as 'Deployed' or 'In Development'? If the latter, it probably wouldn't appear.
Because this is a non-code question you may well get closed down here, please follow (and vote on some questions) my Salesforce Stack Exchange proposal, I'm putting it forward so that these kind of questions (which are valid Salesforce development questions) have somewhere to live on Stack Exchange network!

Change type of Datastore field to Text from String?

I can't seem to do this. The list that the app engine datastore viewer does not contain Text as an option. I had to change my fields because some of my values were too long for String, but now I can't retroactively fix my old entries.
To change the property type used by the old entities, you need to manually update each of them.
This can be easily and efficiently accomplished using the mapper API. This guide explains how to use this API.
You may also want to read this blog post by Nick Johnson.
You don't have to fix your old entries. The old ones should work as is, and the new ones just won't be indexed.
See
http://groups.google.com/group/google-appengine/browse_thread/thread/282dc825f9c46684 .

Resources