I am new to visualforce and I would like to create the page which would display values from custom object (Staff__c). I would like it to work this way that each user would see value from the Holidays Remaining field from his/hers record in the Staff object (Staff records have the same name like the name of user). Could anyone help me with this please?
Staff__c object should have a link to a User.
In your controller for VF page you pull all needed data basing on current user who opened the VF page.
Related
I am developing an Azure AD B2C custom policy. Due to some requirements,I need to get the value of user object ID on edit profile process to call some third-party APIs. However, I can't letting this value show up on edit profile,even though I have added object id as a member of OutputClaims in AAD-UserReadUsingEmailAddress in Base.xml.
So my question is if it possible that show a user's object id value on edit profile page? If not, is there any workaround for this requirement?
Thanks in advance.
Edit Profile page only displays user editable attributes. Object ID is a attribute that user can't edit, so it can't be displayed on this page even though you have added it in OutputClaims . So if you just want to get its value on Profile Edit Page, you could define a custom attribute to copy this value and display this custom attribute on Profile Edit page.
If you would like to do so, there would be 2 steps:
Add a step for new user register process: copy user's object value to a custom attribute.
For exist users, you should run some scripts to copy user's object value to a custom attribute.
I have created login page of groceryList after login by particular user I need to display its own added grocery Item instead of added by other user I have used Angular js for front end ,Nodejs for handling the mongoose connection with mongodb .
Mongodb is having one collection with two document 1>users 2>groceries.
1>users :contains user information means username,password.
2>groceries:Contains groceries added by user
now my question is I need to show the added grocery by user1 it should not visible to user2 if he has not added . on which way I can implement this
data should be user specific please help me on this .
Thanks in Advance!!
<apex:outputLink value="/!{opportunity.id}">{!opportunity.Name}</apex:outputLink>
I am creating 2 pages in VF. One page to display a list of custom object records from a dynamic search. This is complete.
I need to now create a custom VF page to display a single record information when a user clicks on a link on the list page. I know we can use an output link like the one shown above.
Assuming I have built the detail page (assume its path is "apex/customDetailPage"), how would I go about modifying this link. Because my detail page will need the selected record id passed to it I suppose.
You can do it just like this:
<apex:outputLink value="/apex/customDetailPage?id={!opportunity.id}">
{!opportunity.Name}
</apex:outputLink>
Assuming that your custom page checks for the id parameter to establish which record it should be working with.
You can also use the $Page global variable option as described here which should mean it'll look something like this:
<apex:outputLink value="{!$Page.customDetailPage}?id={!opportunity.id}">
{!opportunity.Name}
</apex:outputLink>
We have a custom object say Sales form. On edit apge of customer object we need to add a button Save and Add Product(similar to One we can have on Opportunity page). User forget to add Product/SKU after saving the sales form
New Button(Save and Add product), will save the sales-form first and then depends on record type will open the related list(child object).
Say a Sales form is for Custom Program, after save,. it will open up Custom Program relate list.
If Record type is of Price Change Notification it willl open up related list of SKU detail..
Is this possible, please adivse, we have 9-10 different record type, and we don't want to re-write the application with visualforce and all customization. Re-writing with Visualforce page has some pitfalls.
As far as I'm aware, you can't replace the Save button as it's part of the Edit page and not the standard layout, so to achieve this with one button you'd need to write a custom visualforce page, this need not be complicated though — a simple custom controller which uses a standardController for management of the record would suffice.
You would call Save on the StandardController and then return a different page redirect based on the record type, the page itself would pretty much only consist of an <apex:detail> tag. If you want more details I can provide more.
If you really don't want to write any custom code or pages then you'll need to do this as a two step process, i.e. use the standard page and then have a custom "Continue" button which takes the user onto a custom URL based on the record type. I've just created a contrived version of this by doing the following:
1 - Define a custom formula field on the object, this should be of type text and can use a CASE() statement to determine the URL which the user will be taken to when hitting the button (note that this was made just for the sake of an example so it forwards to the accounts standard page for the record type 'Friend' and contacts page for 'Foe').
CASE($RecordType.DeveloperName, 'Friend', '../001/o', 'Foe', '../003/o', '')
Note the reason I use a formula field here instead of the doing this in the custom button is that for some reason you can't seem
access the record types by name when defining a custom button.
2 - Define a custom button for the object called "Continue" or something similar that makes sense for you. For my example I just used the Contact object, so I referenced the custom field on my record and specified the options shown here:
3 - Customise the page layouts used by your record types to include this new button and you should be done!
I have a custom object that is used for product setup that is mapped to an opportunity. It's a one to many relationship - one opportunity maps to many setup objects, but one setup object is only mapped to one opportunity.
Opportunity has some setup fields that need to act as defaults for the related custom object. Unfortunately, I cannot just specify them in a formula - getting an error.
What I would like to do is have a custom button that would allow user to click and copy all of the related setup fields from the opportunity into the custom setup object and then edit them as needed.
Any pointers or sample code are greatly appreciated!
You can achieve this with a custom button on the related list for your custom object on the opportunity detail page.
All of the fields on a standard Salesforce new/edit screen have id's associated with them. You can specify values for fields by using these ids to set GET parameters on your URL. For example if the id on the name field on your opportunity is 'opp3', the following URL will populate the name field on your new opportunity page:
https://na2.salesforce.com/006/e?opp3=Hello+World
You would have to change na2 to the correct server for your org.
The new record page URL contains the 3 character id prefix for your particular object and then '/e'. 006 is the prefix for opportunities. You will have to attempt to create a new record to see what the 3 characters are for your custom object.
You will have to capture the id's of the fields you want to populate on your custom object. You can do this by viewing the source of the new record page. For custom fields these id's will take the form of a Salesforce Id (eg. 00N40000002QhEV).
Create a new list button on your custom object and set the behavior to without header and sidebar and set the source to URL. Build up your URL with id=value pairs separated by '&' using the id you got from the page source and the insert field functionality to select the opportunity fields your wish to add in. You should end up with something like this:
/a0U/e?00N40000002QhEV={!Opportunity.Name}&00N40000002QhEW={!Opportunity.StageName}
a0U should be replaced by the correct prefix for your custom object. Then add your button to the related list for your custom object under opportunity.