Visualforce: How to display user's account using the $User - salesforce

I have a visualforce component which I use for displaying the user's name.
Currently I am doing it using the following:
!$User.FirstName} {!$User.LastName}
Is there any way I can display the User's Account as well using this without writing SOQL.
I would not like to create a controller just to display the user's account and am hoping there is a simpler and easier way using just Visual force.
I did try !$User.Contact.Account}
But it gave me an error.
Thanks.

Here are two things you may want to try:
Reference the Account Name from the $User Visualforce global variable.
{!$User.Contact.Account.Name}
If that doesn't work, create a new formula field on the User object named Contact Account Name with this formula: Contact.Account.Name. Once you have created that formula field, you should be able to reference it in Visualforce using: {!$User.Contact_Account_Name__c}.

Related

How to use search function in ldp.exe to search class (user) attributes (mustcontain)

I need to admit that I am a beginner with AD DS Schema.
I want to make some user attribute fields required at the time of creating a user account in AD.
I followed the instructions in the article here. I made a mistake (don't remember which values I set in mustContain attribute) now I can't create an active directory account I would like to query mustContain attribute in class= user to find the values in mustContain. I tried ldp.exe search but confuse what parameters in need to use in search function.
Probably you would need to set up your Base DN to CN=User,CN=Schema,CN=Configuration,DC=... and Scope to Base. In the Attributes section put mustContain or leave asterisk to get all the attributes.

Sales Force sending email to non user with template from custom object

I'm need to create email in Sales Force with the recipient as a custom object rather than a User, Contact or Person. Unfortunately, it appears my client has created a custom object for the entity we need to contact.
I tried several methods in the UI and they have all ended up needing a User or Contact record to succeed.
I'm now using APEX code in a trigger, it also requires a User, but I have managed to get past that using this work around: Sending Emails in Salesforce to Non-Contacts Using Apex
Now I need to pass my custom object into the Email Template to get the merge fields from it.
I believe setWhatId is the correct approach, but it returns "Invalid entity type for whatId".
Not sure where to turn now....
In short, I have a custom object that is not a user or a contact, but it does have a related custom object with an email address field (also not user or contact).
I need to send an email to the email address recorded on the related custom object passing the custom object to the template to gain its merge fields.
Any help or guidance would be much appreciated. Can I even do this?
Best Regards,
Rod
From your comment and without knowing much more, the relationship traversal should look like this:
Contact c = [select id, Email from Contact where id=q.Client__r.Participant_Portal_Contact__r.id limit 1];
Assuming that the email address field is on a parent object you dont need to do this with code you can probably do this using a Visualforce Email template and the relatedTo set to the object with the details you want to use as merge fields. That way you can use it in workflow or process builder or flows without the need for code

Iframe content not able to save in module params Joomla

I am using Joomla3 with tinymce editor. I have created one module and adding one params in textarea
I am adding iframe code
in text area
but it's not saving. If i am save normal text string then it's saving
Please help me
I believe you need to add a filter to your xml code.
such as:
filter="RAW" or, probably more appropriately, filter="HTML"
This will keep Joomla from cleaning your code. There are a number of filters available to XML fields when creating modules. You can examine the code here: https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/filter/input.php#L167 to see the exact list.
What user group is the account you are using a member of? Super Users and Administrator group types should have no filtering set by default but it sounds like you might need to edit those settings.
From the main menu:
System > Global Configuration > Text Filters (tab)
You will see all the available user groups for you website. The group your user belongs to should have a Filter Type of No Filtering. Another important note is its better to add the user account to a group with the permissions then to arbitrarily adding it to a group type typically reserved for registrants, guests or low-level editing.

Drupal Replacement Pattern for Entity Reference

I have a Profile Type attached to a user. In there I have a Entity Reference Field of Program Manager. I have Live Events(content-type) that people can register for. I set up a Rule to Email the Program Manager every time someone registers.
My problem is I am trying to pull information from the Profile based on the the entity reference for the Program Manager.
I have the field printing out by using this pattern...
[registration:entity:field_program_manager]
However when I try to pull the first name, email of phone I can not get it to show up.
Does anyone have any ideas to share?
Many Thanks!
Okay so I was trying to solve for sending the email to the Author of the page but was having issues. So I created a new fields hoping it would be easier. In trying to solve for this I solved the original issue.
To print the Author of a node to an email through Rules actions us this.
[registration:entity:author]
So for first name it would be:
[registration:entity:author:profile-main:field_first_name]
Hope it helps someone else.
If you're using entityform instead of a node and referencing the default user info (not the 'Main Profile' profile type), then you want to use something like
[entityform:field-staff-entity-ref:field-work-email]
In this case, 'field-staff-entity-ref' is the entity reference field in the entityform and 'field-work-email' is the field in the user's account settings.

Best way to populate a dropdown sitewide that is

I am using CakePHP 1.3 and a layout which includes a dropdown of organizations a user has access to administer, so I'm trying to populate that dropdown with organizations that contain the userid that is logged in, but I want to populate it before the user sees anything so they can use it in the header. The dropdown needs to appear on every page once logged in. I tried adding the query to pull these organizations in the appcontroller, but userid was not yet available to use in before filter. Where or how should I do this? Should it be in session or is there a better construct to use? Element?
In my app it's no problem to use the user_id from within the beforeRender (if you are using the Auth-Component).
You can use it with $this->Auth->user('id').
I would do it like this: Check in the AppController if the user is logged in. If he is, pull your wanted information from the database (or whereever you get your information from) and store it in a variable called $dropdown for example.
If the user is not logged in, $dropdown will be false.
You now make this variable available to the view with $this->set(compact('dropdown'))
Now in your layout (this is important to you have it on every page) you can easily do a check if $dropdown is false or not. If not, you can work with your variable and show the user your wanted dropdown.

Resources