• Marcilio Souza
  • 115 Points
  • Member since 2015
  • Salesforce Developer

  • Chatter
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
  • 29
I have two objects A and B, object A records related to B records,which i want display the count of that related records?
I have a picklist on a standard visualforce page. Based on the piclist value i want to display different page block section on the bottom of the page. I.e i want to divide the page in two sections.
I have some code a third party put in with zero test coverage.  I do not know how to write test coverage.  Any ideas?  I need 2% more coverage to meet the minimum of 75%.

I have to show a alert message before the Salesforce CRM user login in the ORG.

I try to use the login flow with visualforce following the documentarion below:

But I am having a problem when I reset a user password.
1 - My page with login flow is show the user click on 'Ok' button than execute - return Auth.SessionManagement.finishLoginFlow();
2 - They should go to the default reset password, but it is showing 'Can't display Page';
3 - If they click in log out he is redirect to my login flow page and start a loop.

Is there any to redirect to the default reset password page? 

Thank you in advanced

I'm studing Apex, Visualforce and Lightning for about six months.

I need some work for improve my experience give me your requirement and i'll develop.

If you like my work you pay.

Send me a e-mail.

Thank you!
Hi everyone,

I can't pass this challenge and.

Look this picture
User-added image

I was trying complete the Chatter Basis module and i was check the challenge this error happened.

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: NHZFCTCO

If i check again another error id come. Is it because MyDomain??

Someome can help me?
Works on update, but not o insert

Works fine on update, but not on insert. Record Type is not stamped on the activity.

trigger TaskAccountTypeContact on Task (before insert, before update) {
   For (Task T : trigger.new){            
            string WhoID = t.WhoID;
    Account a = [select id,recordtypeid from Account where id =:T.AccountId]; 
if(a.recordtypeid == '012i0000000Ou0CAAS'){
        t.Account_record_Type__c ='Customer Account';                
        if(a.recordtypeid == '012i0000000Ou0EAAS'){
        t.Account_record_Type__c = 'Prospect Account';                
        if(a.recordtypeid == '012i0000000Ou0DAAS'){
        t.Account_record_Type__c = 'Partner Account';               

I have followed the below code not to allow duplicates. But I don't want to display the error message. If there is duplicate record is created or existing record updated then shouldn't throw error simply skip that record. I mean do not insert the record in the object. 

Can someone help me
trigger contactDuplicatePreventer on Contact(before insert, before update) {

    Map<String, Contact> contactMap = new Map<String, Contact>();
    for (Contact Contact : System.Trigger.new) {
        // Make sure we don't treat an email address that  
        // isn't changing during an update as a duplicate.  
        if ((Contact.Email != null) &&
                (System.Trigger.isInsert ||
                (Contact.Email != 
                    System.Trigger.oldMap.get(Contact.Id).Email))) {
            // Make sure another new Contact isn't also a duplicate  
            if (contactMap.containsKey(Contact.Email)) {
                Contact.Email.addError('Another new Contact has the '
                                    + 'same email address.');
            } else {
                contactMap.put(Contact.Email, Contact);
    // Using a single database query, find all the Contacts in  
    // the database that have the same email address as any  
    // of the Contacts being inserted or updated.  
    for (Contact contact : [SELECT Email FROM Contact
                      WHERE Email IN :contactMap.KeySet()]) {
        Contact newContact = contactMap.get(Contact.Email);
        newContact.Email.addError('A Contact with this email '
                               + 'address already exists.');

  • December 09, 2016
  • Like
  • 0
Hi All, I am a salesforce admin trying to move this trigger with 0 % code coverage into prod. I understand the code but not sure how to write a test class. Help !!!!!

trigger UpdateContactInfo on soship__c (before insert) {
soship__c[] shipments = Trigger.new;    
Set<String> orderNumbers = new Set<String>();    
Map<Id,sohdr__c> orders = null;   
sohdr__c order = null;

for(soship__c ship : Trigger.new ){
     System.debug('order number '+ship.soship_order__c);    
  orders = new Map<Id,sohdr__c>(           
 [Select Id, sohdr_order__c,  sohdr_contact__c, sohdr_conemail__c,sohdr_conphone__c ,sohdr_conmethod__c                  
             from sohdr__c where Id in :orderNumbers]);
    for(soship__c shipment:shipments){      
        order = orders.get(shipment.soship_order__c);
      if(order != null  ) {                                    
      shipment.soship_contact__c = order.sohdr_contact__c;               
      shipment.soship_email__c = order.sohdr_conemail__c;            
      shipment.soship_phone__c = order.sohdr_conphone__c;          
      shipment.soship_conmethod__c = order.sohdr_conmethod__c;                    
         system.debug(' order is null' );                 

} }
 I have following code in a REST service exposed through Force.com site
Case c = new Case (AccountId = '0019E000002pKMCQA2', description='est mgsg', Origin='Phone', Status='New');
insert c;

When I call this REST service from hurl.it, it works fine and creates case.
When I call this same REST service from different program, it fails. I get error Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, invalid parameter value: []

Pleaes note that all the field values are hard coded, so there is no chance of 2 clients providing different data to REST service.

Any help highly appreciated.
Hi ,

Can someone suggest the best way to learn visualforce pages development with examples.


I have a number field in Contact Object(Parent).
I want to create multiple records in Case Object(child)  based on the value in  number field in Contact Object.


I opened a ticket with support on this and they are stumped, they sent me here. Seems like a simple question. I have a picklist in accounts. What I want to do is when an user is opening a case for that account, I want the value of the picklist to appear in the new case form. It will show the sensitivity of the customer and the support team will know right away how to address the problems. I tried to use formula fields but they do not support picklist values. Any thoughts would be appreciated.
My code is 
public class  SearchNoButton{
public String find { get; set; }
public list<Customer__c> cuslist{get;set;}
public String searchtext{get;set;}

public string s ;
public void find()
cuslist=new list<Customer__c>();
s  = '%' + searchtext  + '%'; 

[select Name,Name__c,Status__c,age__c from Customer__c where Name__c LIKE : s];



visualforce page:
<apex:page controller="SearchNoButton" action="{!find}">
<apex:pageblock title="search Customer">
<apex:form Rendered="{!find}">
name  <apex:inputtext value="{!searchtext}" Rendered="{!find}"/>
<table border='1' width='100%'>
  <apex:repeat value="{!cusList}" var="a">



I've searched a lot in the forums and I cannot seem to find a solution to my problem.

What I am looking for is :

I have a native login page for my Android App. I want to allow my users to login to my Android App using their SalesForce username and password. I dont want to exchange any data from SalesForce to my App, but simply just allow them to acces my app if they have a valid SalesForce ID.

How can i achieve this ?


I have two objects A and B, object A records related to B records,which i want display the count of that related records?
I'm trying to edit a Opportunity Custom Field we call Group Contract Fee. Right now it is set up to populate a $75 fee if its International and a $50 if its Domestic and if it’s a AirHotel booking, it marks it as $0 Contract Fee.
IF((ISPICKVAL(Intl_Dom__c,'I') && (Air_Hotel__c = False) && (Account.Waive_Contract_Fee__c) = False),75,
IF((ISPICKVAL(Intl_Dom__c,'D') && (Air_Hotel__c = False) && (Account.Waive_Contract_Fee__c) = False),50,
IF((Air_Hotel__c = True),0,0)))
I need to make it a bit more complex: I need to also include that if it is a booking made through 2 specific accounts, that books a group 20 passengers or more, International and Air Only - I need that to also show $0.00 in the Contract fee field
IF((ISPICKVAL(Intl_Dom__c,'I') && (Air_Hotel__c = False) && (Account.Waive_Contract_Fee__c) = False),75,
IF((ISPICKVAL(Intl_Dom__c,'D') && (Air_Hotel__c = False) && (Account.Waive_Contract_Fee__c) = False),50,
IF((Air_Hotel__c = True) || ((ISPICKVAL( Intl_Dom__c,'I' = True) && ( Air_Hotel__c  = False) && ( Total_Pax__c  < 19) && ( Account.Travel_Agency_Id__c,’14913275’ || '52667252'= True))),0,0))
But I’m getting a Error: Syntax error. Missing ')'
I am going through the Trailhead training on Lightning Components and I created a custom domain per the instructions to do the training in. When I attempted the first challenge, I logged into Developer Edition and created the Camping Item object with custom fields exactly like the instructions indicated but I get an error saying I did not create Camping_Item__c. While troubleshooting, I noticed if I hit "Launch Developer Edition" it launches the na30.salesforce.com site, even when I disconnect and re-connect using my custom domain it continues to do this. Why can't I connect trailhead to my custom domain?
I can't see the "Send Mail" button on top of my Opportunity tab in my developer org.
I checked and the button is correctly placed in the page layout.
Any idea? Am I missing some mandatory information in my records?

I have class with parameterised constractor
public class main{
public string head;
public string industry;
publuc list<account> acc;
public mail(string nam,string ind){
acc=new list<account>();

public void dodml(){
account a=new account();
insert acc;

so please tell me 
how to call this class in vf page
Hi all,
I came across a problem that SOSL returns less rows than expected. SOQL returns the right number of rows.
Basically, in below snippet, I tried to get all rows which string 205640 exists in vin_person__c field.
SOSL only returns 2 rows. But SOQL return 6 rows including 2 rows in SOSL result.

What could be the problem?
list<list<sobject>> slist =[FIND '*205640*'  IN all FIELDS RETURNING VIN__c (Id,Name,Program__c,VIN_Person__c,Person__c,Car__c where Program__r.Account__c='001o000000ODW6lAAH' AND Inactive__c=FALSE ) LIMIT 100];


list<vin__c> svin = [select Id,Name,Program__c,VIN_Person__c,Person__c,Car__c from vin__c where Program__r.Account__c='001o000000ODW6lAAH' AND VIN_Person__c LIKE '%205640%' AND Inactive__c=FALSE LIMIT 100];

I have a picklist on a standard visualforce page. Based on the piclist value i want to display different page block section on the bottom of the page. I.e i want to divide the page in two sections.
I have some code a third party put in with zero test coverage.  I do not know how to write test coverage.  Any ideas?  I need 2% more coverage to meet the minimum of 75%.