• Sales Force FRM
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 14
    Replies
Hi Folks,
                Is it possible to create a file and write in to that file using apex code?

---Rajeshwar.
Hi Folks,
              I have trigger and class as follows:
trigger SampleTrigger on Opportunity (after insert) {

SampleOpportunity s=new SampleOpportunity();
s.sample();
}
class:
-------

public class SampleOpportunity {

public void sample(){
integer opp1=1;
integer opp2=2;
system.debug('ONE :'+opp1);
system.debug('TWO :'+opp2);
}
}

Now i want log the debug statements( Indicated in brown) in to a separate log file or a place where can i see the complete
action of a class which is logged , so i can understand what the status of class at each level!
finally i would like to have a separate file which have a log info my class!

Regards,
Rajeshwar.
Hi Folks,
              I have trigger and class as follows:
trigger SampleTrigger on Opportunity (after insert) {

SampleOpportunity s=new SampleOpportunity();
s.sample();
}
class:
-------

public class SampleOpportunity {

public void sample(){
integer opp1=1;
integer opp2=2;
system.debug('ONE :'+opp1);
system.debug('TWO :'+opp2);
}
}

Now i want log the debug statements( Indicated in brown) in to a separate log file or a place where can i see the complete
action of a class which is logged , so i can understand what the status of class at each level!
finally i would like to have a separate file which have a log info my class!

Regards,
Rajeshwar.




    Hi Folks,
                      I have created a custom field which is of type Lookup(Opportunity) in Custom object ,now i need to get the value of
custom filed , for example if in custom field look up value  is 'good opportunity' then i need to get the values of a custom field as
'good opportunity' , can any of you help me!

Regards,
Rajeshwar.
Hi Folks,
                 I need to assign negative sign to currency for example:
   $ 12,000 i need to append  '-' sign like    - $12,000 and stored in currency cloumn

Regrads,
Rajeshwar.
Hi Folks,
                I need to assign negative sign to decimal number for example :

12 is decimal number then i have to append negative sign like   -12 and  save in to a cloumn called  'value' , this column is also a   type of decimal, is trhis possible if so how to do it else is there any other way to do it.


Regards,
Rajeshwar.
Hi Folks,
                   I am able to create custom object successfully , but in the UI  view part of custom object i can see only the values of standard fields but not the values of  custom fields , so how can i make them available in UI of custom objects , tell me with help of screen shot  if possible.


Regards,
Rajeshwar.
Hi Folks,

How to enable fields in a custom object , currently iam unable to see the columns in view  part of custom object , so how can i make them enable so the columns can appear.


Regards,
Rajeshwar.
Hi ,
      I  have inserted values  in opprtunity_invoice __c custom object but i didn't see any records in  opprtunity_invoice __c object view part , but when i wrote one soql query to check whether those records are inserted or not , as per SOQL there records in opprtunity_invoice __c object but in UI part iam unable to see the records in opprtunity_invoice __c object, what change i have to do so records  can be  viewed in UI part.

Regards,
Rajeshwar.
Hi Folks,
                   I have crated 2 custom objects: AR__c and Opportunity_Invoice__c
Now i nvoked a trigger on a AR__c object so once i save any record in AR_c object the trigger should fire and  create a new record in  Opportunity_Invoice__c  object .
my code is follows:

trigger:
trigger ARPTrigger on AR__c (before insert) {

for(AR__c arpc : Trigger.new){
String text=' Invoice';
OpportunityInvoice.createOppInvoice(arpc.Invoice_Scheduling_Date__c,arpc.Invoice_Line_Description__c,arpc.Name+text);
}
}

and my class is follows:

public class OpportunityInvoice{
public static void createOppInvoice(Date invoiceDate,String invoiceLineDesc,String Name){
Opportunity_Invoice__c record= new Opportunity_Invoice__c();
record.Date__c=invoiceDate;
record.Line_Description__c=invoiceLineDesc;
record.Name=Name;
Opportunity_Invoice__c[] oppInvoice = new Opportunity_Invoice__c[]{record};
// Attempt to insert it...
insert oppInvoice ;
}
}

compilation successful(Tested this using test methodsee the log )

Debug Log

 *** Beginning Test 1: OpportunityInvoice.public static testMethod void testIcreateOppInvoice()

20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 17, column 9: 1
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 19, column 9: date:2008-05-28 00:00:00
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 21, column 9: Invoice descriptionFirst Invoice Line Desc
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 26, column 9: Name:Best Invoice
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 27, column 9: oppInvoice:(Opportunity_Invoice__c:{Date__c=Wed May 28 00:00:00 GMT 2008, Line_Description__c=First Invoice Line Desc, Name=Best Invoice})
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 28, column 9: Insert: LIST:SOBJECT:Opportunity_Invoice__c
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 28, column 9: DML Operation executed in 26 ms
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 29, column 9: Inserted:
20080529040720.360:Class.OpportunityInvoice: line 12, column 35: returning from end of method public static testMethod void testIcreateOppInvoice() in 28 ms

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 1 out of 100
Number of DML rows: 1 out of 500
Number of script statements: 14 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10

Total email recipients queued to be sent : 0
*** Ending Test OpportunityInvoice.public static testMethod void testIcreateOppInvoice()

but when i crate a record in custom object the trigger should fire and call the class

and insert record in to Opportunity_Invoice__c object but no record is inserted in to Opportunity_Invoice__c object
when i created a record in AR__c object, can u suggest me , how can make this successful.

Regards,
Rajeshwar.
    Hi Folks,
                   I have crated 2 custom objects: AR__c and Opportunity_Invoice__c
Now i nvoked a trigger on a AR__c object so once i save any record it create a new record in  Opportunity_Invoice__c  object .
my code is follows:

trigger:
trigger ARPTrigger on AR__c (before insert) {

for(AR__c arpc : Trigger.new){
String text=' Invoice';
OpportunityInvoice.createOppInvoice(arpc.Invoice_Scheduling_Date__c,arpc.Invoice_Line_Description__c,arpc.Name+text);
}
}

and my class is follows:

public class OpportunityInvoice{
public static void createOppInvoice(Date invoiceDate,String invoiceLineDesc,String Name){
Opportunity_Invoice__c record= new Opportunity_Invoice__c();
record.Date__c=invoiceDate;
record.Line_Description__c=invoiceLineDesc;
record.Name=Name;
Opportunity_Invoice__c[] oppInvoice = new Opportunity_Invoice__c[]{record};
// Attempt to insert it...
insert oppInvoice ;
}
}

compilation successful but when i crate a record in custom object the trigger should fire and call the class

and insert record in to Opportunity_Invoice__c object but no record is inserted in to Opportunity_Invoice__c object when i created a record
in AR__c object, can u suggest me , how can make this successful.

Regards,
Rajeshwar.
            
Hi Folks,
                I have created a custom object say "ABC" (App Setup-->create-->Objects) and this object is  under Opportunity  now i want to invoke  a trigger on this ,How to  do this, suggestions welcome. My trigger on custom object "ABC"  is as follows:

trigger ARPTrigger on ABC(after insert) {

}
The above one generated following error:

Error: Compile Error: Invalid SObject type name: ABC at line 1 column 23


Regards,
Rajeshwar.
Hi Folks,
                I have created a custom object say "ABC" (App Setup-->create-->Objects) and i want to invoke  a trigger on this ,How to  do this, suggestions welcome. My trigger on custom object "ABC"  is as follows:

trigger ARPTrigger on ABC(after insert) {

}
The above one generated following error:

Error: Compile Error: Invalid SObject type name: ABC at line 1 column 23


Regards,
Rajeshwar.
    Hi folks,
                   how to invoke my own class from trigger for ex:
                   my class is follows :

global class InsertAccount{


webservice static String createAccount(String accName){

String createdAccounts='';
String message='';
String firstName='rajeshwar';
String secondName='Suhel Ahmed';
Integer count=0;
try {
count=[select count() from account where name like : (firstName)];
if(count>0){
message='The Account \' '+firstName+'\' already in use!';
}else{
Account first = new Account();
first.name=firstName;
first.type='prospect';
Account[] accs = new Account[]{first};
// Attempt to insert it...
insert accs;
message='The Account \' '+firstName+'\' created Successfully!';
}



} catch (ListException e) {
// But will get here
}
return message;
}

}
now i want to invoke this class from trigger by passing account name as parameter in
createAccount(String accName) method, 

How can i achieve this , please let me know!

Regards,
Raeshwar.
    Hi folks,
                     How can i create custom object  under opprtunity, all suggestions welcome.

Regards,
Rajeshwar.
    Hi Folks,
                   I need to call a  class from trigger , the class  takes a parameter and create the account!

Regards,
Rajeshwar.
Hi Folks,
                can any one clarify my doubt please!
             what is ARP object under opprtunity , where can i information about ARP object , please share your thoughts with me.

Regards,
Rajeshwar.
Hi Folks,
Thanks for all moderators in the forums for solving compilation issue
now how can run this program ,i have a developer edition account and button with "Run Test"
is disable for my developer account so how can i run the following program and is there any way to
print the values in set or list , suggestions are welcome.


public class InsertAccount{

public void createAccount(){

try {

// Create a list with two references to the same sObject element
Account a = new Account();
Account[] accs = new Account[]{a, a};

// Attempt to insert it...
insert accs;

// Will not get here
System.assert(false);

} catch (ListException e) {
// But will get here
} }
}
Hi Folks,
                i am using set but i encountered following error , please refer my program:

1 public class SetDemo
2 {
3 Set<Integer> s = new Set<Integer>(); // Define a new set
4 s.add(1); // Add an element to the set
5 System.assert(s.contains(1)); // Assert that the set contains an element
6 s.remove(1); // Remove the element from the set
7 }


the compile error:

Error: Compile Error: unexpected token: 1 at line 4 column 7

    Hi Folks,
                   I am  Unable to make use of List as it's generating  compile issues , ,y program is as follows:


1 public class ListDemo
2 {
3   List<Integer> MyList = new List<Integer>(); // Define a new list
4    MyList.add(47); // Adds a second element of value 47 to the end
5   List.get(0); // Retrieves the element at index 0
6    MyList.set(0, 1); // Adds the integer 1 to the list at index 0
7   MyList.clear(); // Removes all elements from the list
8
9 }

and i got following  compile time errors:
Error: Compile Error: unexpected token: 47 at line 4 column 16

iam running apex scripts from the  from the following links:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm

I have  a developer edition account ,
I have tried so many code samples (Please refer code samples in the above link)
but all most all i got compile time errors like above!,  please suggest me what  i have to do?

Regards,
Rajeshwar.

Hi Folks,

How to enable fields in a custom object , currently iam unable to see the columns in view  part of custom object , so how can i make them enable so the columns can appear.


Regards,
Rajeshwar.
Hi Folks,
                   I have crated 2 custom objects: AR__c and Opportunity_Invoice__c
Now i nvoked a trigger on a AR__c object so once i save any record in AR_c object the trigger should fire and  create a new record in  Opportunity_Invoice__c  object .
my code is follows:

trigger:
trigger ARPTrigger on AR__c (before insert) {

for(AR__c arpc : Trigger.new){
String text=' Invoice';
OpportunityInvoice.createOppInvoice(arpc.Invoice_Scheduling_Date__c,arpc.Invoice_Line_Description__c,arpc.Name+text);
}
}

and my class is follows:

public class OpportunityInvoice{
public static void createOppInvoice(Date invoiceDate,String invoiceLineDesc,String Name){
Opportunity_Invoice__c record= new Opportunity_Invoice__c();
record.Date__c=invoiceDate;
record.Line_Description__c=invoiceLineDesc;
record.Name=Name;
Opportunity_Invoice__c[] oppInvoice = new Opportunity_Invoice__c[]{record};
// Attempt to insert it...
insert oppInvoice ;
}
}

compilation successful(Tested this using test methodsee the log )

Debug Log

 *** Beginning Test 1: OpportunityInvoice.public static testMethod void testIcreateOppInvoice()

20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 17, column 9: 1
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 19, column 9: date:2008-05-28 00:00:00
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 21, column 9: Invoice descriptionFirst Invoice Line Desc
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 26, column 9: Name:Best Invoice
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 27, column 9: oppInvoice:(Opportunity_Invoice__c:{Date__c=Wed May 28 00:00:00 GMT 2008, Line_Description__c=First Invoice Line Desc, Name=Best Invoice})
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 28, column 9: Insert: LIST:SOBJECT:Opportunity_Invoice__c
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 28, column 9: DML Operation executed in 26 ms
20080529040720.360:Class.OpportunityInvoice.testIcreateOppInvoice: line 29, column 9: Inserted:
20080529040720.360:Class.OpportunityInvoice: line 12, column 35: returning from end of method public static testMethod void testIcreateOppInvoice() in 28 ms

Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 500
Number of SOSL queries: 0 out of 20
Number of DML statements: 1 out of 100
Number of DML rows: 1 out of 500
Number of script statements: 14 out of 200000
Maximum heap size: 0 out of 500000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10

Total email recipients queued to be sent : 0
*** Ending Test OpportunityInvoice.public static testMethod void testIcreateOppInvoice()

but when i crate a record in custom object the trigger should fire and call the class

and insert record in to Opportunity_Invoice__c object but no record is inserted in to Opportunity_Invoice__c object
when i created a record in AR__c object, can u suggest me , how can make this successful.

Regards,
Rajeshwar.
    Hi Folks,
                   I have crated 2 custom objects: AR__c and Opportunity_Invoice__c
Now i nvoked a trigger on a AR__c object so once i save any record it create a new record in  Opportunity_Invoice__c  object .
my code is follows:

trigger:
trigger ARPTrigger on AR__c (before insert) {

for(AR__c arpc : Trigger.new){
String text=' Invoice';
OpportunityInvoice.createOppInvoice(arpc.Invoice_Scheduling_Date__c,arpc.Invoice_Line_Description__c,arpc.Name+text);
}
}

and my class is follows:

public class OpportunityInvoice{
public static void createOppInvoice(Date invoiceDate,String invoiceLineDesc,String Name){
Opportunity_Invoice__c record= new Opportunity_Invoice__c();
record.Date__c=invoiceDate;
record.Line_Description__c=invoiceLineDesc;
record.Name=Name;
Opportunity_Invoice__c[] oppInvoice = new Opportunity_Invoice__c[]{record};
// Attempt to insert it...
insert oppInvoice ;
}
}

compilation successful but when i crate a record in custom object the trigger should fire and call the class

and insert record in to Opportunity_Invoice__c object but no record is inserted in to Opportunity_Invoice__c object when i created a record
in AR__c object, can u suggest me , how can make this successful.

Regards,
Rajeshwar.
            
Hi Folks,
                I have created a custom object say "ABC" (App Setup-->create-->Objects) and this object is  under Opportunity  now i want to invoke  a trigger on this ,How to  do this, suggestions welcome. My trigger on custom object "ABC"  is as follows:

trigger ARPTrigger on ABC(after insert) {

}
The above one generated following error:

Error: Compile Error: Invalid SObject type name: ABC at line 1 column 23


Regards,
Rajeshwar.
    Hi Folks,
                   I need to call a  class from trigger , the class  takes a parameter and create the account!

Regards,
Rajeshwar.
    Hi Folks,
                  Can any one clarify my doubt! Is salesforce automation system is enterprise application or hosted application!

is there any difference between sales force and sales force automation system?

Thanks & Regards,
 Rajeshwar.

Hi
       How to write a SOQL query to go back 1 hour back from currnt date and my SOQL is as follows:

SELECT ID,NAME,TYPE,BillingStreet,BillingCity,BillingState,BillingCountry,Phone,Industry,OwnerShip,OwnerId From Account Where  LastModifiedDate>(CURRENTDATE-1hr)


Now how to subtract 'n' hours  from current date and time so that i can get the records which are modified 'n' hours back.
Any good suggestions appreciatable.

Thanks & Regards,

Rajeshwar.