+ Start a Discussion
Riley BroachRiley Broach 

How would you update permissions so that an Account Owner can change all related Contact Owners? 

Thanks for any help!

Best Answer chosen by Riley Broach
Suraj Tripathi 47Suraj Tripathi 47

Hi, Riley

You can take references from these steps.

 

Give users permission to change Account ownership
 DescriptionUsers can have the ability to transfer records to which they have edit access, including changing Account ownership.
 
ResolutionTo accomplish this the "Transfer Records" permission must be added to the users' Profile, or a Permission Set with the permission assigned to them.
Give permission to Transfer Records
Salesforce Classic


To set the permissions on a Profile:
Navigate to Setup | Administration Setup | Manage Users | Profiles
Click on Edit next to the new custom Profile you created
Check the box next to 'Transfer Records'
Click Save


To set the permissions for a Profile using the Enhanced Profile editor: 
Navigate to Setup | Administration Setup | Manage Users | Profiles
Click on the name of the new custom Profile you created
Click on System Permissions
Check the box next to 'Transfer Records'
Click Save


To create a Permission Set:
Navigate to Setup | Permission set
Click the New button, enter Label and API Name, then click next
Click on System Permissions
Click on Edit
Check the box next to 'Transfer Records' then click Save
Click "Manage Assignments"
Click "Add Assignments"
Put a check next to the users who need this permission, then click Assign
Lightning Experience:

To set the permissions for a Profile:

1. Click on the Gear Icon | Select Setup | Type in "Profiles" on the Quick Find box
2. Click on Edit next to the new custom Profile you created
3. Check the box next to 'Transfer Record'
4. Click Save  

To set the permissions for a Profile using the Enhanced Profile editor: 

1.Click on the Gear Icon | Select Setup | Type in "Profiles" on the Quick Find box
2. Click on the name of the new custom Profile you created
3. Click on System Permissions
4. Check the box next to 'Transfer Record'
5. Click Save

To create a Permission Set
Navigate to Setup | Permission set
Click the New button, enter Label and API Name, then click next
Click on System Permissions
Click on Edit
Check the box next to 'Transfer Records' then click Save
Click "Manage Assignments"
Click "Add Assignments"
Put a check next to the users who need this permission, then click Assign

 

I hope it will help you. 

Thank You

Surya KusampudiSurya Kusampudi 

Here is the scenario,

> Create 2 Master Detail relationship fields and 2 Lookup fields on any Custom Object
> Deploy these changes to target Org
> Now convert 1 master-detail relationship to lookup field and 1 lookup field to master-detail relationship field

> Now again deploy this change to the target org and it fails with the below error message.

 

Error: You cannot create this type of field because this object already has two master-detail relationships.
 

Technically, master-detail already converted to look-up relationship so it should just update the field on the target org. But it is not happening?

Any explanation would be helpful?

Best Answer chosen by Surya Kusampudi
VinayVinay (Salesforce Developers) 
Hi Surya,

Salesforce will not accommodate a master-detail relationship or lookup relationship to a object that already contains data.

You would need to add this as post-migration step and convert manually.  Check below reference for more details.

https://help.salesforce.com/articleView?id=000325374&type=1&mode=1

Thanks,
Sowjanya Hegde 13Sowjanya Hegde 13 
I have created Lead and I have set the Lead owner as Queue. Then I converted Lead to Opportunity. Now If I check the Lead owner it shows logged in user(myself) as a Lead owner. How can I fecth the actual lead owner(QUEUE) after lead conversion ? Please help!
Best Answer chosen by Sowjanya Hegde 13
Sowjanya Hegde 13Sowjanya Hegde 13

I was able to fetch the ownerId after the conversion of the Lead with the following code:

if (Trigger.isBefore) {
   if (Trigger.isUpdate) {
   for (Lead ld : Trigger.new) {
      Lead leadDetail = trigger.oldmap.get(ld.Id);
      Id ownerIdBeforeConvert = leadDetail.OwnerId;
   }
 }
}

Nick Valeriote 9Nick Valeriote 9 
Hi SF Dev Community,

We're looking to implement the deliverability settings in our org (DKIM, SPF, etc.).  

If we start by making these updates in Sandbox, as not to affect our live production environment and users' daily actvities (e.g. workflow email alerts, etc.), is testing this in sandbox a reliable way to see if our settings (in SFDC and on our server) are working properly (e.g. test activities that generate email notifications), or does this all need to be done in production?

I'm wondering if our sandbox domain and IP, being different from production, will yield different results, or if that's a non factor?

Thanks.
Nick
Best Answer chosen by Nick Valeriote 9
ShirishaShirisha (Salesforce Developers) 
Hi Nick,

Greetings!

The domain will be same in the Sandbox and Production and I would suggest you to test the functionalities in sandbox first before making any changes to the live environments.

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri 
Akshay ShrivastavaAkshay Shrivastava 
I want to create Tab between accordian.
i want to do... when i click on that tab it shows contacts details

basically i am fatching account name and contacts and oppoertunity associted with the account.
>Account name
   Tab1   Tab2
  > contacts details if Tab1 selected
  > oppoertunity deatils if Tab2 selected


 <lightning:accordion>
        <aura:iteration items="{!v.accList}" 
                        var="acc">
            
            <lightning:accordionSection name="{!acc.Name}" 
                                        label="{!acc.Name}">    
                <lightning:accordion>
                    <aura:iteration items="{!acc.Contacts}" 
                                    var="con">
                        <lightning:accordionSection name="{!con.Name}" 
                                                    label="{!con.Name}">
                            
                            <aura:set attribute="body">
                                
                                <p>FirstName : {!con.FirstName}</p>
                                <p>LastName : {!con.LastName}</p>
                                <p>Phone: {!con.Phone}</p>
                            </aura:set>
                        </lightning:accordionSection>
                    </aura:iteration>
                </lightning:accordion> 
                
                <lightning:accordion>
                    <aura:iteration items="{!acc.Opportunities}" 
                                    var="opp">
                        <lightning:accordionSection name="{!opp.Name}" 
                                                    label="{!opp.Name}">
                            
                            <aura:set attribute="body">
                                
                                <p>Id : {!opp.Id}</p>
                                
                            </aura:set>
                        </lightning:accordionSection>
                    </aura:iteration>
                </lightning:accordion>
                
            </lightning:accordionSection>
        </aura:iteration>
    </lightning:accordion>
    

this is working but only need to show details when tab selected
 
Best Answer chosen by Akshay Shrivastava
CharuDuttCharuDutt
Hii Akshay Shrivastava
Try The Below Code
CMP

<aura:component controller="AccRelatedConC"
                implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="PageHeading" type="String" default="Account and Related Contacts" />
    <aura:attribute name="accList" type="List"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doinit}"/>
    
    <!--Component Start-->
    <lightning:accordion>
        <aura:iteration items="{!v.accList}" 
                        var="acc">
            
            <lightning:accordionSection name="{!acc.Name}" 
                                        label="{!acc.Name}">  
     <lightning:tabset selectedTabId="two">
        <lightning:tab label="Contacts" id="one">
            <aura:iteration items="{!acc.Contacts}" var="con" indexVar="index">
               <li>contact {!index + 1} Name : {!con.Name}</li>
            </aura:iteration>
        </lightning:tab>
        <lightning:tab label="Opportunities" id="two">
            <aura:iteration items="{!acc.Opportunities}" var="opp" indexVar="index">
               <li>Opportunities {!index + 1} Name : {!opp.Name}</li>
            </aura:iteration>
        </lightning:tab>
    </lightning:tabset>
               
                
            </lightning:accordionSection>
        </aura:iteration>
    </lightning:accordion>
</aura:component>



JS


({
    doinit : function(component, event, helper) {
        var action = component.get('c.fetchAcc');
        action.setCallback(this, function(response){
            var state = response.getState();
            if(state === "SUCCESS"){
                var allValues = response.getReturnValue();
                console.log("allValues--->>> " + JSON.stringify(allValues));
                component.set('v.accList', allValues);
            }
            else if(state === "ERROR") {
                var errors = response.getError();
                if(errors){
                    if(errors[0] && errors[0].message){
                        console.log("Error Message: " + errors[0].message);
                    }
                }
                else{
                    console.log("Unknown Error");
                }
            }
        });
        $A.enqueueAction(action);
    },
    

})


APEX


public class AccRelatedConC {
  @AuraEnabled
    public static List<Account> fetchAcc (){
        return [SELECT Id, Name,(select id,name from contacts),(select id,name from opportunities) FROM Account];
    }    
}
Please Mark It As Best Answer If it Helps So It Can Help Others In Future.And It Motivates us To Give More In Community
Thank You!
Jonathan Wolff 7Jonathan Wolff 7 
Hi, I would like to add the todays date next to the "Heute" title. Could you tell me how to insert it in the code below?
User-added imageUser-added image
Best Answer chosen by Jonathan Wolff 7
CharuDuttCharuDutt
Hii Jhonathan Wolf
Try The Below Code
<aura:component>
    <!--Declare Attribute-->
    <aura:attribute name="currentDate" type="string"/>
    <aura:attribute name="TommorowDate" type="string"/>
    
    <!--Declare Handlers-->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <!--Component Start-->
    <div style='font-size:18px; font-weight:bold;'>
       
           Heute ( {!v.currentDate} )
                                    
    </div>
    <div style='font-size:18px; font-weight:bold;'>
       
           Morgen ( {!v.TommorowDate} )
                                    
    </div>
    <!--Component End-->
</aura:component>

({
    doInit : function(component, event, helper) {
        var today = new Date();
        var date = today.getDate();
        var tommorowdate = today.getDate()+1;
        var month = today.getMonth()+1;
        var year = today.getFullYear();
        var result = date +'/'+month;
        var result2 = tommorowdate +'/'+month;
        component.set('v.currentDate', result);
        component.set('v.TommorowDate', result2);
    }
})

Please Don't Forget To Mark it As Best Answer If It Helps
Thank You!
Phuc Nguyen 18Phuc Nguyen 18 
Hello All,
Currently I am attaching a PDF that is dynamically generated and atatching it to an email.  All done via controller.
The email itself has become more complicated and the users want to be able to update the email as needed so I need to utilize a SF email template instead of my email controller.  Is this possible?  Use SF email tempalte and dynamically attach a file?  This file is not attched to the record.  I am currently rendering it as a pdf and attaching it before I send.  
Thank you,
P
Best Answer chosen by Phuc Nguyen 18
Vishwajeet kumarVishwajeet kumar
Hello,
Try Visualforce Email Templates, it can provide you ability to attachment files using components. However, it will also require to create Email  template itself using Html/Visualforce code. Checkout this link (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_templates_attachments.htm) .

Thanks
RichardR1RichardR1 

Hello, I want to know if there's another way to allow user to input text that can be formatted using bold, underlined, italicize and bullets, without using Rich Text Area field, or maybe still use Rich Text Area field but make them smaller and hide the control bar? As you can see in the image, the Rich Text Area field looks too big compared to the other ones.

User-added image

Thanks

Best Answer chosen by RichardR1
Vishwajeet kumarVishwajeet kumar
Hello,
I think probably their is no way to hide/disable features if we use Rich Text Area fields, as per article here (https://help.salesforce.com/articleView?id=sf.fields_rich_text_area_limitations.htm&type=5). You might need to code a custom editor using Javascript/Jquery, something as mentioned here (https://ej2.syncfusion.com/demos/?_ga=2.75610774.241792091.1618277899-1477649167.1607027917#/material/rich-text-editor/inline.html ).

Thanks
Vyasar GulVyasar Gul 

Hello folks, 

I am new to Salesforce development. I have not created a LWC before. I am tasked with creating a LWC that will update 5 fields at one time on the Account object if the record meets a certain criteria (or else it's disabled). The values are preset, so they can be hardcoded. Can you please give me pointers on how to go about doing this? An outline would suffice, I have just created a shell of a LWC that has the button and the labels. I want to know where does the conditional logic go to make this LWC appear/disappear and other things I have to keep in mind. 

 

Thank you.

Best Answer chosen by Vyasar Gul
CharuDuttCharuDutt
Hii Vyasar Gul
Try The Below Code
LWC

<lightning-record-edit-form record-id="Please Insert Record Id From Your ORG of Account Object"
                                object-api-name="Account">
        <lightning-messages>
        </lightning-messages>
        <lightning-output-field field-name="AccountId">
        </lightning-output-field>
        <lightning-input-field field-name="Name" value={nameVal} name="Acname" onchange={handleChange}>
        </lightning-input-field>
        <lightning-input-field field-name="Rating" value={ratingVal} name="rate" onchange={handleChange}>ail
        </lightning-input-field>
        <lightning-input-field field-name="Industry" name="industry" value={industryVal} onchange={handleChange}>
        </lightning-input-field>
        <template if:true={hideBtn}>
        <lightning-button
            class="slds-m-top_small"
            variant="brand"
            type="submit"
            name="update"
            label="Update">
        </lightning-button>
    </template>
    </lightning-record-edit-form>


JS

 nameVal;
  ratingVal;
  industryVal;
  accountId;
  hideBtn= false;
  handleSuccess(event) {
      this.accountId = event.detail.id;
  }
  handleChange(event){
    var fieldname = event.target.name;
   if(fieldname == 'Acname'){
     this.nameVal= event.target.value;
   }
  else if(fieldname == 'rate'){
    this.ratingVal = event.target.value;
  }else if (fieldname == 'industry'){
    this.industryVal = event.target.value;
  }


  if(this.nameVal== 'test' && this.ratingVal == 'Hot' && this.industryVal =='Agriculture'){
    this.hideBtn = true;
  }else{
    this.hideBtn = false;
  }
  }
Please Mark It As Best Answer If It Helps
Thank You!

 
Sachin Sharma 4089Sachin Sharma 4089 
Hi
i have a batch class and i'm wirting a test class for that batch class but the test class is covering only 72% of code. So please help me to write a test class which will cover 100% of batch class code. Thank you in advance.

this is my batch class:-

public class MyBatchable implements Database.Batchable<SObject> {

    public Database.QueryLocator start(Database.BatchableContext context) {
        return Database.getQueryLocator([select Id from Account where name like 'acc%' order by Name]);
    }

    public void execute(Database.BatchableContext context, List<Account> scope) {
        try{
        Account[] updates = new Account[] {};
        for (AggregateResult ar : [select AccountId a, count(Id) c from Contact where AccountId in :scope and active__c=true group by AccountId])
        {
            updates.add(new Account(Id = (Id) ar.get('a'), No_of_Active_Contacts__c = (Decimal) ar.get('c')));
        }
        update updates;
    }
        catch(Exception e) {
        System.debug('An exception occurred: ' + e.getMessage());
}
    }

    public void finish(Database.BatchableContext context) {
    }
}

This is the test class i have written:-

@isTest
public class MyBatchableTest {
    static testMethod void testme(){
        Account l = new Account();
        l.name = 'acc1';
        insert l;
        Test.startTest();
        MyBatchable ba= new MyBatchable();
        Id jobid= Database.executeBatch(ba,5);
        Test.stopTest();
        Account acc = [select id from account];
        System.assertEquals(5,acc.no_of_active_contacts__c);
    }
}

Thanks and regards
Sachin Sharma
Best Answer chosen by Sachin Sharma 4089
CharuDuttCharuDutt
Hii Sachin Sharma
Try the Below Code
@isTest
public class MyBatchableTest {
    static testMethod void testme(){
        Account Acc = new Account();
        Acc.Name='acc1';
        insert Acc;
        
        contact con= new contact();
        con.LastName = 'test';
        con.AccountId = Acc.Id;
        con.active__c = true;
        
        insert con;
        test.startTest();
        MyBatchable ba= new MyBatchable();
        Id jobid= Database.executeBatch(ba,5);
        test.stopTest();
    }
}
Please Mark It As Best answer if it Helps
Thank you!