• Ankur Srivastava
  • NEWBIE
  • 75 Points
  • Member since 2014
  • Technical Lead
  • PricewaterhouseCoopers


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 10
    Replies
Can I change the error message displayed below for a unique field ?
duplicate value found: CHW_Member_Number__c duplicates value on record with id: <RecId>
the above message is not user friendly. 
I have enabled State & Country picklist and while using the State picklist in a VF page, the tab ordering skips the State picklist while navigating fields through Tab key. Any resolution to this? Below is the code.
<apex:inputField id="homeState" value="{!member.MailingStateCode}" label="State" taborderhint="20"/>
I have a requirement for exporting data of few objects before deployment. How effective is Batch Apex for this ? I need to automate this process for a large number of objects. Is it better to use Data loader CLI with Bulk Api or Batch Apex for this ?
I have a web application hosted on Heroku, and want to use iframe inside it so that it can login to salesforce and help to do further processing. I looked at frontdoor.jsp, but it requires OAuth access-token to connect to Salesforce. Also to mention I would further be using Chargent for payment processing once logged in to salesforce. Is it possible to embed such a functionality of salesforce in an external webpage and access them from iframe inside the web application on Heroku ?
There is a duplicate rule on Account object enabled in my org. I have a customize lead convert classic page, in which if I select Create New account option then on click of convert button, it should display the error message of the duplicate rule. I added the below code to be displayed in error messge.
Database.LeadConvertResult leadConvertResult = Database.convertLead(leadConvert);
        
        // if the lead converting was a success then create a task
        if (!leadConvertResult.success)
        {
           PrintErrors(leadConvertResult.errors);
            
            return null;
         }

    //this method will take database errors and print them to teh PageMessages 
    public void PrintErrors(Database.Error[] errors)
    {
        for(Database.Error error : errors)
        {
            if(error instanceof Database.DuplicateError)
            {
               Database.DuplicateError duplicateError = (Database.DuplicateError)error;
               Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult();
			// Display duplicate error message as defined in the duplicate rule
               ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.Severity.ERROR, 'You are creating a duplicate record. We recommend you use an existing record instead.');
               System.debug('The error message'+errorMessage);
                ApexPages.addMessage(errorMessage); 
            }
        }
    }
The above code doesn't provide the simple error message as mentioned in the code. However I recieve a the below error. What is it that I am doing wrong here ?
OR(AND( 
Owner:User.ProfileId <> "00e16000001054Q",
Owner:User.ProfileId <> "00e16000001Givi", 
Owner:User.ProfileId <> "00e16000001054R", 
Owner:User.ProfileId <> "00e16000001054S",
BEGINS( OwnerId , '00G')

This WF rule works when a Lead owner is changed from Queue to User Or User to Queue, but it doesn't work when I change owner from Q to Q.  I tried ISCHanged(OwnerId) to check if the owner has changed and if it belongs to '00G' . but ISCHANGED can't be used in such a formula. any way to do it ?
I have the following method returning a changed owner id when a person selects a new value from lightning component. I want to use this ownerId in a method of some other class. The value of the ownerId is available in this method. I am unable to use this return ownerId in a different class. It looks trivial but I don't know how to do it.
    @AuraEnabled
    public static Id getNewRecordOwner(Id ownerId) 
    { 
        System.debug('The value of Owner ID'+ownerId);
        
        leadConvertController lctr = new leadConvertController(ownerId);
        lctr.ownerIdChanged=ownerId;

        return ownerId; 
    }
I have used the Lookup lightning component in my VF page using the one mentioned here.(http://meltedwires.com/2015/10/31/salesforce-lightning-lookup-component-v2/). It's working fine. But I want to pre-populate that with the current Account Name on load. Can anyone tell me how that can be done ?
How can I conditionally render a lightning component/app in my VF page based on a button click ? I have a lightning lookup component which I want to render when I click a search button on my VF page.
I want to create a single select account lookup field on a lightning enabled apex page. I am using SLDS lookup.It should show the current Account name when page is rendered and on click of remove button it should provide lookup to search for other accounts. Can anyone help me on this ? It's simple in a normal VF page but in lightning enabled VF I am unable to proceed. 
I have already checked this link https://developer.salesforce.com/blogs/developer-relations/2015/06/salesforce-lightning-inputlookup-missing-component.html and got the lookup component but don't know how to make it single select with current account name selected.
I am getting the above error when I am trying to work on Quick Start: Lightning Process Builder trail. The error is occuring in the Add Process Criteria step. I am following the steps as mentioned in the trail.

Below is the full error:
Step Not yet complete... here's what's wrong: 
The 'Contact address change' Process does not have the correct criteria configured. 
Note: you may run into errors if you've skipped previous steps.
I am using Metadata API for a certain requirements related to profiles. I am using getFullName() method to retrieve the Profile name.
However I am finding a difference in the actual result returned.
For eg. if the Profile Label Name is : System Administrator, so the returned name is : Admin
Since the count of profiles is huge so I am looking for a programmatic approach to this mapping.
I have to insert the value of Name field present in OpportunityLineItem record in another holder object. I am using doing this by an after insert trigger on OpportunityLineItem object. All the other fields are getting inserted on the trigger execution. But the Name field is populating as null in the Holder object.

Sample code: (just for ref.)

List <B> b = new List<B>();

for(OpportunityLineItem opli : Trigger.New )
{
  B bi = new B();

 bi.Product_Name__c = opli.Name;
b.add(bi);
}
insert b;

I have skipped the other fields in the snippet..

Please let me know how to resolve this.
Hi,
I am inserting a record in another object B, once an insert trigger is executed in my source object A.
however i want to display error message /notify if any of the fields of object B failed to get populated with values from object A.
The user should be notified that the insertion in object B failed ,because a field X couldn't be populated due to some reason.

What is the most effective way to activate or inactivate the triggers or validation rules of an sObject programmatically ?
There is a duplicate rule on Account object enabled in my org. I have a customize lead convert classic page, in which if I select Create New account option then on click of convert button, it should display the error message of the duplicate rule. I added the below code to be displayed in error messge.
Database.LeadConvertResult leadConvertResult = Database.convertLead(leadConvert);
        
        // if the lead converting was a success then create a task
        if (!leadConvertResult.success)
        {
           PrintErrors(leadConvertResult.errors);
            
            return null;
         }

    //this method will take database errors and print them to teh PageMessages 
    public void PrintErrors(Database.Error[] errors)
    {
        for(Database.Error error : errors)
        {
            if(error instanceof Database.DuplicateError)
            {
               Database.DuplicateError duplicateError = (Database.DuplicateError)error;
               Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult();
			// Display duplicate error message as defined in the duplicate rule
               ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.Severity.ERROR, 'You are creating a duplicate record. We recommend you use an existing record instead.');
               System.debug('The error message'+errorMessage);
                ApexPages.addMessage(errorMessage); 
            }
        }
    }
The above code doesn't provide the simple error message as mentioned in the code. However I recieve a the below error. What is it that I am doing wrong here ?
OR(AND( 
Owner:User.ProfileId <> "00e16000001054Q",
Owner:User.ProfileId <> "00e16000001Givi", 
Owner:User.ProfileId <> "00e16000001054R", 
Owner:User.ProfileId <> "00e16000001054S",
BEGINS( OwnerId , '00G')

This WF rule works when a Lead owner is changed from Queue to User Or User to Queue, but it doesn't work when I change owner from Q to Q.  I tried ISCHanged(OwnerId) to check if the owner has changed and if it belongs to '00G' . but ISCHANGED can't be used in such a formula. any way to do it ?
I have the following method returning a changed owner id when a person selects a new value from lightning component. I want to use this ownerId in a method of some other class. The value of the ownerId is available in this method. I am unable to use this return ownerId in a different class. It looks trivial but I don't know how to do it.
    @AuraEnabled
    public static Id getNewRecordOwner(Id ownerId) 
    { 
        System.debug('The value of Owner ID'+ownerId);
        
        leadConvertController lctr = new leadConvertController(ownerId);
        lctr.ownerIdChanged=ownerId;

        return ownerId; 
    }
How can I conditionally render a lightning component/app in my VF page based on a button click ? I have a lightning lookup component which I want to render when I click a search button on my VF page.
I have to insert the value of Name field present in OpportunityLineItem record in another holder object. I am using doing this by an after insert trigger on OpportunityLineItem object. All the other fields are getting inserted on the trigger execution. But the Name field is populating as null in the Holder object.

Sample code: (just for ref.)

List <B> b = new List<B>();

for(OpportunityLineItem opli : Trigger.New )
{
  B bi = new B();

 bi.Product_Name__c = opli.Name;
b.add(bi);
}
insert b;

I have skipped the other fields in the snippet..

Please let me know how to resolve this.
Hi,
I am inserting a record in another object B, once an insert trigger is executed in my source object A.
however i want to display error message /notify if any of the fields of object B failed to get populated with values from object A.
The user should be notified that the insertion in object B failed ,because a field X couldn't be populated due to some reason.