How do i add a related record to a lightning page layout - salesforce

I'm trying to add a related record to a lightning page layout for BAN but don't have an update/new action to associate with it
My goal is based on the BAN entered into the Case to show the BAN page on the Case lightning page for a custom object
Carolyn

We don't know what BAN is (some custom object specific only to your Salesforce org?) and how they're related to each other ;)
You have a lookup field on Case that points to BAN and you want to show more details than just the name/link? Check if what I did in https://stackoverflow.com/a/61280895/313628 is any help. You edit the Lightning Page, find "record detail" component, drop it somewhere, configure a bit, job done?

Related

Salesforce "Record is not createable INSUFFICIENT_ACCESS" error

Hi,
I'm trying to create a lightning component to add records to the campaign object and I keepo getting an error message that I can't seem to find sufficient information on.
I'm using the lightning:recordEditForm component and because it automatically generates the picklist or input field based on the field data type and doesn't need a controller.
Here is the code I have written.
When I try to add the component to the appropriate page I get the error message shown in red.
Has anyone else solved a similar problem?
I'm inclined to believe it's a permissions issue but I'm not sure. If there's any more information I can give let me know.
I would really appreciate some assistance.
Thank you
Make Sure that your Profile has all necessary Object Permissions for Campaign Object.
For Campaigns: check if you have enabled "Marketing User" checkbox in the relevant User's profile.
This is one of annoying Salesforce Gotchas.
Check whether the user has access to create the record.
Try checking it in Profiles --> Campaign --> make sure Read, Create, Edit are checked (True)
Also make sure you have enabled Marketing User (Setup --> Users)

Drupal 7 displaying different user content

I have searched and searched and cannot find a solution to my specific problem...
I have a site that users join, and can upload their own videos. I crated a specific video type to handle this upload.
Other users can log in and see this content, they get to the content by clicking on a "profile" link for a specific user, and then it should display all the videos that user uploaded. Currently all I can get to work is display ALL of that content type, or none... I cannot figure out how to just get the user being looked for.
In my URL i have the user name being sent, because other info on the profile page that loads is driven off of that ( looked up in mysql tables and displayed with PHP).
As I mentioned I have a filter that limits to playervideo ( which is my content type) and that works, but as mentioned it displays all not just the user I am looking for.
any help would be much appreciated!!
thanks
I think your question is "How do I make a page for all users that lists content authored by a specific user"
I'd do this with the Views module.
Add a view for all your nodes.
Then add a "relationship" for "Content: Author".
Now add a "contextual filter" for the field "user: uid" with a default argument the userid from the URL.
Or you could try to add a contextual filter of "Content: User posted or commented" with the default value as the UID from the URL.
Cheers!

Show Opportunity related Contacts in Custom Object Field

I have the next issue.
I have a custom object called 'Application', and I have this requirement:
"Show all Contacts related to an Application. Create a field on Application object, must be read only".
I solve it with apex code. 'Application' has a lookup to Opportunity, Opportunity to Account, and all my contacts have AccountId, so this way, I get all the contacts using apex code in a trigger.
But, I've been ask to change this to a Formula field in Application object.
So, my issue is next. I'm not able to get all contacts with advance formula editor, because they're not part of any object. I have no master-detail relationship.
Does any one know how can I achieve this using configuration? I should not use apex code for this req.
Thank in advance guys.
I don't think you can do it.
In formulas / merge fields syntax there's no way to go "up, up then down" (Application -> Opportunity -> Account -> down to Contacts related list). There's also nothing that would let you loop through Contacts (and display what? Ids? Names? Emails?). Roughly speaking you can only go up through dots.
You might want to explore path of "cross object workflow" rules but I imagine that when I add a new Contact to Account it should somehow "spread itself" to all related Applications? There's no straight way to fire a workflow on delete too - so you'd eventually end up with inaccurate list.
I'd say trigger was a good solution. Maybe it ws unoptimized but if it has to be in a field - tough.
There might be a fairly simple way of achieving that by embedding a visualforce page within Application page layout.
This should be doable with pure Visualforce (so technically there will be no Apex code ;))
Something as simple as
<apex:relatedList list="Contacts" subject="Application__c.Opportunity__r.AccountId" />
would be a good start (if you want your own layout and not a rel. list - you should be still able to pull it off with <apex:repeat> or <apex:pageBlockTable>.
There's one BUT here: it's not a field, just a display trick. Forget about using it in reports, mobile applications etc.
Another way - would it be acceptable to be 1 click away from these contacts? You could make a report "Account with Contacts", filter it by Id of one Account and later use "URL hacking" to change the filter depending on from which Application you'll click it. This link could be either a formula field or a real custom button/link. Technically - it's pure config, no apex & VF.
You can read more about URL hacking at Ray Dehler's excellent post and specifically about dynamic Reports here or here.

Salesforce field level access determined by third variable

For the contacts object, I have a custom checkbox which represents whether the contact owner wants the contact information (email and phone) to be visible. Most of our contacts will be completely visible to everyone. However, for a few contacts, we want them to be visible but their contact information needs to be hidden to everyone except for the owner.
Is there a way to set field-level access dependent on another variable? Could you create a workflow to redirect to another page layout if the contact information is visible? If so, can you restrict objects to certain field layouts depending on whether or not you are the record owner? And would would the contact information for "hidden contacts" still show up in reports?
Redirects, custom Visualforce view page etc hacks are all nice and shiny until you realize people will be able to pull data they want via some reports, list views, Outlook integration, mobile apps etc ;)
There's no straightforward answer because field visibility is really "all or nothing" (by Profiles & Permission Sets). Owner/Role-related stuff will help you only if you'd store data in some new related objects.
Another option - Store public part in Leads (public read only for example) and sensitive part - in Contacts (private)? Some lookup to link the 2, maybe a trigger when new Contact is created and you're good to go.
Last but not least - have a look at https://salesforce.stackexchange.com/questions/777/can-i-grant-different-field-level-security-based-on-record-ownership for some ideas.
If I understood correctly (My english...) You could create a new RecordType and a new customized page layout without this fields assigned to it, then you have to create a WFR that change the Recordtype when the cheked field becomes true.
I'm assuming that you know how you have to give permissions to this new Recordtype...etc
Hope this helps.

Display Alert box through the trigger - salesforce

Is it possible to display an alert message (not error message) through a trigger? I have written a trigger that checks for duplicate accounts in the system. The trigger at the moment gives an error message to the user telling that there is a duplicate account. But, if the user changes the value of a field "Is record near to duplicate?" to YES, the trigger allows the user to save the record.
But, I want to display the error message in an alert pop up box like "Account with this Name exists,are you sure you want to continue" and then user clicks Yes and the record gets created. Any thoughts on how I can do this. My code is below:
for(Account account: System.Trigger.New)
{
if(accountMap.containsKey(account.Physical_Street__c)==accountMap2.containsKey(account.Phone))
if(accountMap.containsKey(account.Physical_Street__c)==accountMap3.containsKey(account.Name))
if(account.Is_record_near_to_duplicate__c.equals('No'))
{
account.addError('Account with this Name,Street and Phone Number already exists. If you still wish to create the agency change the value of field "Is Record Near To Duplicate" to YES');
}
}
If you really need an alert box then you could create a custom javascript button that uses the ajax toolkit to replace the standard save button.
However, as Baxter said you are getting pretty far from standard salesforce look and feel. I would recommend instead to add an error on the checkbox field instead of the object so it is clear to the user what they need to select.
if(account.Is_record_near_to_duplicate__c.equals('No'))
{
account.Is_record_near_to_duplicate__c.addError('Agency with this Name, Physical Street and Phone Number already exists. If you still wish to create the agency change the value of field "Is Record Near To Duplicate" to YES');
}
Unless you write a custom visualforce page that processes the error message and then displays it as a popup there's no way to do this.
If you wanted the alert to modify the data you may look at using the ajax api to set the Is_record_near_to_duplicate__c field to 'Yes' but either way you're getting pretty far from the standard functionality and interface with this.
It is not straight forward to implement a pop-up alert for a trigger error, and pop-ups went out-of-fashion a long time ago. If you are going through the hassle, you might as well implement a custom soultion on a VF page.
Throw a custom exception(for dupe accounts) from the trigger, and catch it in your controller. When you catch this exception, you can dynamically displayed section on the page which asks the user to confirm his/her action. When the user confirms the action, the page will do the rest.
Hope this makes sense!
Anup

Resources