-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
15Questions
-
10Replies
Anyway to generate custom error message for a unique field ?
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.
duplicate value found: CHW_Member_Number__c duplicates value on record with id: <RecId>
the above message is not user friendly.
- Ankur Srivastava
- October 12, 2016
- Like
- 0
- Continue reading or reply
Tab ordering on VF page not working for state picklist
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"/>
- Ankur Srivastava
- October 10, 2016
- Like
- 0
- Continue reading or reply
Batch Apex for data export
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 ?
- Ankur Srivastava
- July 04, 2016
- Like
- 0
- Continue reading or reply
using salesforce iframe from an external web application hosted on Heroku
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 ?
- Ankur Srivastava
- May 25, 2016
- Like
- 0
- Continue reading or reply
Duplicate rule error message to display on custom lead convert page
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 ?
- Ankur Srivastava
- April 13, 2016
- Like
- 0
- Continue reading or reply
WF email notification when a lead owner is changed from queue to queue
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 ?
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 ?
- Ankur Srivastava
- March 30, 2016
- Like
- 0
- Continue reading or reply
use value returned in server controller method to process further
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;
}
@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;
}
- Ankur Srivastava
- March 26, 2016
- Like
- 0
- Continue reading or reply
Pre populate lookup lightning component
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 ?
- Ankur Srivastava
- March 23, 2016
- Like
- 0
- Continue reading or reply
Conditionally render lightning app/component in VF page.
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.
- Ankur Srivastava
- March 18, 2016
- Like
- 0
- Continue reading or reply
Single Select lightning lookup on a lightning enabled 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 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.
- Ankur Srivastava
- March 17, 2016
- Like
- 0
- Continue reading or reply
The 'Contact address change' Process does not have the correct criteria configured
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.
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.
- Ankur Srivastava
- January 28, 2016
- Like
- 0
- Continue reading or reply
Mapping API Names to the Label Names using Metadata API
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.
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.
- Ankur Srivastava
- January 21, 2015
- Like
- 0
- Continue reading or reply
Value of Name field in OpportunityLineItem populating as NULL in the trigger
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.
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.
- Ankur Srivastava
- September 26, 2014
- Like
- 0
- Continue reading or reply
How to display error message/notify user if my trigger fails to insert data in another object due to value for required field missing ?
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.
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.
- Ankur Srivastava
- September 03, 2014
- Like
- 0
- Continue reading or reply
Activating triggers & validation rules programatically
What is the most effective way to activate or inactivate the triggers or validation rules of an sObject programmatically ?
- Ankur Srivastava
- July 20, 2014
- Like
- 0
- Continue reading or reply
Duplicate rule error message to display on custom lead convert page
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 ?
- Ankur Srivastava
- April 13, 2016
- Like
- 0
- Continue reading or reply
WF email notification when a lead owner is changed from queue to queue
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 ?
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 ?
- Ankur Srivastava
- March 30, 2016
- Like
- 0
- Continue reading or reply
use value returned in server controller method to process further
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;
}
@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;
}
- Ankur Srivastava
- March 26, 2016
- Like
- 0
- Continue reading or reply
Conditionally render lightning app/component in VF page.
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.
- Ankur Srivastava
- March 18, 2016
- Like
- 0
- Continue reading or reply
Value of Name field in OpportunityLineItem populating as NULL in the trigger
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.
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.
- Ankur Srivastava
- September 26, 2014
- Like
- 0
- Continue reading or reply
How to display error message/notify user if my trigger fails to insert data in another object due to value for required field missing ?
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.
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.
- Ankur Srivastava
- September 03, 2014
- Like
- 0
- Continue reading or reply