+ Start a Discussion
enJoyLifeenJoyLife 
Hello :)

I would like to write a POST method to create Contact. 
1) Check if email is already exist in SF and return SF Id to external service
2) If email doesn't exist create contact and return Id

@HttpPost
    global static Id createContactFromExternalCRM(String lastName, String firstName, String email, String phone) {
        
            Contact con = new Contact(
            LastName = lastName, 
            FirstName = firstName, 
            Email = email, 
            Phone = phone );
           
            insert con;
        return con.id;
        
    }
    
Thank you :)
Best Answer chosen by enJoyLife
Maharajan CMaharajan C
Hi,

Please try the below code:
 
@HttpPost
    global static Id createContactFromExternalCRM(String lastName, String firstName, String email, String phone) {
        
        List<Contact> conList = [Select Id,Email from Contact where email =: email];
        if(!conList.isEmpty()){
            return conList[0].id;
        }
        else{
            Contact con = new Contact(
                LastName = lastName, 
                FirstName = firstName, 
                Email = email, 
                Phone = phone );
            insert con;
            return con.id;
        }
    }

Thanks,
Maharajan.C
Mayank_SareenMayank_Sareen 
Hi all , 
I am new to salesforce and aim to be a certified developer , can anyone please give me some suggestions and tips on how to prepare for salesforce platform developer 1 exam.
Thanks
Best Answer chosen by Mayank_Sareen
Shubham NandwanaShubham Nandwana
Hi Mayank,
To prepare for developer 1 exam you can:
1. Follow study guide http://certification.salesforce.com/SG_CertifiedPlatformDeveloperI.pdf, clear your basics and you will be able to clear the exam.
2. Start with trail mixes suggested for developer 1 exam (https://trailhead.salesforce.com/users/00550000006yDdKAAU/trailmixes/prepare-for-your-salesforce-platform-developer-i-credential).
3. Check http://sfdctrail.com/2016/01/15/salesforce-platform-developer-1-certification-tips/ for topic wise distribution and study links for different topics. 
4. You can also find no. of sample questions on google. Like on such link: http://mansoorsfdc.blogspot.com/2016/12/salesforce-certified-platform-developer.html
NOTE: The DEV401 exam has been revised so do not rely solely on some question bank.

Select it as best answer if it helps and reply if any other help is needed.

Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
Rahul Singh Rana 9Rahul Singh Rana 9 
Hello,

I have complete both requirements of PD 2 certificate, MCQ and Trailhead Badges. I have also linked my Webassessor account with trailhead account. It has been almost one week and I am still waiting for my certificate. I have raised mutiple cases for this but no response. My questions are :

1) Is it common for certificate to arrive late or is it just my case, please let me if anyone of you faced similar situation.
2) Is there any way to reach certificate team apart from guided help on the website.

Also any guess why does it take so long to award this certificate, once you have completed all the requirements. For example in case of proctored exam the certificate is awarded immediately. 

Best Regards,
Rahul
Best Answer chosen by Rahul Singh Rana 9
jigarshahjigarshah
Rahul,

I am glad that the PD2 certificate arrived for you. If you intend to learn about CPQ here are the resources you could use.
  1. Salesforce CPQ Basics Trailhead Module (https://trailhead.salesforce.com/en/modules/sf_cpq)
  2. Moreover, the Salesforce Partner Community (http://partners.salesforce.com/)has some amazing resources that you could use.
  3. You can also follow the @SalesforceCPQ twitter handle for updates and use hash tag #askforce or @asksalesforce for any help with issues if you are stuck.
  4. Once you are ready you can then take the Salesforce CPQ Specialist certification (http://certification.salesforce.com/cpqspecialist)to showcase proven CPQ expertise 
All said and done, implementaiton experience on real world projects is a must and no amount of theoretical understanding & practice replaces that. Hence, try to have atleast one lifecycle implementaiton that you have been a part of before taking the certification.

Also, if your issue is now resolve, please close this thread.
Vijay ummedaVijay ummeda 
Hi All,

I am  creating Vf page  while rendering the Vf page i am geting the below error .

Error is in expression '{!case.Asset}' in component <apex:inputField> in page newaccountpage

Asset is the Lookup filed for the case object

<apex:page standardController="case" >

<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Case Details " collapsible="true">
<apex:inputField value="{!case.Subject}"/>
<apex:inputField value="{!case.CaseNumber}"/>
<apex:inputField value="{!case.Priority}"/>
<apex:inputfield value="{!case.Asset}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Thanks,
Vijay.
Best Answer chosen by Vijay ummeda
Maharajan CMaharajan C
HI Vijay,

Change the {!case.Asset}   ==> {!case.AssetId}

AssetId is the API Name for Asset field.
 
<apex:page standardController="case" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Case Details " collapsible="true">
                <apex:inputField value="{!case.Subject}"/>
                <apex:inputField value="{!case.CaseNumber}"/>
                <apex:inputField value="{!case.Priority}"/>
                <apex:inputfield value="{!case.AssetId}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks,
Maharajan.C
Sahba Shabrokh 3Sahba Shabrokh 3 
Hi all,

I need more flexibility in the lightning component aspect of SF and i am relativity new in this.

how can i convert this detailed URL button into a lightning component: 

/apex/echosign_dev1__AgreementTemplateProcess?masterId={!Quote.Id}&templateId=a2a1p00000667Xw

Just a background to this: since lighting you cannot use java script to validate a button. With lightning component you can use lightning record pages to hide components based on criteria.
Best Answer chosen by Sahba Shabrokh 3
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sahba,

Greetings to you!

You can use Quick Actions, Custom Buttons, or Apex. Go through this trailhead module to understand the alternatives available:
Lightning Alternatives to JavaScript Buttons (https://trailhead.salesforce.com/en/modules/lex_javascript_button_migration)

Also, Please refer to the below links:

https://www.bayforce.com/wp-content/uploads/2017/10/Bayforce-JavaScript-Lightning-Experience-White-Paper.pdf

Also, You can use Lightning Experience Configuration Converter to convert JavaScript buttons/URL to lightning. Please refer to the below links which might help you further with the above issue.

https://developer.salesforce.com/blogs/2018/06/convert-javascript-buttons-to-lightning-friendly-alternatives-with-the-lightning-experience-configuration-converter.html

https://help.salesforce.com/articleView?id=lcc_considerations.htm&type=5

https://developer.salesforce.com/blogs/developer-relations/2016/09/take-the-first-steps-ways-you-can-replace-javascript-buttons.html


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Mubarak HussainMubarak Hussain 
Hi All,
What is an Workbench in Salesforce,and what is the difference between workbench,developer console and Force.com Explorer.


Thanks
Best Answer chosen by Mubarak Hussain
Amit Chaudhary 8Amit Chaudhary 8
Link:- https://workbench.developerforce.com/login.php
Workbench is a powerful, web-based suite of tools designed for administrators and developers to interact with Salesforce.com organizations via the Force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface. Workbench also provides many advanced features for testing and troubleshooting the Force.com APIs, such as customizable SOAP headers, debug logs for API traffic, backward compatibility testing with previous API versions, and single sign-on integration within the Salesforce application.

Please check below post for more detail
https://developer.salesforce.com/page/Workbench
http://www.salesforcetutorial.com/workbench-salesforce-using-workbench/

Please let us know if this will help you

between workbench,developer console and Force.com Explorer all three are used almost for same.

Developer Console: The Developer Console is accessible from within your Salesforce organization, and provides a collection of tools you can use to create, edit, debug and test applications.

Force.com IDE: The Force.com IDE is a full-featured, Eclipse-based coding environment, with capabilities like code completion, version control, collaborative development, and project sharing.

Force.com Explorer: This cross-platform AIR application, still in beta, provides a lightweight tool that lets developers browse their schema, custom objects and fields, and build and test SOQL queries.

Workbench: This powerful, web-based suite of tools designed for adminstrators and developers to interact with Salesforce.com organizations via the Force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface.
https://developer.salesforce.com/page/Tools

Please let us know if this will help you

Thanks
AMit Chaudhary
pavan kumar 1864pavan kumar 1864 
I have a formula field name Partner_involved__c on opportunity object, it should be marked 'true' when amount field in opportunity object is not blank, so i have written a formula-

IF(ISBLANK(Amount),"True","False")

but here irrespective of the amount field whether it is blank or not ,
The Formula field named Partner_involved__c is marking as 'False'.


Can anyone please explain how i can overcome this.
Best Answer chosen by pavan kumar 1864
CharuDuttCharuDutt
Okay I Thought It Was A CheckBox Field Now  BElow Both Method Is Working On My Org As Your Formula Return Data Type is Text  Naow Try Below Code After Refreshing Dev Console Window And Org Window
Formula
IF(NOT(ISBLANK( Amount )),'True','False')

Apex Code
 if(acc.Amount == 'True'){
           system.debug('Hello');
       }
Tracy Oden 31Tracy Oden 31 
Hi, I am trying to write a datetime formula but having a problem. The goal is to check a 'date' field (Service_Date__c) to determine if the (Service_Date__c) date field is blank. If the (Service_Date__c) date field is blank, I want to return null. If the date field is not blank, then I want to return the following 'datetime' formula DateTime__c +   300/1440.

I have some other formulas dependendent on the 'datetime' formula DateTime__c. The DateTime__c field is a formula field that is depenendent on the Service_Date__c 'date' field--all of which are throwing errors. I can fix the errors if I can get help with the above.

Thank you in advance!

IF(NOT(ISBLANK(Service_Date__c)), DateTime__c   +   300/1440)
Best Answer chosen by Tracy Oden 31
Dev BoorlaDev Boorla
Hi,
You will need to provide 3 params lik below:
IF(NOT(ISBLANK(Service_Date__c)), DateTime__c   +   300/1440, null)


Best,
Shayne Hudson 15Shayne Hudson 15 
Just failed my Admin 201 test. I'm so angry and frustrated. I took a ton of practice tests and did well on them. The actual test was nothing like the practice test. The actual test was ridiculously vague.  Anyway, does anyone know where I can find practice tests that are actually up-to-date? Any suggestions on how to study that doesn't cost a billion dollars? I'm just super frustrated and angry right now. Thanks for the help. 
Best Answer chosen by Shayne Hudson 15
jigarshahjigarshah
Shayne,

First of all, I understand that you feel bad on failing the certification, but at the same time believe and understand that its not the worst and that, it has not only happened to you but hundreds of developers / admins out there. So, don't get frustrated, gather yourself up and will help you with some pointers to help you get certified.

Here's your game plan. 
  1. Understand your areas of strength and weakness: At the end of a certification exam, Salesforce provides a breakup of how you did in the various areas / topics included as a part of the certification exam. Use this evaluation report as a tool to prepare for the exam. Any easire way to do this, is to list down all the topics for exam from the study guide and use a scoring meachanism of 1 to 3 where 1 = Not Aware, 2 = Know it somewhat but requires study, 3 = I know it well. Then focus on the Ones and Twos and then the threes.
  2. Be hands on: Taking a certification does not necessarily always prove your capability to deliver a Salesforce implementation. Don't get this otherwise, neither am I trying to devalue the certifications nor question the ability of certified Salesforce champions with certifications. This is a general observation that I have over the years of my implementaiton experience with Salesforce. Hence, if you have no handson experience with Salesforce, I would recommend having atleast 6 months of handson before you attempt the certification.
  3. Prepare a study plan and study hard: Taking a Salesforce certification can be compared to taking any other school test and where you need to study hard for it and maybe memorize certain specific thigns if required. The handson experience may give you the edge, but YOU WILL NEED TO STUDY !!
  4. Read the Study Guide: Read the Admin Certification Study Guide well to understand the weightage of different topics. This plays an important role in your preparation and focus on topics with higher weightage first to cover the maximum possibele topics.
  5. Moreover, if your organization has a Salesforce Partner Training access, take the following self paced course - Preparing for Your Salesforce Administrator Certification which gives detaila about the what, who, whys and hows about the Admin certification exam.
  6. Take time to read through the amazing blogs by some of the people from the Salesforce community who taken the certification exam like me and have shared their experience
    1. http://www.merivisblog.com/study-salesforce-admin-exam/
    2. http://www.salesforceben.com/certified-admin-mock-exam/
    3. https://jenwlee.wordpress.com/2016/02/29/salesforce-administer-exam-preparation-exam-taking-strategy/
    4. https://www.adminhero.com/beginners-guide-to-salesforce-certification/
  7. Take Practice Exams: Refer to the following mock exam preparation content for the certification. I have personally refererred these durign my certification and found them quite reliable.
    • https://quizlet.com/149448734/salesforce-administrator-exam-flash-cards/
    • http://focusonforce.com/salesforce-adm-201-exam-questions/
    • http://www.certifiedforce.com/sample-questions/administrator-quiz-1
Hope that helps. I can share my certification study notes with you if you need. Just email me at jigar189@gmail.com. I would love to hear from you once you clear your certification. Cheers!!

Please mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.
SKTSKT 
I have a requirement to fetch Contact Region from Contact and update the same on User.

Here is my logic:
 
list<user> user = [SELECT name,Region__c from User where isactive = true];
  Set<string> str = new Set<string>();
        for(user u1 : user){
            str.add(u1.name);
        }

        List <Contact> Contact = [
 select id,Salesforce_User__c,Contact_Region__r.name  from contact where Contact_Region__c != null];
                                      
                                      
        Map<id, list<String>> usertcMap = new Map<id, list<String>> ();
        for (Contact Contacts : Contact) {
            if(!usertcMap.containsKey(Contacts.Salesforce_User__c))
                usertcMap.put(Contacts.Salesforce_User__c, new list<string>{Contacts.Contact_Region__r.name});
        else
            usertcMap.get(Contacts.Salesforce_User__c).add(Contacts.Contact_Region__r.name);
        }
        list<User> userupdates = new list<user>();
        for(User us : user){ 
            if(usertcMap.containsKey(us.id))
            {
                 
                list<string> allProsList =usertcMap.get(us.id);
                us.Region__c = allProsList;
                userupdates.add(us);
            }
        }

        if(!userupdates.IsEmpty())
            update userupdates;


now when i am trying to run the above logic, i am seeing this error:
Illegal assignment from List<String> to String

Can anyone please let me know how to overcome this error?
Thanks!
Best Answer chosen by SKT
Suraj Tripathi 47Suraj Tripathi 47

Hi SKT,

Please find the solution.

us.Region__c = string.valueOf(allProsList);

Please mark it as the Best If it helps you.

Thank You