• Diego Arenas Casado
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies
Hi , I am trying to insert list of Contacts from visualforce page on a Button click. And after button click the page should automatically go back to account page.

I have Created a Custom Button on an Account page.

The list also has a Validation to check if the first name is updated or not.

Basically - 1 - Contact First name must not be blank.
2 - On Click of Save, Added Contacts should be inserted to the database.
3 - after insert Source account record should open

My below code saves the records and redirects correctly but does not fire validation on first name.

Please find controller code below :- 

public class AddMultipleContacts {
  
    public List<Contact> ContactList {get;set;}     
    public Integer rowNum{get;set;}
    public string AcctID{get;set;}
   
       
    sObject con = [Select ID ,FirstName , LastName from Contact LIMIT 1];
    
    public AddMultipleContacts(ApexPages.StandardController controller ){
        AcctID = ApexPages.currentPage().getParameters().get('Id');
        system.debug('-AcctID--'+AcctID);
        ContactList = new List<Contact>(); 
        ContactList.add(new contact(Accountid = Acctid));        
    }        
   
 
    
    public PageReference save(){
            for(Contact con :ContactList) 
            {
            if(con.FirstName == '' || con.FirstName == null)
                
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please enter Contact First name'));
            } else 
                
            {
                insert ContactList ;
            }
            }    
        PageReference page1 = new PageReference ('https://ap4.salesforce.com/'+ AcctId ); 
        Page1.setRedirect(true) ;  
        return page1;        
            } 
          
    public void insertRow(){
        ContactList.add(new contact(Accountid = Acctid ));
        
    }    
    public void delRow(){
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        ContactList.remove(rowNum);   
    }        
    public PageReference Cancel(){
     PageReference page2 = new PageReference ('https://ap4.salesforce.com/'+ AcctId )   ;
     Page2.setRedirect(true) ;  
    return page2;
}
    
    
}
Hi

I'm trying to make a salesforce apex call to an external system that has a certificate signed by a valid CA (thawtedvssl) https://developer.salesforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawtedvssl

And get the following error:
IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The certificate was not created in salesforce and then signed by the CA, that is, in salesforce there isn't certificate installed
The customer IT department created the certificate.

This is the information provided by the CA valid by salesforce
    CN = Thawte DV SSL CA, 
    OU = Domain Validated SSL
    O = "Thawte, Inc."
    C = US
    Signature algorithm name: SHA1withRSA

But the certificate that has the external system has the following information
    CN = thawte DV SSL CA - G2
    OU = Domain Validated SSL
    O = thawte, Inc.
    C = US
    Signature algorithm name: sha256RSA

It's possible that Salesforce not recognize as a valid CA certificate?
What options can I try?

Regards
Diego Arenas
Hi,
I created a few REST WS in salesforce and I need create the WADL (Web Application Description Language) . How I can create them automatically?

Regards
 
Hi, I want to make a mix of clients by code. But to put the sentence "MergeRequest MergeRequest mreq = new ();" Result: Invalid type.
What would be the right call? (Sample code at the end)
Thanks
----------------------------------------------------------------------
Hola, quiero realizar una combinación de clientes por código. Pero al poner la sentencia  "MergeRequest mReq = new MergeRequest();" Resultado: tipo inválida. 
¿Cuál sería la llamada correcta?
----------------------------------------------------------------------

URL: https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_merge.htm
Code:
Account masterAccount = [Select Id, Description From Account where id = '001250000044e1z'];
Id recordMergeId = '001250000044e08';

MergeRequest mReq = new MergeRequest();
masterAccount.Description = 'Was merged';
mReq.masterRecord = masterAccount;
mReq.recordToMergeIds = new String[] { recordMergeId };
MergeResult mRes = binding.merge(new MergeRequest[] { mReq })[0];

if (mRes.success){
    // Write the IDs of merged records
    for(String item : mRes.mergedRecordIds){
        system.debug('Merged Record ID: ' + mergedId);
    }
    // Write the updated child records. (In this case the note.)
    system.debug('Child records updated: ' + mRes.updatedRelatedIds.Length);
}
else{
    system.debug('Failed to merge records. Error message: ' + mRes.errors[0].message);
}
This might seem like a pretty elementary question.
Current number of API requests is exceded. So I am looking for a way to export data from Salesforce without the API.
Is there any way to export data without API or maybe some 3rd party products "increase" API request limit?
Does Apex/Visualforce selfdefeloped apps also use API and could exceeds number of API requests?
Hi , I am trying to insert list of Contacts from visualforce page on a Button click. And after button click the page should automatically go back to account page.

I have Created a Custom Button on an Account page.

The list also has a Validation to check if the first name is updated or not.

Basically - 1 - Contact First name must not be blank.
2 - On Click of Save, Added Contacts should be inserted to the database.
3 - after insert Source account record should open

My below code saves the records and redirects correctly but does not fire validation on first name.

Please find controller code below :- 

public class AddMultipleContacts {
  
    public List<Contact> ContactList {get;set;}     
    public Integer rowNum{get;set;}
    public string AcctID{get;set;}
   
       
    sObject con = [Select ID ,FirstName , LastName from Contact LIMIT 1];
    
    public AddMultipleContacts(ApexPages.StandardController controller ){
        AcctID = ApexPages.currentPage().getParameters().get('Id');
        system.debug('-AcctID--'+AcctID);
        ContactList = new List<Contact>(); 
        ContactList.add(new contact(Accountid = Acctid));        
    }        
   
 
    
    public PageReference save(){
            for(Contact con :ContactList) 
            {
            if(con.FirstName == '' || con.FirstName == null)
                
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please enter Contact First name'));
            } else 
                
            {
                insert ContactList ;
            }
            }    
        PageReference page1 = new PageReference ('https://ap4.salesforce.com/'+ AcctId ); 
        Page1.setRedirect(true) ;  
        return page1;        
            } 
          
    public void insertRow(){
        ContactList.add(new contact(Accountid = Acctid ));
        
    }    
    public void delRow(){
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        ContactList.remove(rowNum);   
    }        
    public PageReference Cancel(){
     PageReference page2 = new PageReference ('https://ap4.salesforce.com/'+ AcctId )   ;
     Page2.setRedirect(true) ;  
    return page2;
}
    
    
}
Hi

I'm trying to make a salesforce apex call to an external system that has a certificate signed by a valid CA (thawtedvssl) https://developer.salesforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawtedvssl

And get the following error:
IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The certificate was not created in salesforce and then signed by the CA, that is, in salesforce there isn't certificate installed
The customer IT department created the certificate.

This is the information provided by the CA valid by salesforce
    CN = Thawte DV SSL CA, 
    OU = Domain Validated SSL
    O = "Thawte, Inc."
    C = US
    Signature algorithm name: SHA1withRSA

But the certificate that has the external system has the following information
    CN = thawte DV SSL CA - G2
    OU = Domain Validated SSL
    O = thawte, Inc.
    C = US
    Signature algorithm name: sha256RSA

It's possible that Salesforce not recognize as a valid CA certificate?
What options can I try?

Regards
Diego Arenas
Hi, I want to make a mix of clients by code. But to put the sentence "MergeRequest MergeRequest mreq = new ();" Result: Invalid type.
What would be the right call? (Sample code at the end)
Thanks
----------------------------------------------------------------------
Hola, quiero realizar una combinación de clientes por código. Pero al poner la sentencia  "MergeRequest mReq = new MergeRequest();" Resultado: tipo inválida. 
¿Cuál sería la llamada correcta?
----------------------------------------------------------------------

URL: https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_merge.htm
Code:
Account masterAccount = [Select Id, Description From Account where id = '001250000044e1z'];
Id recordMergeId = '001250000044e08';

MergeRequest mReq = new MergeRequest();
masterAccount.Description = 'Was merged';
mReq.masterRecord = masterAccount;
mReq.recordToMergeIds = new String[] { recordMergeId };
MergeResult mRes = binding.merge(new MergeRequest[] { mReq })[0];

if (mRes.success){
    // Write the IDs of merged records
    for(String item : mRes.mergedRecordIds){
        system.debug('Merged Record ID: ' + mergedId);
    }
    // Write the updated child records. (In this case the note.)
    system.debug('Child records updated: ' + mRes.updatedRelatedIds.Length);
}
else{
    system.debug('Failed to merge records. Error message: ' + mRes.errors[0].message);
}