• sancarlos94070
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
I'm looking for Apex example to illustrate how to dynamically create a SOQL query to select all the fields of a Lead object. Can anyone point me to an example? Tried the search feature here & Apex doc with no luck.

Thank you!!

I have a very simple code that works fine but I'm not getting any output from System.debug in the system log window.  What have I missed?  Thanks.  web service apex code below:

 

global class myHelloWorld {
   
    // eyCDUkymDHyd9MisHBFLPIYJm
   
    webService static String getHelloWorld() {
       
        System.LoggingLevel level = LoggingLevel.FINEST;
       
        System.debug('Entering Hello World');
        String hello = 'Hello World';
        System.debug('Leaving Hello World');
       
        return hello;
    }
   

}

Even very simple code won't work, nothing gets invoked. Please help. Thank you!

Apex:
lobal class myHelloWorld {

// eyCDUkymDHyd9MisHBFLPIYJm

webService static String getHelloWorld() {
String hello = 'Hello World';

return hello;
}


}

S-Control:




<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>
function getHello() {
var shello = sforce.apex.execute('myHelloWorld','getHelloWorld',());
alert(shello);
}
</script>



Test Page.






I need to have a custom button that will clone a lead then give it a different record type. I am using the custom button to invoke S-Control which will then call my Apex code as webservice but so far, the call not able to invoke anything, without any error message.

S-Control code here:





<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>
function createCharterLead() {
var lead = sforce.sObject("lead");
var lead2 = sforce.apex.execute("spinOffCharterLead","createCharterLead",l:lead);
}
</script>



Charter Lead created.








Apex code:

global class spinOffCharterLead {

// eyCDUkymDHyd9MisHBFLPIYJm

webService static Lead createCharterLead(Lead l) {

// log entry
System.debug('Now in spin off class');

ID cid = [select id from RecordType where name='CharterLead' limit 1].id;
System.debug('Now selected recordtype ID');

Lead lc = l.clone(false, true);
lc.RecordTypeId = cid;

// Now insert
insert(lc);
System.debug('Inserted Lead');

// Track
Program_Charter_Link__c pcl = new Program_Charter_Link__c();
pcl.Charter_Lead__c = lc.Id;
pcl.Program_Lead__c = l.Id;
insert(pcl);
System.debug('Inserted tracking');

return lc;

}

}

I have a very simple code that works fine but I'm not getting any output from System.debug in the system log window.  What have I missed?  Thanks.  web service apex code below:

 

global class myHelloWorld {
   
    // eyCDUkymDHyd9MisHBFLPIYJm
   
    webService static String getHelloWorld() {
       
        System.LoggingLevel level = LoggingLevel.FINEST;
       
        System.debug('Entering Hello World');
        String hello = 'Hello World';
        System.debug('Leaving Hello World');
       
        return hello;
    }
   

}

Even very simple code won't work, nothing gets invoked. Please help. Thank you!

Apex:
lobal class myHelloWorld {

// eyCDUkymDHyd9MisHBFLPIYJm

webService static String getHelloWorld() {
String hello = 'Hello World';

return hello;
}


}

S-Control:




<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>
function getHello() {
var shello = sforce.apex.execute('myHelloWorld','getHelloWorld',());
alert(shello);
}
</script>



Test Page.






I need to have a custom button that will clone a lead then give it a different record type. I am using the custom button to invoke S-Control which will then call my Apex code as webservice but so far, the call not able to invoke anything, without any error message.

S-Control code here:





<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>
function createCharterLead() {
var lead = sforce.sObject("lead");
var lead2 = sforce.apex.execute("spinOffCharterLead","createCharterLead",l:lead);
}
</script>



Charter Lead created.








Apex code:

global class spinOffCharterLead {

// eyCDUkymDHyd9MisHBFLPIYJm

webService static Lead createCharterLead(Lead l) {

// log entry
System.debug('Now in spin off class');

ID cid = [select id from RecordType where name='CharterLead' limit 1].id;
System.debug('Now selected recordtype ID');

Lead lc = l.clone(false, true);
lc.RecordTypeId = cid;

// Now insert
insert(lc);
System.debug('Inserted Lead');

// Track
Program_Charter_Link__c pcl = new Program_Charter_Link__c();
pcl.Charter_Lead__c = lc.Id;
pcl.Program_Lead__c = l.Id;
insert(pcl);
System.debug('Inserted tracking');

return lc;

}

}