I have created a custom button. When user click to the created button, I want it will redirect user (manager) to approval/reject page (as attachment). May I know how?
--View image
You will need to query something from ProcessInstanceWorkItem to learn the id of the current step in this particular approval. Have a look at my old answer https://salesforce.stackexchange.com/a/12505/799, maybe you can reuse some bits. And read the documentation for the table.
Related
I wanted to display a custom field as Read-Only on the Edit page ONLY of a custom object. This field should be hidden on the detail page. I tried wrapping the field in a section and display the section in Edit Page only(Page layout editor). That didn't work. I don't want to create a custom visual force page for the EDIT Page. Please suggest.
Thanks
Kumar
Unfortunately, there's no way to put a field on just edit or just detail. It's both or neither.
You have two options, custom Visualforce page as an Edit override is the easiest one, but if you want to leave the page layout editor as something useful to admins, there's also a very hacky option...
Create two record types, one that displays the field and one that doesn't. Create a new button that launches a Flow (with a return URL of the edit page for that object). The Flow should change the object's recordtype to the one that displays the field. Additionally, create a Process or trigger that changes the recordtype back to the one that does not display the trigger after you save the object.
I definitely recommend the VF page...
I'm working in a ASP.NET MVC project that accesses an SQL database and allows the user to search and view the data. Let me describe it:
I have a view with a search filter. When I click in a search button in this view, the controller returns a partial view with a table with some data, which appears below the filter. Then, I can click in an actionLink of a row to go to another view with the details. In the Details view I have a "back to list" button.
When I click in "back to list", I want the view, that has the filter and the partial view, to appear exactly as it was before. How can I do this?
My "back to list" is an actionlink that goes to the view. The problem is that, when I click in "back to list", the partial view with the table doesn't appear because it is necessary to click in the submit button first. How could I force the submit button through the controller?
This isn't really a problem that is solved inherently with MVC. It's really just a state concern, where you need to persist the state of a page, and resume that state when coming back to it.
This can be solved through typical means of persisting state between pages:
1) Save your search criteria in the session, and retrieve them when returning to the page.
2) Pass your search criteria through the link to the details page, and then again on the "back to list" link.
And (as the comment below points out), you'll of course need to then use the values from the session/querystring to run the search again and render the search results to the view, just as you did when you originally performed the search.
The easiest way is open the link content in another tab... using Clic here
Client side option:
You could load the content of the link in another container <div>... hiding the one that holds the search results and filters. Then, when user clics "Back to search...", you just show the container with the search results and filters, and hide and clean the other container.
This code is not so hard, and you don't need to go to the server again.
If you are OK with reloading the page, #Jerard Rose, in his answer, explains 2 other approachs that involves re-loading the search results, querying again the database.
Values can be transferred between pages in many ways such as: Session, QueryString, Public property, Cookie, HTTPContext.
Perhaps you are calling a 'details' action to travel to the details page. What can you do is that,
1. When you go to the details page, store your search filter value and pass it to the details page. so that when you return to the previous page you can get back/pass the values again if needed.
2. Now if you click 'back to list' button pass the values that you already have for filtering to your desired action which is responsible for the partial view.
3. Do the same thing that you did while clicking on the 'Search' button in the action.
Hope this will help
Thanks
I am trying to create a content type (say Meter). Each Meter consists of a "Meter Reading". This meter reading content contains three fields, say title, date range and usage. I have a Panel page where I display all the Meter Readings related to a parent Meter. I have displayed the Meter Readings in a tabular format.
I want the user to be able to add new Meter Readings without going to the default Meter Readings creation page. Rather than the default form kind of page, the user should be able to enter the data in the table view provided and it should be automatically saved into the project itself.
So, I want the functionality to be like:-
Display all the meter readings with two links, i.e., Edit and Delete,
When the user clicks on Edit link, the meter reading row should become editable and the user should be able to make the changes inline in the same table,
In the footer there should be a link for adding a new meter reading and when the user clicks on it, a new blank row should be added dynamically to the table and the user should be able to make a new entry into it.
Is there a module in Drupal 7 for doing so?? I have already tried out several modules for this such as SlickGrid, jQGrid and jEditable
Any help would be great. Thanks in advance.
Am afraid am not aware about a module that does all that out of the box. But in case you carry on with custom coding you can have a look at the following:
Edit and Delete options per row in views
Use Views Megarow. For working example you can have a look at how its used in commerce backoffice. Please note that you need to write the form structure ( FORM api ) for the quick edit form in a custom module. The Views Megarow takes care of ajax populating the edit form, its submission in client side, and refreshing the original row after the response from server.
When the user clicks on Edit link, the meter reading row should become editable and the user should be able to make the changes inline
in the same table.
Views Megarow doesn't support inline editing. But another module as suggested by #nmc does it. Its editablefields. But it doesn't have any edit/delete button. You click on the text directly ( provided user has appropriate permission to edit the field data ) in view.
In case you are going to use editablefields, then you would have to add another delete button in view, which one confirmation would redirect to the page that triggered delete action.
Since delete button would redirect to a default confirmation page, you may want to code a custom delete action which may override this.
In the footer there should be a link for adding a new meter reading and when the user clicks on it, a new blank row should be
added dynamically to the table and the user should be able to make a
new entry into it.
I suggest creating a small ajax form. Create a "Add Meter Reading" button in it, which on submission would create a meter reading node in the server. The ajax form should have parent information in a hidden field ( i.e. the Meter id). The ajax response for this form could be another script to load/refresh the view on client side.
Client side code to refresh the view can be found in Views Autorefresh submodule in Views Hacks.
If using views megarow you would have to add another jquery function on ajax response after view is refreshed - Trigger edit button.
Otherwise you may have to add some classes or theme to newly created rows in view to bring them to focus.
It is important that the entire views refreshes, so that drupal behaviours are attached to the newly created entry in table.
I don't know if there is one module which will meet all your needs but you may be able to use some in combination.
Views Bulk Operations (VBO) - has Drupal 7 support
This module augments Views by allowing bulk operations to be executed
on the displayed rows. It does so by showing a checkbox in front of
each node, and adding a select box containing operations that can be
applied. Drupal Core or Rules actions can be used.
editablefields - Drupal 7 version in dev
This module allows CCK fields to be edited on a node's display (e.g.
at node/123), not just on the node edit pages (e.g. node/123/edit). It
also works within views etc. Anywhere a 'formatter' can be selected,
you can select editable (or click to edit).
editview - no Drupal 7 support yet but I thought I would mention it in case you're able to adapt the code yourself
Editview is a plugin for the Views module. It allows you to create a
view in which the nodes are editable, and new nodes can be created.
With angularjs, we usually use plain HTML to write views. Now I have a question: how can I show or hide some buttons depend on the user's rights?
For example, current page is displaying an article. If the current user is the author or the article, or administrator, then "Delete" button will be displayed.
But since the view is plain HTML, how can I control it?
I can post an request to pass some data(e.g. current user id, article id) to server to check, but if there are many buttons, I need to request many times, which is not effective.
Is there any better way to do this?
You can use the ngShow directive. I put together a little demo, but the important bit is simply:
<button ng-show="user.id==post.postedby">Delete</button>
I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.
Here's what I'm trying to achieve:
When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.
Is this even possible? What other ways would you suggest going about this?
Here's a screen shot of what I'm trying to change:
Thanks for all your help!
It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.
If you really need a custom solution:
You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.
yeah its possible by javascript as i did by visual force page that will show the records of related lists and upon selection id of that record passed to parent window by jscipt. and performed same functionality ..
As far as I know - NO.
As a workaround you can use JavaScript.
What we did in our situation? We implement everything in JavaScript. We created an inputText and right on the right of this inputText we placed image with this lookup icon. On image click we create ExtJS popup window (I think you can simply create VF page and show this page in popup window). After window was closed you fill in the inputText field.
There's no out-of-the-box override for this button, last I checked, so something custom would be required. If you're set on having a popup and do not want an inline solution, I'd recommend reviewing this tutorial to get familiar with some of the issues with popups in Visualforce.
But considering what you are looking to accomplish, you could also have your account and filtered list of all contacts associated with that account appear inline on your page when the user clicks a new, custom search button. Of course that page would itself be in Visualforce (or inline Visualforce in a standard page layout) - which you may or may not want to have to code and maintain.
The AJAX Toolkit might also be a good place to start if you want to go with a custom JavaScript button placed on a standard page layout.