• Ajay K Dubedi
  • ALL STAR
  • 8705 Points
  • Member since 2015
  • Ajay Dubedi


  • Chatter
    Feed
  • 277
    Best Answers
  • 0
    Likes Received
  • 7
    Likes Given
  • 1
    Questions
  • 2086
    Replies
Hi,

I am fairly new to salesforce as an admin, I am looking for a bit of advice around a formula field,

I have a field which converts a date/time value and takes only the date bu converting it to text, however the format of the date is YYYY-MM-DD, I am wondering if there is any way to change the order of the date field so it shows DD-MM-YYYY

My formula is below;

Name&" - "&ProductCode__r.Name&" - "&LEFT(TEXT(Outward_Date__c),FIND(" ",TEXT(Outward_Date__c))-1)&" - "& From__r.Name&" >> "&To__r.Name

Appreciate any help I can be offered,

Thank you,
I have a requirement where I should restrict ModifyAll permissions on Account Object for all profiles(except System Admin and Chatter Free User) using a Trigger. Any suggestion on this is appreciated.

Thanks.
I'm writing a VisualForce email template and getting this error:
Error: Win_Notes_Tix_VF line 65, column 31: The element type "tr" must be terminated by the matching end-tag "</tr>"
Error: The element type "tr" must be terminated by the matching end-tag "</tr>".
 
<messaging:emailTemplate recipientType="Contact"
    relatedToType="Opportunity"
    subject="Congratulations to {!relatedTo.Owner.Name} for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account}"
    replyTo="salesforcesupport@rft.com" >
   
<messaging:htmlEmailBody>        
    <html>
        <body>
            <p style="font-size: 16px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">
                Dear Sales:
                <br/>
                <br/>
                Congratulations to <strong>{!relatedTo.Owner.name}</strong> for the {!relatedTo.Sale_Type__c} win with {!relatedTo.Account} 
                <br/>
                <br/>
                Term: {!relatedTo.Term__c} Months
                <br/>
                <br/>
                Manager: {!relatedTo.Manager__c }
                <br/>
                <br/>
                Connect Ticket Sold: {!relatedTo.Connect_Tickets__c}
                <br/>
                <br/> 
                Was Conference discussed/ positioned: {!relatedTo.Was_Conference_Discussed__c}
                <br/>
                <br/>
                Reason for conference ticket not sold: {!relatedTo.Reason_for_Tickets_Not_Sold__c}
                <br/>
                <br/> 
                Close Date: {!relatedTo.CloseDate}
                <br/>
                <br/> 
               ARR (USD): {!relatedTo.Forecast_Amount__c}
                <br/>
                <br/>
                Total Opportunity Value (TCV): {!relatedTo.Total_Cash_Value_TCV__c}
                <br/>
                <br/>
                Reason for Win: {!relatedTo.Reason_for_Win__c}
                <br/>
                <br/>           
                <strong> Win Notes: </strong>  {!relatedTo.Win_Notes__c}
                <br/>
                <br/>
                <strong>Growth and Cross Sell Opportunities: </strong>{!relatedTo.Growth_and_Cross_Sell__c}
                <br/>
                <br/>
                <strong>Products Sold: </strong>
                <table border="1" cellspacing="0" cellpadding="4" style="font-size: 16px; font-family: Arial, Helvetica, sans-serif;">
                    <tr align="left"> 
                        <th >Product Name</th>
                        <th >SKU</th>
                        <th >Quantity</th>
                        <th >ACV</th>
                    </tr>
                    <apex:repeat var="oli" value="{!relatedTo.OpportunityLineItems}">
                        <tr>
                            <td >{!oli.PriceBookEntry.name}</td>
                            <td >{!oli.Product2}</td>
                            <td align="right" >{!ROUND(oli.Quantity,0)}</td>
                                <apex:outputText value="{0, currency}">
                                      <apex:param value="{!ROUND(oli.ARI__c,0)}" />
                                </apex:outputText>                          
                            </td>                        
                        </tr>
                    </apex:repeat>
                </table>
                <br/>
            </p>
        </body>
    </html>
</messaging:htmlEmailBody> 
</messaging:emailTemplate>

 
Here is my code, if someone could please help me with a test class, I would greatly appreciate it!

`trigger setOpportunityOwner on Task (before insert, before update) {
  Set<Id> oppIds = new Set<Id>();
  for ( Task newTask : Trigger.new ) {
    if ( newTask.WhatId != null && String.valueOf( newTask.WhatId ).startsWith( '006' ) ) {
      oppIds.add( newTask.WhatId );
    }
  }
  Map<Id, Opportunity> oppMap = new Map<Id, Opportunity>([Select Owner.Name FROM Opportunity WHERE Id IN :oppIds]);
  for(Task newTask: Trigger.new) {
    if ( oppMap.containsKey( newTask.WhatId ) ) {
      newTask.Opp_Owner__c = oppMap.get( newTask.WhatId ).Owner.Name;
    }
  }
}`
Hi All,

I want add mouse hover tool tip for the Anchor tag in the lightning component. below is my code. 

<a onclick="{!c.profilePage}">My Profile</a>

i tried with lighting helptext but it is displaying i symble  User-added image  beside My Profile link.
<lightning:helptext content="Cilick on My Profile to see your account details" />

How to show tooltip without i symbol.


Thanks,
Anil Kumar 
I want to connect oracle date base and update the data in to salesforce with out any thirparty application

is it possible in salesforce ?

if possible please let me know the solution.
Hi everyone,

I am new to salesforce developer domain.Please help me for futher process.

please find the below visual force page here i need to create apex class for the check box functiontality.please guide me.

    <apex:pageBlockSection columns="1" id="block1" title="Deactivation List" collapsible="false">
                    
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="CSV File : "/>
                            <input type="file" name="files[]" multiple="multiple" onchange="prepareFiles(this);"/>
                       </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem>
                        <apex:outputLabel value="Deactivation Reason: "/>
                        <select Id="ddlDeactivationReason">
                            <option value="-1">--None--</option>
                            <option value="4">Access code &#38; send email</option>
                            <option value="1">Access code &#38; suppress email</option>
                            <option value="3">Invitation link &#38; send email</option>
                            <option value="2">Invitation link &#38; suppress email</option>
                            <option value="5">Eligibility Verification</option>
                        </select>
                    </apex:pageBlockSectionItem>
                
                      <apex:pageBlockSectionItem>Suppress Email:
                          <apex:inputCheckbox/>
                    </apex:pageBlockSectionItem>     

         </apex:pageBlockSection>            
        </apex:pageBlock>
please help to create apex class controller for this class with explaination.

thanks in advance
Dear Team,

Greetings !!!

I am using inline editing using lightning datatable, everything is working fine but the output is appearing in disturb format. Kindly have a look at the attached image. Plz, suggest me some solution.

After executing this is output


Thanks & Regards
Shinendra
I have a trigger that prompts the user to include an attachment before saving a case record. Can someone please help me with the test class that provides a 100% code coverage. 
trigger CaseAttachment on Case (before update) {
    
    for (Case myCase : Trigger.New) {
        if (myCase.Status == 'Repair Confirmed') {
            
            Attachment myAttachment = new Attachment();
            
            try {
                myAttachment = [Select Id, Name from Attachment where ParentId = :myCase.Id];
            }
         
            catch (Exception e)  {
                myAttachment = null;
            } 
                
                
                if (myAttachment ==null)
                    myCase.addError ('Add picture to the record');
                
                
            }
            
            
                
        }
        
        
    }
I need help in writing a trigger here. I have two objects

1) Opportunity
2) Opportunity_Programs__c

I have lookup relationship between them, opportunity is parent and Opportunity_Programs__c is child, so one opportunity can have multiple Opportunity_Programs__c.

I have Status__c field in Opportunity_Programs__c object, so if Opportunity_Programs__c records that related to particular opportunity has Status__c value as "Open" then I need to update Opportunity stage to Open, if Stage__c is "Close" then I need to update Opportuntiy stage to "Closed Lost"

Can anyone help me out in this issue here
I have an overridden standard 'New' button in lightning with my custom component but when I am using it from the related list of the parent object, I am not getting parent record id in the URL. Also, 'hasRecordId' is giving Id of the child record only. Any Solution for this??
Hi ,
In lightning i have one requirement, the text field should be hielight with red boarder based on condition ,please help me .

Thanks 
S.Shanmuka
How can I pass data from one lightning component and to another lightning component. Please help ?

Thanks in advance
 
I have created a change set that I am trying to get to production. I created it initially in our partial sandbox and then sent it to our full sandbox. When I run APEX tests in the partial sandbox I show 77% coverage, when i try to validate the change set it shows 44% coverage. All the files that changed and the triggers and tests are included in the change set, yet it doesnt work. I then chose to not validate and deploy direct to the full sandbox. Once I did that I went to the dev console and tested the code again and it shows that class is 77% covered.

I then tried to go from full to production and got the same code coverage error showing 43% coverage, even though in the dev console, after clearing all test data and running again, that its at 77%.

Please tell me why there is this discrepancy when I know I am including everything I need to include ( based on the gitHub PR of files changed) and all the tests pass just like in the dev console.

 
Hi All,

Recently I encoutered the issue of maximum trigger depth exceeded. The thing is functionality is working fine in sandboxes but somehow it is showing errors in PROD.
My functionality is to assign leads on round robin basis and during bulk upload it shows the errors

Below is my trigger
trigger LeadTrigger on Lead (before insert,before update,after insert,after update) {    
    if(Trigger.isAfter){
        if(trigger.isInsert || trigger.isUpdate){
        RoundRobinImplementationHelper.roundRobinImplementation(Trigger.NewMap.keySet());
  }
 }
}

Below is my Apex class which assigns leads to users in round robin basis
public class RoundRobinImplementationHelper {
    public static void roundRobinImplementation(Set<Id> leadSet){
        System.debug('roundRobinImplementation ');
      List<Lead> leadList = [Select Id, OwnerId, Lead_Number__c FROM Lead Where Id IN : leadSet];
        List<User> userList = new List<User>();
        Set<Id> queueIdSet = new Set<Id>();
        Set<Id> userIdSet = new Set<Id>();
        Integer index, leadNumber, teamSize;
        
        For(Lead leadIterate : leadList){
            If(String.valueOf(leadIterate.ownerId).startsWith('00G')){
                queueIdSet.add(leadIterate.ownerId);
            }
        }
        If(queueIdSet==null || queueIdSet.size()==0)return;
        System.debug('queueIdSet '+queueIdSet);
        For(GroupMember gm : [Select Id, UserOrGroupId FROM GROUPMEMBER WHERE GroupId IN : queueIdSet]){
            userIdSet.add(gm.UserOrGroupId);
        }
        userList = [Select Id, Name,  Profile.Name From User Where Id In : userIdSet AND ISACTIVE = true];
        If(userList==null || userList.size()==0)return;
        
        For(Lead leadIterate : leadList){
                if(leadIterate.Lead_Number__c!=null){
                    leadNumber = Integer.valueOf(leadIterate.Lead_Number__c);
                    teamSize = userList.size();
                    index = Math.MOD(leadNumber ,teamSize);//+1;
                    system.debug('index '+index);
                    leadIterate.OwnerId = userList[index].id;
                    system.debug('leadIterate.OwnerId '+ leadIterate.OwnerId);
            }
        }
    If(leadList!=null && leadList.size()>0){
            update leadList;
        }
    }
}

What else I need to do here?How can I remove this error?

Any help will be greatly appreciated

Many thanks in advance​​​​​​​
trigger populateContactEmail on Case (before insert , before update){
    Set<Id> setConIds = new Set<Id>();

    for(Case  obj : trigger.new){
        if(obj.Secondary_Contact__c != null)
            setConIds.add(obj.Secondary_Contact__c);
    }

    Map<Id , Contact> mapCon = new Map<Id , Contact>([Select Id, Email from Contact where id in: setConIds]);
    for(Case obj : trigger.new)
    {
        if(obj.Secondary_Contact__c != null)
        {
            //Protecting against bad Ids
            if ( mapCon.containsKey(obj.Secondary_Contact__c)) {
                Contact c = mapCon.get(obj.Secondary_Contact__c);
                obj.Secondary_Contact_Email__c = c.Email;
            }
        }
    }
}

 
I am littile bit confuse about <lightnign:input /> & <ui:input /> when to use which and what differences does it makes?
We need to create a storage location for a userguide(in any format pdf,excel etc) in salesforce and for that we have to give read only permissions to all users and Editable access to admin and selected users.

We have tried these two ways but couldn't find exact solution:

1- We have tried it using by creating a Folder in documents and giving readable access to all users and to give editable access to admin or some selected users we have created a permission set in which under System Permissions we just ticked the Manage public Documents checkbox.So by this all the users which are assigned in the permission set are able to manage all the folders but we want to manage only a particular folder.

2- We have also tried using content libraries.In that we created a library and added the content file in it.Gave permissions of viewing,editing to particular users but in this we are not able to add Chatter Only users so this solutions got breaked,adding to it some more profiles are asked to generate a case to salesforce support to get Salesforce CRM Content User License by this license only they can view or edit content.

Solutions for this is highly appreciable.And if any one can suggest how to modify any of above two ways to get required solution this will be a great help. I have also posted this question on salesforce community and Stack Exchage.

Thanks
  public boolean hasMessages {
        get {
             return ApexPages.hasMessages();
        }
When i am trying to delete ToAddress Field data From EmailMessage Object I am Getting Error like.
Delete failed.  INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []

I tried with Query 
List<EmailMessage> lst = [Select ToAddress From EmailMessage];
Delete lst;

can any one Plz respond to above  Problem .
Thanks in advance.
I need a Validation Rule that makes the Opportunity Source field required for 3 different Opportunity Record Types.

We have 5 other Opportunity Record Types that we do not want the Opportunity Source to be required. 

Any help would be most appreciated. (-: 
I am trying to create a web to lead form in React.js but it is giving me following error
Error screenshotI have included domains in Whitelisted Origins and remote sites list
The react code I am using on submitting is - 
handleSubmit = async (e) => {
  const { general_settings } = this.props;
  e.preventDefault();
  if (!this.state.submitDisabled) {
    const validation = await this.formRef.current.validate();
    if (typeof validation.errors === 'undefined') {
      const {value} = validation;

      this.setState({processing: true});

      const formValues = {
        oid: general_settings.salesforce_oid,
        recordType: general_settings.salesforce_record_type,
        Campaign_ID: this.props.campaign_id,
        lead_source: "JH Website",
        ...value
      };

      this.Axios = axios.create();

      const results = await this.Axios.post(general_settings.salesforce_url, formValues);
      this.setState({processing: false, submitted: true});
    } else {
      this.setState({errors: validation.errors});
    }
  }
};

 
I'm trying to execute an apex class. I keep running this:
String q = 'SELECT Reload,Pre-Trip report,Post-Trip report,ParentRecordType,ID, O, Date.today()';
Database.executeBatch(new ServiceAppointmentCancel(), 200);
But it is not executing what it is supposed to in the code. 
global class ServiceAppointmentCancel implements Database.Batchable<SObject>, Schedulable
{ 
    global Database.QueryLocator start(Database.BatchableContext BC) 
    { 
        String subject = 'Reload,Pre-Trip report,Post-Trip report'; 
        String status = 'O'; 
        Date SchedEndTime = Date.today();
        String ParentRecordType = 'Work Order' ;
        String ID = 'WorkOrder.ID';
        String query = 'SELECT Subject,Status, SchedEndTime, ParentRecordType FROM ServiceAppointment WHERE subject = :subject AND status = :status AND SchedEndTime < :SchedEndTime AND ParentRecordType = :ParentRecordType AND ID = :ID'; 
    return Database.getQueryLocator(query);
    } 

    global void execute(Database.BatchableContext BC, List<WorkOrder> serviceAppointments) 
    { 
        // Loop to iterate over the service appointments 
        for(WorkOrder service : serviceAppointments)
        
        { 
            service.status = 'C';
        } 
        for(WorkOrder work : serviceAppointments)
        {
            work.status = 'C';
        }
        // Preforming the DML operation 
        update serviceAppointments;
    } 

    global void finish(Database.BatchableContext BC) 
    { } 

    global void execute(System.SchedulableContext SC) 
    { 
        Database.executeBatch(new ServiceAppointmentCancel(), 200); 
    } 
}

 
I have trying to get atleast the passing coverage for the trigger. Trigger is working fine but I am being able to get the test coverage. It would capture the oldMap and newMap values in the test
Trigger:
trigger allAccTrigger on Account (before update) {

    if(trigger.isUpdate){
        
        if(trigger.isBefore){
           if(checkRecursive.runOnce()){

            List<Account> accVert = new List<Account>();
            List<vendor_invoice__c> ven = new List<Vendor_Invoice__c>();

            for( Id accountId : Trigger.newMap.keySet() ){
          
            //Update the coordination checkbox after approval
            if(trigger.oldMap.get(accountId).Coordination_Complete__c != trigger.newMap.get(accountId).Coordination_Complete__c ){
               List<Processing_Checklist__c> prop = [select name from Processing_Checklist__c where account__c = :accountId AND name Like 'Coordination List Completed']; 
                prop[0].Completed__c = true;
                update prop;
            }
            
            
            if(trigger.oldMap.get(accountId).RecordTypeId != trigger.newMap.get(accountId).RecordTypeId){

                List<Account> accRecType = [select RecordTypeId from account where id = :accountId];

                //Check if all the vendor invoices have auditors before converting to contingency
                      if(trigger.newMap.get(accountId).RecordtypeId == '0120h000000MclWAAS'){
                            for(Vendor_Invoice__c v : [select name, id from vendor_invoice__c where account__c = :accountId AND Auditor_Assignment__c = null]){
                        ven.add(v);
                         }

                    if(ven.size()> 0){
                        Trigger.new[0].addError('Please assign auditor to ALL related vendor invoices');
                    }
                }


            //Checking to see if account moved to ACAP record type and deleting everything is vertical
                for(Account ac : accRecType){
 
                if(ac.RecordTypeId == '0120h000000YQmIAAW'){
                    accVert.add(ac);                        
                    }
                }
            }
        }
           
         //Getting all the verticals and navigation items to delete after the record is moved to ACAP   
                If(accVert.size() > 0)
                    {List<Prospect__c> props = [select id from Prospect__c where account__c IN :accVert];
                    List<Navigate_List__c> navList = [select id from Navigate_List__c where account__c IN :accVert];

                        delete props;
                        delete navList;
                    }
   
            }

       
        }
        
    }
}

Test
@isTest
public class accTriggerTest {
public static testMethod void casTrig(){
        Account accTest = new Account();
        accTest.Name = 'Test Account';
        accTest.Federal_Tax_Exempted__c = true;
        accTest.State_Tax_Exempted__c = false;
    	accTest.Coordination_Complete__c = false;
    	accTest.Company_Code__c = 'ads';
    	accTest.RecordTypeId = '0120h000000YQWeAAO';
        insert accTest;
        
        Opportunity opp = new opportunity();
        opp.AccountId = accTest.id;
        opp.Name = 'trying';
        opp.StageName = 'ACAP';
        opp.Estimated_Bill_Volume__c = 100;
        opp.CloseDate = Date.newInstance(2020, 12, 9);
        opp.Business_Development_Manager__c = UserInfo.getUserId();   
        opp.Business_Development_Rep__c = UserInfo.getUserId();
        opp.RecordTypeId = '0120h000000YQVlAAO';
        opp.Credit_Shared__c = 10;
        opp.Saving_Shared__c = 20;
        insert opp;
    
      	Vendor_Information__c venInfo = new Vendor_Information__c();
        venInfo.name = 'tester';
        venInfo.Abbreviated_Name__c = 'abc';
        venInfo.Phone__c = '123456789';
        insert venInfo;
    
        Vendor_Invoice__c venIn = new Vendor_Invoice__c();
    	venIn.Account_Number__c = 'fw df42r qe';
    	venIn.Account__c = accTest.Id;
    	venIn.Vendor_Information__c = venInfo.id;
        venIn.Federal_Tax_Exempted__c = true;
        venIn.State_Tax_Exempted__c = false;
    	venIn.Auditor_Assignment__c = UserInfo.getUserId();
        insert venIn;
        
        Account_Survey__c sur = new Account_Survey__c();
        sur.Account__c = accTest.id;
        insert sur;
        
        Case_Finding__c cas = new Case_Finding__c();
        cas.Name = 'try it';
        cas.Service_Type__c = 'Data';
        cas.Case_Date__c = Date.newInstance(2020, 12, 9);
        cas.Months_To_Bill__c = 12;
        cas.Vendor_Invoice__c = venIn.id;
    	cas.RecordTypeId = '0120h000000YQPxAAO';
    	cas.Case_Status__c = 'Active';
        insert cas;  

        Case_Finding__c cas1 = new Case_Finding__c();
        cas1.Name = 'try it';
        cas1.Service_Type__c = 'Data';
        cas1.Case_Date__c = Date.newInstance(2020, 12, 9);
        cas1.Months_To_Bill__c = 12;
        cas1.Vendor_Invoice__c = venIn.id;
    	cas1.RecordTypeId = '0120h000000i9oWAAQ';
    	cas1.Case_Status__c = 'Active';
        insert cas1; 
    	
        List<Case_Finding__c> cList = new List<Case_Finding__c>();
        cList.add(cas);
        cList.add(cas1);
    
        Processing_Checklist__c pro1 = new Processing_Checklist__c();
        pro1.Account__c = accTest.id;
        pro1.Name = 'Coordination List Completed';
        pro1.Notes__c = 'i really do not want to write the entire thing so i am going to end it here';
        pro1.Completed__c = false;
        insert pro1;
        
        Acap_Checklist__c pro = new Acap_Checklist__c();
        pro.Account__c = accTest.id;
        pro.Name = 'i dont know it yet';
        pro.Notes__c = 'i really do not want to write the entire thing so i am going to end it here';
        pro.Completed__c = false;
        insert pro;
        
    	accTest.RecordTypeId = '0120h000000YQmIAAW';
    	accTest.Coordination_Complete__c = true;
        update accTest;
            
   
    }
    
    public static testMethod void casTrig1(){
        Account accTest = new Account();
        accTest.Name = 'Test Account';
        accTest.Federal_Tax_Exempted__c = true;
        accTest.State_Tax_Exempted__c = false;
    	accTest.Coordination_Complete__c = false;
        accTest.Company_Code__c = 'er';
        insert accTest;
        
        opportunity opp = new opportunity();
        opp.AccountId = accTest.id;
        opp.Name = 'trying';
        opp.StageName = 'ACAP';
        opp.Estimated_Bill_Volume__c = 100;
        opp.CloseDate = Date.newInstance(2020, 12, 9);
        opp.Business_Development_Manager__c = UserInfo.getUserId();   
        opp.Business_Development_Rep__c = UserInfo.getUserId();
        opp.RecordTypeId = '0120h000000YQVlAAO';
        opp.Credit_Shared__c = 10;
        opp.Saving_Shared__c = 20;
        insert opp;
    
        Vendor_Information__c venInfo = new Vendor_Information__c();
        venInfo.name = 'tester';
        venInfo.Abbreviated_Name__c = 'abc';
        venInfo.Phone__c = '123456789';
        insert venInfo;
        
        Vendor_Invoice__c venIn = new Vendor_Invoice__c();
    	venIn.Account_Number__c = 'fw df42r qe';
    	venIn.Account__c = accTest.Id;
        venIn.Vendor_Information__c = venInfo.id;
        venIn.Federal_Tax_Exempted__c = true;
        venIn.State_Tax_Exempted__c = false;
        insert venIn;
        
        Account_Survey__c sur = new Account_Survey__c();
        sur.Account__c = accTest.id;
        insert sur;
        
        Case_Finding__c cas = new Case_Finding__c();
        cas.Name = 'try it';
        cas.Service_Type__c = 'LOCAL';
        cas.Case_Date__c = Date.newInstance(2020, 12, 9);
        cas.Months_To_Bill__c = 12;
        cas.Vendor_Invoice__c = venIn.id;
        cas.RecordTypeId = '0120h000000YQPxAAO';
        cas.Case_Status__c = 'Active';
        insert cas;  
    Test.startTest();
        try{
      accTest.RecordTypeId = '0120h000000MclWAAS';
            update accTest;
        system.assert(true, 'Please assign auditor to ALL related vendor invoices');}
        
        catch(exception ex){
            Boolean expectedExceptionThrown =  ex.getMessage().contains('Script-thrown exception') ? true : false;
            System.assertEquals(expectedExceptionThrown, false);
        }
        
        Test.stopTest();
    }
}

Coverage1st one2nd Coverage​​​​​​​
​​​​​​​Any help would be appreciated!
I need my "text" in this VF to align to the right but it stays to the left. Here is my code:
 
<apex:page controller = "timeStamp_controller" >
	<table style="text-align:right;">
    	   {!NOW()}   
       </table> 
</apex:page>

{!NOW()} is what I need to alighn to the right
Hi All,

Intermediate user here. I have a custom object for Admissions Documents. Each applicant can be assigned a various number of Admission Documents. I need a formula that would look at all assigned Documents to see if they are all listed as picklist vaule "Complete". Here is what I have come up with, but it does not work.

ISPICKVAL(Admission_Document__r.Document_Status__c, "Complete")

Thanks in advance for any help.
Donna
I have text field,there is use case like it needs to be converted to a lookup into account.

Can this be achieved???
Many Thanks in advance
I have a check box, Validate__c, that should not be true if the lender__c picklist value = Homes. 

Can someone help me with the format of the validation rule? 
  • October 18, 2019
  • Like
  • 0
<apex:commandButton value="Save & New" action="{!recordSaveandNew}"></apex:commandButton>

public PageReference recordSaveandNew()
            {   
                convertLeadRecord();
                //this code will redirect to home page but i need to redirect new lead page
                PageReference pg =new PageReference(Url.getSalesforceBaseUrl().toExternalForm());
                return pg;
            }
Hi,

I am fairly new to salesforce as an admin, I am looking for a bit of advice around a formula field,

I have a field which converts a date/time value and takes only the date bu converting it to text, however the format of the date is YYYY-MM-DD, I am wondering if there is any way to change the order of the date field so it shows DD-MM-YYYY

My formula is below;

Name&" - "&ProductCode__r.Name&" - "&LEFT(TEXT(Outward_Date__c),FIND(" ",TEXT(Outward_Date__c))-1)&" - "& From__r.Name&" >> "&To__r.Name

Appreciate any help I can be offered,

Thank you,
Hi everyOne,

I have written one test class while run it was showing success but while checking in apex class code coverage was zero.if any one have idea please guide me how to overcome with this issue.

Thanks InAdvance.

Regards,
Balaji
Hello,
We have a problem while we are inserting small bunch of data to Salesforce via Apex code. It takes 7500 milliseconds to insert it to database. Is this normal? Normally in Java you can insert 67 records into database less than 100 milliseconds. Are we doing something wrong? What is the best approach? 

Here is the code that where we insert Slot objects.  
//validSlots has only 67 records. But takes 7500 ms
if(validSlots != null && validSlots.size() > 0) {
                insert validSlots;
}

Thanks,

Alper Ozdamar
Senior Software Engineer


 
Is there a way to add a hyperlink to an asset object?
Hello,

I have created a connected app.
How can i expose a custom object for web service ?

thank you for suggestion
I am trying to use the Salesforce default Lead field called "Last Transfer Date" as a date field. It is displayed as a date field, but after doing some testing with formulas it appears to secretly be a date time field.

When I use DATEVALUE(LastTransferDate) I get an error of:

Error: Incorrect argument type for function 'DATEVALUE()'.

My end goal is to use TODAY() - LastTransferDate to calculate how many days a Lead has been in a users name. 
I have a custom apex page where the records will be displayed every month for a logged in user. They are as follows:
User-added image
Now, my requirement is to display only max records of an Account instead of all the records. It should be as follows:
User-added image
Below is my controller:
public class PD_ClosedAccounts {
    public String accId {get;set;}
    public String accId2 {get;set;}
    public list<Custom_Month__c> accList2 {get; set;}
    public List<Custom_Month__c> CustomMonthList {get;set;}
    public list<string> dID = new list<string>();
    public map<Id,string> CusAccID = new map<Id,string>();
    public List<User> usr = new List<User>();
    
    public PD_ClosedAccounts(){
        // Get the logged in user's Account Id
         usr = [Select Id, PD_Acc__c From User Where Id=:UserInfo.getUserId()];
        
        if(usr != null ) {
            
            accId = usr[0].PD_Acc__c;
            
            Set<Id> allCusAccIDs = new Set<Id>();
            allCusAccIDs.add(accId);   

            
            // Get all the associated Acc records of the logged in user:
            for(Account associatedAcc: [Select ID, Cus_Acc_ID  From Account Where Id = :accId] ){
                CusAccID.put(associatedAcc.ID, associatedAcc.Cus_Acc_ID);
            }
            
            
           dID=CusAccID.values();
            
            CustomMonthList = [SELECT Name, Acc__c, Acc__r.Name, Acc__r.Acc_Id_Format__c,   
                             Acc__r.Level__c, Acc__r.Location_Country__c, Processing_Month__c, 
                              Acc_c__c FROM CustomMonthList WHERE Acc_c__c != 0 AND
                              Processing_Date__c >= LAST_MONTH 
                              AND Acc__r.Spn_Id__c IN :dID order by Acc__r.Acc_Id_Format__c DESC];
            
        }
		 AggregateResult[] groupedResults = [SELECT id id, 
                                            MAX(Acc_c__c) maxAccountC 
                                             FROM CustomMonthList WHERE ID IN:CustomMonthList 
                                               group by  Processing_Date__c, 
                                            Acc__r.Acc_Id_Format__c];
                
        List<Id> theIds = new List<Id>();

        for (AggregateResult result : groupedResults) {
            theIds.add((Id) result.get('id'));
        }
        accList2 = [SELECT Acc__c, Acc__r.Acc_Id_Format__c  FROM Custom_Month__c WHERE ID IN :theIds];
        if(accList2!= Null){
            for(integer i=0;i<accList2.size();i++){
         accId2 =  accList2[i].Acc__c;
            } 
        }
    }
}


From the above controller, even though I have aggreagte query fetching max of Account_c__c field from CustomMonthList, I am getting all the 4 records in my page instead of Max ones.

Can anyone suggest the changes in my code so that I can able to fetch only max records?

Thank you in advance
SK

  • October 17, 2019
  • Like
  • 0
Hi Team,

I have 2 classes,
public class SelectMultiple{    
    @auraenabled public String label {get; set;}
    @auraenabled public String value {get; set;}
    @auraenabled public boolean selected {get; set;}
    @auraenabled public boolean disabled {get; set;}
}

public class Chroma_Detail {

    @auraenabled public List<SelectMultiple> Sprint {get; set;}  
}
How do I create Test Class to get 100% code coverage for this?
I'd like to describe this case in detail: First , we have created an custom sObject which OWD is Private Second, we have an approval process on this sObject and user created an record and submit for approval Third, his manager reassigned user's request to another person who has no right to view user's record because OWD is private and also has no role hierarchy with this user My question is : Can we add custom logic when manager reassign this approval to another person? So that we can apex sharing this record to person.

Appreciate for any help
HI, anyone take Platform developer certification in 2019?. can you please provide reference links and simple quiz if its available online
Hi Expert,

I am new to the programming world. I have a custom controller which insert a contact created on VF page. Now I am not able to write test class for this. I could only cover 56% code.
 
public class TestPopup {
    
    public list<Account> acc{get;set;} 
    public Account acc1 {get;set;} 
    public Contact contact {get;set;}
    public List<Contact> conlist;
    public Boolean displayPopup {get;set;}
    public String accid {get;set;}
       

    public TestPopup(){
        acc = [select ID, Name, AccountNumber,Type from Account];
	    acc1 = new Account();
        conlist = new List<Contact>();
        contact = new Contact();
        	
    }
   
    public list<Account> getacc(){
        return acc;
    }
    
    public void showPopup()
    { 
    	displayPopup = true;
        acc1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :accid];
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }

    public PageReference save(){
        contact.AccountId= acc1.Id;
        insert contact;
        ID contactId = contact.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}
 
@isTest
public class TestCustomController {
     static testMethod void testMethod1() 
     {
         Account testAccount = new Account();
         testAccount.Name='Test Account';
         insert testAccount;
         
         Contact cont = new Contact();
         cont.LastName = 'Test';
         cont.FirstName = 'Contact';
         cont.AccountId = testAccount.Id;
          // insert cont;
         
         Account testAccount1 = new Account();
         testAccount1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :testAccount.Id];
       
         
         
         Test.StartTest(); 
         PageReference pageRef = Page.All_Account; // Add your VF page Name here
         pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
         Test.setCurrentPage(pageRef);
         
         TestPopup testAccPlan = new TestPopup();  
         testAccPlan.getacc();
        // testAccPlan.showPopup(); 
         testAccPlan.closePopup();
         
         Test.StopTest();
         
     } 
}

 
Hi,

Cannot save the Controller, please help.

https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components4
Ok, been directed here by support so hoping someone can help.

Basically noticed that our case milestones were violating outside our set business hours.  After a lot of head scratching the only conclusion was that our timezone on the business hours in use by the entitlement processes were set to GMT.  I have changed this to BST (British Summer Time) to prevent more out of hours violations.

I have asked support if having it set to BST would mean that come Autumn salesforce will automatically revert back an hour in line with daylight savings.  They have said this does not occur and you have to manually change the timezone each time daylight savings occurs.

Can anyone confirm if this is true?  Seems like something so basic that I can't believe its not in the system. 
  • April 21, 2016
  • Like
  • 3

Hi, 

This Monday I tried to do the exam but I had technical issues with camera. Kryterion support tried to help me but we couldn't solve the problem. They rescheduled my exam multiple times but they can not do it to a different day.

Please, I have opened cases and called to certification support phone without getting any answer. Could you help me?

Best regards
I want to send emails in user's language dynamically. Two approaches:
1. Use visualforce email template, create labels and use them in the template. Set language attribute in the template and provide translations for the labels using translation workbench.
2. Create multiple versions of each template, each in a separate language and choose the template dynamically.

Advantage of first approach is that no additional efforts are required if a new language is to be supported but creating so many custom labels is cumbersome. 2nd approach is good in that respect but a template needs to be added everytime a new language is supported. 
Is there any other approach? If not, which one of the above should be chosen?