I have a page layout xyz for a custom object. There is a picklist and a lookup field in that layout. I want to make picklist default value to something when the page loads itself by checking some values programmatically.
Do we have anything to check when page gets loaded (Any event or something) which we can capture in apex. Or there is just one option to create lightning web component for this form
Related
On standard salesforce page, I need to display some custom buttons based on some conditions. The decision to display the button or not is based on response from Apex method. As my page is standard visual force page, how can I trigger the JavaScript function before the page is loaded so that I can take a decision whether to display the button or not?
You can display a custom button on standard salesforce page. but salesforce not allowed to make any call on load of standard page. Salesforce have a feature that is page layout. You can create different record type with page layout in that you can use custom button as your need.
On the other hand you can make a decision and filter when javascript custom button click and show error like 'you are not allowed to click this button'.
What is the current way to do a custom button with some js in it?
We are building a custom button that needs to be able to read from the current contact (email address, phone, mailing address), and run a few lines of js. (We also need to create a call record.)
But how/where is this done in salesforce these days?
This page doesn't point me anywhere:
https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_enterprise.htm
And this explanation of the new method in Lightning isn't clear where the js lives:
https://developer.salesforce.com/forums/?id=906F0000000BWr4IAG
Where is the needed example/doc?
If you are using buttons on custom visualforce page there are no any problems with defining custom JS function for it. For example, if you use <apex:commandButton/> you can use such attributes as onclick, onkeydown, onkeyup and other. See more information in documentation.
If you are using buttons on object layouts, you can create custom button and chose executing of JS as a behavior, see attached screenshot.
If you mean some other cases, please, describe it.
I have created a custom Object in Salesforce. Now to save values in that what should i use Page layouts or a visualforce page and apex controller? in other way- When should we use page layouts and when the visualforce pages should be used?
Page layout is a built-in standard mechanism for displaying information to user. You can use Page layout editor without any development experience, just drag-and-drop. If you need a simple form which just shows field value and related records you have to use a page layout. But sometimes you need to use JavaScript, custom HTML tags, CSS on you page in this case you have to use VisulaForce pages which are similar to JSF or any similar technologies. Also note that you can include VisualForce inside standard page layouts.
In my ExtJS 4.2.1 Application I have a dashboard screen where Im showing some charts and grids.
I have been requested by my client to allow the user to add custom widget (from a static collection of widgets) so the dashboard will only show the widgets that the user wants to have.
So I have to create the widgets dynamically depending on some JSON that I will send from server when the user logins. But i have no idea how to implement this.
The process that the user will follow will be the following:
On my dashboard view I will have 4 panels (table layout).
Each panel will have a tool (gear icon).
The user clicks on this gear icon and a window will be shown with a list of available widgets he can assign to that panel.
The user selects the widget that he wants to add to the selected panel and he pressed the button "Apply".
On button clicked event the preferences will be saved on database.
The next time the user logins in to the app, the preferences will be loaded into the initial JSON so the widgets can be loaded into each panel.
Does anyone have implemented this kind of approach?
I will try to explain for a single panel then u can extend/use that on multiple panels(may be using tbl layout). Say we have some charts view files already created(for this ref charts tutorial on extjs docs), The charts files should have a config (custom config) through that we will pass the real time/dynamic data requied by the chart.
So For first time we will allow user to select chart/widget options from list we we will create chart/widget on its select event as well as save the name of the widget or any other extra settings provided in that widget along with user details in database.
Next time when user logs in we have to retrieve the widget name etc from db and create a widget dynamically on page laod event and display.
Hope this clarify your understanding.
Need to show a popup message in home page only for the first time a user logs into salesforce....
its more like a splash page.
it can be a jquery popup as well..
can i do it using a visualforce page ??? if yes, please give ur suggestions
can we do it using the sidebar component in salesforce ???
I thought of showing it using a sidebar component by keeping a custom field in user object...everytime he logs in i will check the custom field and the show the popup...since this popup will be shown only for the first time is there anyother better solution instead of querying the user object evertime..
thanks.
You can use window.open method of Javascript and for the sidebar provide your scroll option.
If you want to get fancy to have customized look you can just use jquery modal with some style on document ready.
We can use cookie to store if this is the first time or salesforce user object can tell you this is the first time