You need to sign in to do that
Don't have an account?
Sabrina Oliveira 3
Getting value from one method to another
I have this method:
@AuraEnabled
public static String updateRecordReturned(Id recordId){
if (bankaccRcd == null){
bankaccRcd = [SELECT Id, Status__c, Observations__c FROM Bank_Account_Request__c WHere Id =: recordId];
}
try {
String stt = bankaccRcd.Status__c; // that's the value I'd like to get to the following method.
bankaccRcd.Status__c = 'Devolvido';
update bankaccRcd;
FeedItem post = new FeedItem();
post.Body = 'Devolution: '+bankaccRcd.Observations__c;
post.ParentId = bankaccRcd.Id;
insert post;
return 'Success';
}catch (DmlException e){
Return 'Error: '+e.getMessage();
}
}
I'd like to get the bold value above to another method:
@AuraEnabled
public static String updateRecordAfterReturned(Id recordId){
if (bankaccRcd == null){
bankaccRcd = [SELECT Id, Status__c, Observations__c FROM Bank_Account_Request__c WHere Id =: recordId];
}
try {
bankaccRcd.Status__c = stt; // here is where I'd like to get the value above.
update bankaccRcd;
return 'Success';
}catch (DmlException e){
Return 'Error: '+e.getMessage();
}
}
Is it possible?
@AuraEnabled
public static String updateRecordReturned(Id recordId){
if (bankaccRcd == null){
bankaccRcd = [SELECT Id, Status__c, Observations__c FROM Bank_Account_Request__c WHere Id =: recordId];
}
try {
String stt = bankaccRcd.Status__c; // that's the value I'd like to get to the following method.
bankaccRcd.Status__c = 'Devolvido';
update bankaccRcd;
FeedItem post = new FeedItem();
post.Body = 'Devolution: '+bankaccRcd.Observations__c;
post.ParentId = bankaccRcd.Id;
insert post;
return 'Success';
}catch (DmlException e){
Return 'Error: '+e.getMessage();
}
}
I'd like to get the bold value above to another method:
@AuraEnabled
public static String updateRecordAfterReturned(Id recordId){
if (bankaccRcd == null){
bankaccRcd = [SELECT Id, Status__c, Observations__c FROM Bank_Account_Request__c WHere Id =: recordId];
}
try {
bankaccRcd.Status__c = stt; // here is where I'd like to get the value above.
update bankaccRcd;
return 'Success';
}catch (DmlException e){
Return 'Error: '+e.getMessage();
}
}
Is it possible?
You need to declarie top side of class
public static void String stt;
public Bank_Account_Request__c bankaccRcd;
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
You need to declarie top side of class
public static void String stt;
public Bank_Account_Request__c bankaccRcd;
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh