• balakrishna mandula 6
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 7
    Replies
Hi,
 I have two picklist fileds called Approval Status with Values "Committed, Approved" and Proposal Type with values "Quote and Order" on same object. 
And I have custom button called Convert To Order on detail page, if I click on Convert to Order but it should check with Approval Status field if it is having field value is Approved then Proposal Type should be changed to Order value.
for this I have created a custom button and added JavaScript OnClick event as below. 

{!IF( ISPICKVAL( Custom_Object__c.Approval_Status__c , 'Approved'),
       TEXT( Custom_Object__c.Proposal_Type__c )='Order' ,'Quote')}

But it's not working when I click the button
Hi,
I am creating web-to-lead and converting that lead into contact not opportunity. while converting lead, if there is duplicate accountname in lead convert detail page then
1. Error is to be displayed on convert detail page
2. Mail should be sent to Email which is there in email field on lead saying "Duplicate Account found"
 
trigger Duplicatecheck on Account (before Insert, before Update) {
Map<String, Id> mapAccount = new Map<String, Id>();
Set<String> setAccName = new Set<String>();
Set<String> email = new Set<String>();
List<String> sendTo = new List<String>();
List<Messaging.SingleEmailMessage> mails =new List<Messaging.SingleEmailMessage>();
list<Account> Acclist=new list<Account>();
    String subject='Lead Duplicate';
 for(Account acc : trigger.new){
        setAccName.add(acc.Name);
        sendTo.add(acc.L_Email__c);
        Acclist.add(acc);
   // System.debug('Contact Name :'+acc.LastName);       
     for(Account acc1 :[SELECT Id,Name FROM Account WHERE  Name IN :setAccName]){ 
        // String x=acc1.Name;
         //String y=x.toUpperCase();
        mapAccount.put(acc1.Name, acc1.Id);
       //System.debug('Contact List:'+acc1); 
        if(acc.Name==acc1.Name){
            
          /*  if(true) {
            Messaging.SingleEmailMessage email1 = new Messaging.SingleEmailMessage();  
             String[] toAddresses = new String[]{'krishnasfdc07@gmail.com'};
            email1.setSubject(subject);
             email1.setToAddresses(toAddresses);
            email1.setPlainTextBody('Hi This is '+acc1.Name+' Duplicate.');
             System.debug('email is'+email1);
             mails.add(email1);
             
              // Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email1});
           // System.debug('contains Key is : '+mapContact.containsKey(acc.LastName)); 
            //System.debug('get Key is : '+mapContact.get(acc1.LastName));
            
            
            //acc.addError('There is already another Account with the same Name. ' +'Refer: <a href=\'/' + mapAccount.get(acc1.Name) + '\'>' + acc1.Name + '</a>',FALSE);
             
          //Messaging.sendEmail(mails);  
            }
            */
             acc.addError('There is already another Account with the same Name. ' +'Refer: <a href=\'/' + mapAccount.get(acc1.Name) + '\'>' + acc1.Name + '</a>',FALSE);   
        }
     }
  }
    
}


 
I am new to javascript. I want to learn JavaScript with simple example.

Below is the code which is not executing
<apex:page >

<apex:outputPanel >
   <apex:pageMessages id="demo"/>
</apex:outputPanel>

<script type = "text/javascript">
  function myfunction(){
    var l = 10;
    var b = 20;
    var ar = l * b;
    document.getElementById("demo").innerHtml = ar;
  }
</script>  
</apex:page>

The above code is not giving area.

Please help me out.
Hi,

I want to know the no.of  records processed/updated in Batch apex. I know by implementing Database.stateful it can be achieved. I don't know how to do it.

e.g.,
There are 1500 records in Opportunity object I try to edit one field based on some condition. Some of the records ate not meeting the criteria, so not being updated. I want know the exact no.of of records which are updated.

Thanks in advance
Bala
Hi,

I have a visulaforce page that is having picklist field which populates all the SObjects in my org.
My requirement is to populate all the fields of the particular SObject selected in piclist field.
e.g., If I select Account object in picklist field, then automatically all the fields to be displayed in the page.

Note: I used DescribeSobject ( Dynamic Apex) to display the objects.

VF:

<apex:page controller="CustomObjCon">
<script>
   function showFieldsOfObject(){
     showFields();
  
   }
</script>

<apex:form >
   CustomObjectNames: &nbsp;&nbsp;&nbsp;
     <apex:selectList value="{!pickname}" multiselect="false" size="1" >
        <apex:selectOptions value="{!names}"/>
     </apex:selectList>
</apex:form>
</apex:page>


public class CustomObjCon
{

   
   public String pickname { get; set; }
   Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
   public List<SelectOption> getNames()
   {
          List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();  
          List<SelectOption> options = new List<SelectOption>();
          
   
           for(Schema.SObjectType f : gd)
           {
                // if(f.getDescribe().getName().contains('__c')) // for custom objects only
                 options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
           }
          return options;
   }

Thanks in Advance
Bala
I have done integration using SOAP API, from on SF org to another Org. I have coded one class in first Org1 to insert opportunity record as follows.
  //Webservices SFDC to SFDC
global class WsdlOpportunityCls{
  webService static void InsertOptRecord(String name,String Description){
    Opportunity op = new Opportunity();
    op.name = Name;
    op.Description= Description;
    op.StageName = 'Qualification';
    op.CloseDate = Date.today();
   
    insert op; 
 
  }

}

I have generated wsdl file for this class and partner wsdl of this org.

And I have parsed these two wsdls in another org to integrate. I successfully inserted records into Org2 when I try to insert records from Org2 thru SOAP API.

Below class to invoke the webservice method of above class.

public class Source_Opportuinity_Class{
  @future(callout = true)
  public static void Source_Invoke_Opt_Method(List<Id> listId){
 
     List<Opportunity> oppRec = new List<Opportunity>();
     oppRec = [Select Name, Description, Account.Name from Opportunity where Id IN : listId];
   
     Source_Partner_Cls3.Soap obj1 = new Source_Partner_Cls3.Soap();
     Source_Partner_Cls3.LoginResult lres = obj1.login( 'balakrishna.mandula@birlasoft.com', 'Jason123@vXoMT8HKsuG25xVuQDK4msfc');
    
     Target_Oppty_WSDL.WsdlOpportunityCls obj = new Target_Oppty_WSDL.WsdlOpportunityCls();
     obj.sessionHeader = new Target_Oppty_WSDL.sessionHeader_element();
     obj.sessionHeader.sessionId = lres.sessionId;
    
    // for( Opportunity oppt : oppRec){
      // obj.InsertOptRecord ( oppt.Name, oppt.Description);
    // }         
   
    for(opportunity opt :oppRec ) {
      obj.InsertOptRecord(opt.name, opt.description);
    }
   
         
 
  }
}

Trigger to invoke Source_Opportuinity_Class

trigger Oppt_to_Invoke_toIntegrate on Opportunity (after insert, after update) {
   List<id> listid = new List<Id>();
   for(Opportunity oppt : Trigger.new){
      listId.add(oppt.id);
   }
   Source_Opportuinity_Class.Source_Invoke_Opt_Method(listid);

}

When I try to create records in Org2 those records are being loaded into Org1 using SOAP API.

My requirement is to use Bulk API to load large amount of data.

Please help me how to do Bulk API?

Regards,
Balakrishna

I am new to webservices, I am working on Integration with SQL Server using BULK API. There is already a .Net tool which is used to load data from/to SFDC to/from SQL Server using SOAP API. When we run this tool it loads data from SQL Server to SFDC vice versa.
There is App.config file in the tool which is used for SOAP API ( I hope so because I don't know .net). My job is to do small changes in the tool for BULK API.

App.config

<applicationSettings>
        <Synchronization_Tool.Properties.Settings>
            <setting name="Synchronization_Tool_PROD_SalesForce_SforceService" serializeAs="String">
                    <value>https://test.salesforce.com/services/Soap/u/12.0</value> // this working fine
                    <!--<value>https://ap1.salesforce.com/services/async/30.0/job</value>--> //This bulk api is giving    error like Remote server error.
                  </setting>
      </Synchronization_Tool.Properties.Settings>
</applicationSettings>

There is also Reference.cs file in the Visual Studio tool which is generated automatically by the tool. The generated code contains few lines which are having soap word as below.

Reference.cs

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:partner.soap.sforce.com")]

public partial class UpsertResult {


Please help me to work for BULK API. where should I change the code, how to solve.

Thanks in advance

Regards
Balakrishna

Hi,
 I have two picklist fileds called Approval Status with Values "Committed, Approved" and Proposal Type with values "Quote and Order" on same object. 
And I have custom button called Convert To Order on detail page, if I click on Convert to Order but it should check with Approval Status field if it is having field value is Approved then Proposal Type should be changed to Order value.
for this I have created a custom button and added JavaScript OnClick event as below. 

{!IF( ISPICKVAL( Custom_Object__c.Approval_Status__c , 'Approved'),
       TEXT( Custom_Object__c.Proposal_Type__c )='Order' ,'Quote')}

But it's not working when I click the button
Hi,

I have a visulaforce page that is having picklist field which populates all the SObjects in my org.
My requirement is to populate all the fields of the particular SObject selected in piclist field.
e.g., If I select Account object in picklist field, then automatically all the fields to be displayed in the page.

Note: I used DescribeSobject ( Dynamic Apex) to display the objects.

VF:

<apex:page controller="CustomObjCon">
<script>
   function showFieldsOfObject(){
     showFields();
  
   }
</script>

<apex:form >
   CustomObjectNames: &nbsp;&nbsp;&nbsp;
     <apex:selectList value="{!pickname}" multiselect="false" size="1" >
        <apex:selectOptions value="{!names}"/>
     </apex:selectList>
</apex:form>
</apex:page>


public class CustomObjCon
{

   
   public String pickname { get; set; }
   Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
   public List<SelectOption> getNames()
   {
          List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();  
          List<SelectOption> options = new List<SelectOption>();
          
   
           for(Schema.SObjectType f : gd)
           {
                // if(f.getDescribe().getName().contains('__c')) // for custom objects only
                 options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
           }
          return options;
   }

Thanks in Advance
Bala
I have done integration using SOAP API, from on SF org to another Org. I have coded one class in first Org1 to insert opportunity record as follows.
  //Webservices SFDC to SFDC
global class WsdlOpportunityCls{
  webService static void InsertOptRecord(String name,String Description){
    Opportunity op = new Opportunity();
    op.name = Name;
    op.Description= Description;
    op.StageName = 'Qualification';
    op.CloseDate = Date.today();
   
    insert op; 
 
  }

}

I have generated wsdl file for this class and partner wsdl of this org.

And I have parsed these two wsdls in another org to integrate. I successfully inserted records into Org2 when I try to insert records from Org2 thru SOAP API.

Below class to invoke the webservice method of above class.

public class Source_Opportuinity_Class{
  @future(callout = true)
  public static void Source_Invoke_Opt_Method(List<Id> listId){
 
     List<Opportunity> oppRec = new List<Opportunity>();
     oppRec = [Select Name, Description, Account.Name from Opportunity where Id IN : listId];
   
     Source_Partner_Cls3.Soap obj1 = new Source_Partner_Cls3.Soap();
     Source_Partner_Cls3.LoginResult lres = obj1.login( 'balakrishna.mandula@birlasoft.com', 'Jason123@vXoMT8HKsuG25xVuQDK4msfc');
    
     Target_Oppty_WSDL.WsdlOpportunityCls obj = new Target_Oppty_WSDL.WsdlOpportunityCls();
     obj.sessionHeader = new Target_Oppty_WSDL.sessionHeader_element();
     obj.sessionHeader.sessionId = lres.sessionId;
    
    // for( Opportunity oppt : oppRec){
      // obj.InsertOptRecord ( oppt.Name, oppt.Description);
    // }         
   
    for(opportunity opt :oppRec ) {
      obj.InsertOptRecord(opt.name, opt.description);
    }
   
         
 
  }
}

Trigger to invoke Source_Opportuinity_Class

trigger Oppt_to_Invoke_toIntegrate on Opportunity (after insert, after update) {
   List<id> listid = new List<Id>();
   for(Opportunity oppt : Trigger.new){
      listId.add(oppt.id);
   }
   Source_Opportuinity_Class.Source_Invoke_Opt_Method(listid);

}

When I try to create records in Org2 those records are being loaded into Org1 using SOAP API.

My requirement is to use Bulk API to load large amount of data.

Please help me how to do Bulk API?

Regards,
Balakrishna