Dashboard filter for an entity - sonata-admin

I'm using SonataAdminBundle and I'm looking at trying to have a form filter on the dashboard.
I have an admin service and I can use the filter in the list for my entity Locations
Is there a way I can use the same filter on the admin dashboard, and when I submit such filter, it will redirect to the correct list action with the filtered results?
Thanks

Basically, the admin dashboard uses BlockServices to display its contents. Hence, what you'll need to do is create a new Block Service to display your list. As for the filter, I think the easiest and fastest way will be to customize your query in the block filter.
You may use the RecentOrdersBlockService implementation in sonata ecommerce as an example: https://github.com/sonata-project/ecommerce/blob/master/src/Sonata/OrderBundle/Block/RecentOrdersBlockService.php ; implementation available in the sonata demo: https://github.com/sonata-project/sandbox/blob/2.3-develop/app/config/sonata/sonata_block.yml

Related

JHipster : Custome pagination with post method and parameter

I generated one application using JHipster V3. I am trying to modify the search functionality and adding some kind of filter where user select some filter and hit search button and my angular search controller will make a POST call to my API.I did modification on server side to support filter search and return data.
Now I want to modify pagination link so that they also make a POST call with selected filter data instead of GET.
I did some investigation and found that when user click on link call goes to 'ui-bootstrap-tpls.min.js' [selectPage] function.
I dont want to make any changes on this js as it is global and will work for other UI screen.
Is there any better approach to implement such requirements?

Written Very Basic APEX Class, How Can my Customers get to access it?

I am very new to Salesforce Apex. I created a simple Apex-Class to get all contacts in the salesforce website.
I used javascript code to invoke that class as follows
function runApex() {
sforce.interaction.runApex('AccountRetrieval', 'getAccount', 'name=Rajeev', callback);
}
It's working fine in my laptop. But how can my customers get to access that class to get all their contacts ?
If you can't simply give them access to the contacts tab in the UI to achieve what you're after then you can create a visualforce page with a custom controller. In the controller, use SOQL to run a query for all Contacts and save the result to a list or map. You can then use this variable to pass the Contact data to the visualforce page. If you just want to dump the data to the page as HTML then you can use a list variable to hold the query result and an apex:repeat tag to generate the HTML on the visualforce page. If you want more control over how the data is displayed then you could also use the apex variable to pass the data to a javascript variable which you could then build your HTML from client-side in whatever way you like.
More detail would be needed to give you full steps on how to set this all up exactly how you want but basically you should use a visualforce page to give them an interface to run your apex code from. Access to that page can be controlled via profiles or permission sets.
If this page needs to be visible to people who do not have a user account to log into your org then you can use the Salesforce feature called Sites to expose content to them without the need for a login.

in backbone.js can a Model be without any url?

I have an app where the menu system is built dynamically using metadata fetched at startup. Based on this data, and menu selections, I need to craft a "filter box" where user can input search criteria. The "main" View consists of a filter box plus a search results panel where result(s) are rendered in accordance with their classes.
Can I model the Filter Box as a Backbone.js Model? It does not have any data fetches from the backend as its composition depends entirely on the menu selections + the metadata? E.g. when user selects "Sales" menu then the filter box might prompt for "Sales Order Number" whereas when user selects "Material" then the filter box might prompt for something else.
I would then use this widget as component of the "main" View, along with a set of results views made up on the fly. As users make their menu selections, this main View will un-render the existing filter box and recompute and re-render a new one. Other components on the screen could query the Filter Box for its settings.
The examples I have seen so far always have a url and a server fetch, save, etc. The only url-free example on the tutorial page says it is a "contrived" example. I was wondering if a backend provider is necessary and programming will be full of gotchas without conforming to this requirement.
Thanks.
You can have models without url property defined. One of the building blocks of Backbone is the Sync object, that will help you when pulling and pushing data, ideally from/to REST endpoints. For this to work you need to tell where the data are served, and to do so you set a value to url on Models or Collections.
If you don't need server comunication but you just want to use the utilities provided by simple Model or Collection (such as event handling, filtering, etc..) you just don't set url and you are good to go (just keep in mind that methods like fetch or save won't work).
Yes you can use Backbone for your DOM logic too. A model doesn't need to represent data from the server. Do whatever you like with the few basic elements of Backbone, simply use them when you feel like it'd do a great job :)

DotNetNuke -- Inserting URL parameters in forms

We are migrating our website to DotNetNuke and are looking to replicate the functionality of our survey page. Currently, on the bottom of every e-mail we send through our CRM system, there is a link to a satisfaction survey along with some parameters to pre-populate some of the fields. So the URL looks something like like:
/survey.aspx?ticketID=1234&userName=John+Doe
I found the custom module "helferlein_Form" which seems okay for actually creating the form that the user fills in, but I don't see a way to pre-populate the fields. DotNetNuke does let you insert tokens(ex: [Date:now], [User:username]), but I don't see a way to grab individual parameters from the URL. Is there something I'm missing that will let me do that?
I'm not familiar with that module either, but I would strongly recommend using Xmod for customized forms that allow you to easily grab url parameters.
I'm not sure about the module you reference.
However, in my experience Dynamic Forms from Data Springs would fit the bill perfect. It has the ability to pre-fill and even run custom SQL queries to get data.
You should definitely try our My Tokens module.
It allows you to access the URL parameters using [Get:ticketID] or [QueryString:tickedID]. You can also build SQL tokens that use these parameters to return a list of items for example to populate a dropdown.
Also try our Action Form module which integrates very nice with My Tokens.
If you have a module you like and want to use you can always write a little javascript to grab the variables out of the URL and pre-populate your form fields using javascript.

Prepopulate fields in Salesforce.com

I have a doubt, i've been working with salesforce for a while and now i have a requirement from a customer.
They need that some custom fields be populated with a value of parent object, making some research on stackoverflow, i found this post, but this isn't working for me because my project is a manage package and when this is installed on a another salesforce instance the id of custom field change.
if someone could help me, I will be grateful.
Thanks!.
I can't see any way of doing the same as that post without using the IDs, I was thinking you could route via a VF page and build up the URL in the controller but it doesn't seem as though you can get the IDs of fields, just their type etc..
I think the best you could do in this instance is to override the default new recordpage with a visualforce page. In the constructor of your controller you could then loop through the page parameters and pre-fill the corresponding fields on the new record before it's displayed on screen. Using fieldsets or just an <apex:Detail> component would keep the level of effort down and also maximise the flexibility of the page for the end users.

Resources