You need to sign in to do that
Don't have an account?

Multiple record types for a single record
We like to move forward using record type but want to be sure how the data should be parsed out. Do we need to separate the data (so if we have 2 record types Staff and Student, and we have a contact that is a staff and a student, then there will be a Staff record and a Student record for the same contact).
Or can we have 2 record types applied to the same record?

Because the DoesRequireRecordChangedToMeetCriteria field has the value "true", you also need to set the following fields: Filters.
Hi All,
I am trying to deploy a flow using changesets and keep running into this error while validating below.
"Because the DoesRequireRecordChangedToMeetCriteria field has the value "true", you also need to set the following fields: Filters."
I have included every field that is referenced within the flow in the changeset. The only information I can even find on this "DoesRequireRecordChangedToMeetCriteria" variable is that it is now retrievable through the API. I have tried changing the starting conditions on the flow to even be very basic "everytime a record is created" without any conditional logic and still run into the same error. Does anyone have any idea as to what may be prompting this error? Thanks!




If changing of API version does not work. Then you can try to remove that tag in Metadata and try to deploy it.
If the solution helps, Please mark it as best answer.
Thanks,

Test class for apex callout from a trigger
I would like to know to write a test class for a trigger which makes a callout.




Can you check the below example for test class .
https://developer.salesforce.com/forums/?id=9062I000000g3emQAA
If this solution helps, Please mark it as best answer.
Thanks,

Hi, i need help to improve my test coverage for apex trigger
public static void afterupdate(List<opportunity> optylist,map<id,Opportunity> optyoldmap){
Map<Id,Opportunity>mapopp= new Map<Id,Opportunity>();
List<Project__c> projlist= new List<Project__c>();
for(Opportunity opp:optylist){
if ( opp.StageName != optyoldmap.get( opp.Id ).StageName && (opp.StageName=='closed won' || opp.stageName=='Closed Lost' )){
mapopp.put(opp.id,opp);
}
}
projlist=[Select Status__c ,Opportunity__c from Project__c where Opportunity__c in :mapopp.keyset()];
if(projlist.size()>0){
For(Project__c p:projlist ){
if(mapopp.get( p.Opportunity__c ).StageName =='closed won')
P.status__c='Active';
if(mapopp.get( p.Opportunity__c ).StageName =='closed Lost')
p.Status__c='Cancelled';
}}
update projlist;
}
test class:
@isTest
public class update_projectHandlerTest {
public static testmethod void optyprojectTest(){
list<opportunity> opty = new list<opportunity>();
list<project__c> proj = new list<project__c>();
opportunity op = new opportunity ();
op.stagename = 'qualification';
op.Name='test1';
op.CloseDate = System.today();
opty.add(op);
insert opty;
Project__c p1=new Project__c();
p1.Status__c='Active';
p1.opportunity__c=op.id;
p1.Level_of_Effort__c='medium';
proj.add(p1);
insert proj;
test.startTest();
op.stagename = 'closedwon';
update opty;
p1.Status__c='Active';
update proj;
test.stopTest();
}}
thanks in advance.




You have entered wrong picklist value in the 1st test method. stage name should be closed won not closedwon.
try with below code.
@isTest public class update_projectHandlerTest { public static testmethod void optyprojectTest(){ list<opportunity> opty = new list<opportunity>(); list<project__c> proj = new list<project__c>(); opportunity op = new opportunity (); op.stagename = 'qualification'; op.Name='test1'; op.CloseDate = System.today(); opty.add(op); insert opty; Project__c p1=new Project__c(); p1.Status__c='Active'; p1.opportunity__c=op.id; p1.Level_of_Effort__c='medium'; proj.add(p1); insert proj; test.startTest(); op.stagename = 'closed won'; update opty; p1.Status__c='Active'; update proj; test.stopTest(); } public static testmethod void optyprojectTest1(){ list<opportunity> opty = new list<opportunity>(); list<project__c> proj = new list<project__c>(); opportunity op = new opportunity (); op.stagename = 'qualification'; op.Name='test1'; op.CloseDate = System.today(); opty.add(op); insert opty; Project__c p1=new Project__c(); p1.Status__c='Active'; p1.opportunity__c=op.id; p1.Level_of_Effort__c='medium'; proj.add(p1); insert proj; test.startTest(); op.stagename = 'closed Lost'; update opty; p1.Status__c='Cancelled'; update proj; test.stopTest(); } }
Thanks!!

Can we access OAS3 for API versions older than 54.0?
I'm trying to access the OAS3 spec for versions older than 54.0 but when I add 53.0 or older, I get a "resource not found" response.
Is there any way to access this or is it not available for anything older than 54.0?
I only recently enabled the OAS3 setting under User Interface so I'm wondering if the versions available are based on when this was done?
https://developer.salesforce.com/blogs/2021/01/learn-moar-with-spring-21-openapi-3-0-spec-for-rest-api
TIA




Answer is no. The API version must be 54.0 or greater to access OAS3.
Refer the below article for more information.
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/openapi_beta.htm
If this helps, Please mark it as best answer.
Thanks!!

visualforce Error: RegistrationController Compile Error: Unexpected token ','. at line 25 column 65
After filling Registration form when Submit is clicked should be take to Welcome Page and Information in Form should be saved to Registration__c that I created
But got this Error
Error: RegistrationController Compile Error: Unexpected token ','. at line 25 column 65
Visualforce Page
apex:page controller = "RegistrationController">
<apex:sectionHeader title = "Registration Form" />
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Submit" action="{!WelcomePage}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection> collapsible = "false" columns="1">
<apex:pageMessages> </apex:pageMessages>
<apex:inputText label="Name" value="{!reg.Name}" />
<apex:inputText label="Username" />
<apex:inputSecret label="Password" />
<apex:inputSecret label="Confirm Password" />
<apex:inputText label="SecurityQuestion" size="1"> />
<apex:selectOptions>
value="{!SecurityQuestion}">
</apex:selectOptions>
</selectList>
<apex:inputText label="Answer"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Controller Class
ublic class RegistrationController {
Public pageReference RedirectToLoginPage() {
return null;
}
Public RegistrationController() {
reg = new Registration__c();
}
public Registrationcontroller(ApexPages.StandardController controller) {
}
Public PageReference RedirectToFinalPage() {
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference welcomePage(){
if (string.isBlank (reg.Name__c)) {
ApexPages.addMessage(new ApexPages.Message.severity.ERROR,'Enter Username!!'));
return null;
}
insert reg;
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference loginPage(){
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
public pageReference SignupPage() {
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
Public pageReference resetPassword(){
pageReference pg = new pageReference ('/apex/ResetPasswordPage');
return pg.setRedirect(true);
}
Public Registration__c reg {get;set;}
Public List<schema.PicklistEntry>
getSecurityList= Registration__c.Security_Question__c.getDescribe().getPicklistValues();
for(schema.PicklistEntry securityQn : getSecurityList) {
listSecurityQuestions.add(new SelectOption(securityQn.getLabel()));
}
Return listSecurityQuestions;
}
Public void sendEmail() {
Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage();
String[] ToAddress = new String [] {'esther@gmail.com '};
eMailObject.setToAddresses(ToAddress);
String subject = 'New Password';
eMailObject.setSubject(subject);
String mailBody = '<b> New Password was created <b>';
eMailObject.setHtmlBody(mailBody);
Messaging.sendEmail( new Messaging.SingleEmailMessage[]eMailObj});
}
}




Can you rewrite the last method as below.
Public void sendEmail() { Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage(); String[] ToAddress = new String [] {'esther@gmail.com '}; eMailObj.setToAddresses(ToAddress); String subject = 'New Password'; eMailObj.setSubject(subject); String mailBody = '<b> New Password was created <b>'; eMailObj.setHtmlBody(mailBody); Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {eMailObj}; Messaging.SendEmailResult[] results = Messaging.sendEmail(messages); }
Let me know if any error on it.
The total class looks as below.
public class RegistrationController { Public pageReference RedirectToLoginPage() { return null; } Public RegistrationController() { reg = new Registration__c(); } public Registrationcontroller(ApexPages.StandardController controller) { } Public PageReference RedirectToFinalPage() { pageReference pg = new pageReference ('/apex/WelcomePage'); return pg.setRedirect(true); } public pageReference welcomePage(){ if (string.isBlank (reg.Name__c)) { ApexPages.addMessage(new ApexPages.Message(Apexpages.Severity.ERROR,'Enter Username!!')); return null; } insert reg; pageReference pg = new pageReference ('/apex/WelcomePage'); return pg.setRedirect(true); } public pageReference loginPage(){ pageReference pg = new pageReference ('/apex/LogingPage'); return pg.setRedirect(true); } public pageReference SignupPage() { pageReference pg = new pageReference ('/apex/LogingPage'); return pg.setRedirect(true); } Public pageReference resetPassword(){ pageReference pg = new pageReference ('/apex/ResetPasswordPage'); return pg.setRedirect(true); } Public Registration__c reg {get;set;} Public List<schema.PicklistEntry> getSecurityList= Registration__c.Security_Question__c.getDescribe().getPicklistValues(); { for(schema.PicklistEntry securityQn:getSecurityList) { listSecurityQuestions.add(new SelectOption(securityQn.getValue(), securityQn.getLabel())); Return listSecurityQuestions; } } Public void sendEmail() { Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage(); String[] ToAddress = new String [] {'esther@gmail.com '}; eMailObj.setToAddresses(ToAddress); String subject = 'New Password'; eMailObj.setSubject(subject); String mailBody = '<b> New Password was created <b>'; eMailObj.setHtmlBody(mailBody); Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {eMailObj}; Messaging.SendEmailResult[] results = Messaging.sendEmail(messages); } }
If this solution help, Please mark it as best answer.
Thanks,

Writting an Apex Class
trigger EmailContact on Contact (after insert) { List<Messaging.SingleEmailMessage> emailList= new List<Messaging.SingleEmailMessage>(); EmailTemplate emailTemplate = [Select Id,Subject,Description,HtmlValue,DeveloperName,Body from EmailTemplate where name='Contract Signed Thank you']; for(Contact conObj:Trigger.new){ if (conObj.Email != null) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTargetObjectId(conObj.Id); mail.setSenderDisplayName('System Administrator'); mail.setUseSignature(false); mail.setBccSender(false); mail.setSaveAsActivity(true); mail.setTemplateID(emailTemplate.Id); mail.toAddresses = new String[]{conObj.Email}; emailList.add(mail); } } if(emailList.size()>0){ Messaging.SendEmailResult[] results = Messaging.sendEmail(emailList); if (results[0].success) { System.debug('The email was sent successfully.'); } else { System.debug('The email failed to send: '+ results[0].errors[0].message); } } }
This is what i have so far. i get an error that lines 9&15 are missing ','
@isTest private class EmailContactTestClass { static testMethod void validateEmailContact() { Contact c = new Contact(LastName='Test',Email='test@test.org'); System.debug(c.LastName); insert c; System.assertEquals(0, Limits.getEmailInvocations(); c = [SELECT id FROM Contact WHERE LastName ='Test' limit 1]; System.assertEquals(1, Limits.getEmailInvocations(); } }


The closing parenthesis is missing in System.assertEquals(1, Limits.getEmailInvocations() at both the places because of that you are getting compile-time error.
Try this
@isTest private class EmailContactTestClass {
static testMethod void validateEmailContact() {
Contact c = new Contact(LastName='Test',Email='test@test.org');
System.debug(c.LastName);
insert c;
System.assertEquals(0, Limits.getEmailInvocations());
c = [SELECT id FROM Contact WHERE LastName ='Test' limit 1];
System.assertEquals(1, Limits.getEmailInvocations());
}
}
Kindly mark as best answer if it helps.
Thanks
Shubham Jain

Soql for lookpup field
I tried the below
Select id,name from objectA where id in(select id form objectB where lookupfield='id'.




Since the objects are related you have fetch using relationship concept.
Try below :-
select id,Name,objectb__r.name from objectA__c where objectb__c=''someId"
Also refer this :-
https://developer.salesforce.com/forums/?id=906F0000000BNe7IAG
Kindly mark it as the best answer so that it can help others.
Regards,
Priya Ranjan

Error in list view when I use picklist field in list view filter




This seem to be a Known issue with list picklist lit view filter. Kindly review below reference.
https://trailblazer.salesforce.com/issues_view?id=a1p3A000000mDZOQA2&title=lightning-experience-cannot-save-list-view-with-error-filter-value-is-invalid
Also below are limitation when you are using picklist field in list view filter.
https://ideas.salesforce.com/s/idea/a0B8W00000GdfNkUAJ/pick-list-filter-in-list-view
https://ideas.salesforce.com/s/idea/a0B8W00000Gdbr0UAB/lightning-list-view-filters-need-to-work-better-with-picklist-fields
Please mark as Best Answer if above information was helpful.
Thanks,

update picklist value from a separate date field comparing to today's date
The flow tried to update these records: 8004M0000015XHhQAM. This error occurred: FAILED_ACTIVATION: Choose a valid contract status and save your changes. Ask your admin for details.. You can look up ExceptionCode values in the SOAP API Developer Guide.
the error occurs on this step
we want it to update automatically without any record creation or update. Any help would be appreciated!
Thank you




Can you please refer the below where the ask is to use Time-Dependent Workflow Action .
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A80gVSAR
Hope this is helpful..Please mark this as best answer!!
Regards,
Ranjan
Hi Demi,
Yes You can have multiple record type applied to the same Object but not to same record.
Let me explain you the concept of record type.
So on the contact object you have to create two record type. one as Staff and another as Student.
Also create two different page layout, one is staff pagelayout and another is student pagealout.
Assing the pagelayout i.e., staff record type should have Staff pagalyout and Student will have student pagelayout.
Create Contact.
When you click the new button to create contact, one modal box will pop up which will ask, for which kind of contact you wanna create. First option will be Staff and the Second will Student.
Choose Staff and then create the Record. It will create the contact record as Staff. Follow same for Student.
How to create the page layout and Record type, follow this article :-
https://trailhead.salesforce.com/en/content/learn/projects/customize-a-salesforce-object/create-record-types
https://www.sfdcpoint.com/salesforce/record-types-in-salesforce/#:~:text=Record%20types%20in%20Salesforce%20allow,different%20picklist%20values%20for%20each.
Hope this helps,
Kindly mark it as the best answer so that it can helps others as well.
Regards,
Priya Ranjan