You need to sign in to do that
Don't have an account?
Hugo_B
Assigning a variable from a called method in another class
I have 2 classes containing various methods.
In the first class I want to call the class "addInvoice()"
The addInvoice class should return the invoiceID
I would like to take the returned invoiceID and assign it to a variable to be used elsewhere in the class
Here is the call in the first class:
This is the method in the second class
I just keep getting errors such as: Error: Compile Error: Invalid type: InvoiceAdd at line 65 column 38
Any help?
In the first class I want to call the class "addInvoice()"
The addInvoice class should return the invoiceID
I would like to take the returned invoiceID and assign it to a variable to be used elsewhere in the class
Here is the call in the first class:
InvoiceAdd invoice = new InvoiceAdd(); String invID = invoice.invID;
This is the method in the second class
Public String InvoiceAdd(String projID, String oppID) { system.debug('1'); Invoice__c inv = new Invoice__c(Project__c = projid); system.debug('2'); insert inv; String invID = inv.id; system.debug('3'); system.debug('oppID ' + oppID); system.debug('invID ' + invID); return invID; }
I just keep getting errors such as: Error: Compile Error: Invalid type: InvoiceAdd at line 65 column 38
Any help?
String invID = new InvoiceAdd( Variable 1, Variable 2);
All Answers
It will be great if you can post your whole code because it is not clear where is line 65 in your current code and they way you are defining and calling is not correct.
Thanks,
Himanshu
String invID = new InvoiceAdd( Variable 1, Variable 2);