You need to sign in to do that
Don't have an account?
Mahesh KG
QuoteDiscountApproval_TestunitTest1 and QuoteGroupDiscountApproval_TestunitTest1
Hi Team,
i am getting the below error when deploying into the production environment.
there are 2 test cases thats is getting failed when i am trying to deploy the code to the production. below u can find the error log.
QuoteDiscountApproval_TestunitTest1System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
Stack Trace: Class.QuoteApprovalProcess.quoteProcess: line 16, column 1
new messages
4:43
QuoteGroupDiscountApproval_TestunitTest1System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
Stack Trace: Class.QuoteApprovalProcess.quoteProcess: line 16, column 1
below is my Apex code that i am deploying to production,
@RestResource(urlMapping='/Account/*')
global with sharing class AccountManager {
@HttpGet
global static Account getAccountById() {
RestRequest request = RestContext.request;
// grab the caseId from the end of the URL
String accountId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Name
FROM Account
WHERE Id = :accountId];
return result;
}
@HttpPost
global static ID createAccount(String ownerId,String accountName, String accountManager,String parentAccount,String website,
String companyCode,String atsOrHris, String accountSetUpFee,
String type,Decimal annualRevenue,String revenueStream,
boolean serviceLevelAgrmnt,String billingStreet,String billingCity, String billingState,String billingZip,
String billingCountry,String dunsNumber,String lineOfBus,String subType,String lastName,String euaBody,
String contentType,String attachName,String firstName, String title, String phone, String homePhone,
String fax, String email,String others,String[] amzDetails) {
Account restAcc = new Account(
OwnerId=ownerId,
Name=accountName,
Account_Manager__c=accountManager,
ParentId=parentAccount,
Website=website,
Company_Code__c=companyCode,
ATS_or_HRIS__c=atsOrHris,
Account_Set_up_Fee__c=accountSetUpFee,
Account_Status__c='active',
Type=type,
AnnualRevenue=annualRevenue,
Annual_AB_Revenue__c= annualRevenue,
Revenue_Stream__c = revenueStream,
Service_Level_Agreement__c = serviceLevelAgrmnt,
BillingStreet=billingStreet,
BillingCity= billingCity,
BillingState=billingState,
BillingPostalCode=billingZip,
BillingCountry=billingCountry,
ShippingStreet=billingStreet,
ShippingCity= billingCity,
ShippingState=billingState,
ShippingPostalCode=billingZip,
ShippingCountry=billingCountry,
D_U_N_S__c=dunsNumber,
//D_U_N_S_Number__c=dunsNumber,
Line_of_Business__c=lineOfBus,
ATS_Version__c=subType,
Other__c=others,
Amazon_Point_of_Contact__c=amzDetails[0],
Amazon_POC_Last_Name__c=amzDetails[1],
Amazon_POC_Email_Address__c= amzDetails[2]
);
insert restAcc;
// Account a = [select Id, Name from Account where Name = ''Shaik'];
Contact c = new Contact();
c.LastName = lastName;
c.FirstName = firstName;
c.Title = title;
c.Phone = phone;
c.HomePhone=homePhone;
c.Fax =fax;
c.Email= email;
c.AccountId = restAcc.Id;
insert c;
Attachment attch= new Attachment();
//attch.Name=attachName +'.pdf';
attch.Name=attachName;
euaBody = euaBody.replaceall('src','alt');
attch.Body=blob.toPDF(euaBody);
//attch.Body = Blob.valueOf(sstr);
attch.ParentId =restAcc.Id;
//attachmentPdf.body = blob.toPDF(pdfContent);
insert attch;
//Document doc = new Document();
//doc.Name = 'SF_Dashboard.pdf';
//doc.body = bodyPage;
//doc.folderId = '00l6F000001pq8s'; //your folder id
//doc.IsPublic = true;
//doc.Description = 'Salesforce Dashboard Report -' + String.valueOf(date.today().format());
//insert doc;
//insert doc;
return restAcc.Id;
}
@HttpDelete
global static void deleteCase() {
RestRequest request = RestContext.request;
String caseId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Case thisCase = [SELECT Id FROM Case WHERE Id = :caseId];
delete thisCase;
}
@HttpPut
global static ID upsertCase(String name,String parent, String accountMgr,String setUpFee,String vendorType,
Decimal annualRevenue, Decimal annualAbRevenue, String revenueStream,
String billingStreet,String billingCity, String billingState,String billingPostalCode,
String billingCountry) {
Account restAccUpdate = new Account(
Name=name,
ParentId=parent,
Account_Manager__c=accountMgr,
Account_Set_up_Fee__c=setUpFee,
Type=vendorType,
AnnualRevenue=annualRevenue,
Annual_AB_Revenue__c= annualAbRevenue,
Revenue_Stream__c = revenueStream,
BillingStreet=billingStreet,BillingCity= billingCity,BillingState=billingState,
BillingPostalCode=billingPostalCode,BillingCountry=billingCountry,
ShippingStreet=billingStreet,ShippingCity= billingCity,ShippingState=billingState,
ShippingPostalCode=billingPostalCode,ShippingCountry=billingCountry);
// Match case by Id, if present.
// Otherwise, create new case.
upsert restAccUpdate;
// Return the case ID.
return restAccUpdate.Id;
}
@HttpPatch
global static ID updateCaseFields() {
RestRequest request = RestContext.request;
String caseId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account thisCase = [SELECT Id FROM Account WHERE Id = :caseId];
// Deserialize the JSON string into name-value pairs
Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(request.requestbody.tostring());
// Iterate through each parameter field and value
for(String fieldName : params.keySet()) {
// Set the field and value on the Case sObject
thisCase.put(fieldName, params.get(fieldName));
}
update thisCase;
return thisCase.Id;
}
}
i am getting the below error when deploying into the production environment.
there are 2 test cases thats is getting failed when i am trying to deploy the code to the production. below u can find the error log.
QuoteDiscountApproval_TestunitTest1System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
Stack Trace: Class.QuoteApprovalProcess.quoteProcess: line 16, column 1
new messages
4:43
QuoteGroupDiscountApproval_TestunitTest1System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
Stack Trace: Class.QuoteApprovalProcess.quoteProcess: line 16, column 1
below is my Apex code that i am deploying to production,
@RestResource(urlMapping='/Account/*')
global with sharing class AccountManager {
@HttpGet
global static Account getAccountById() {
RestRequest request = RestContext.request;
// grab the caseId from the end of the URL
String accountId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Name
FROM Account
WHERE Id = :accountId];
return result;
}
@HttpPost
global static ID createAccount(String ownerId,String accountName, String accountManager,String parentAccount,String website,
String companyCode,String atsOrHris, String accountSetUpFee,
String type,Decimal annualRevenue,String revenueStream,
boolean serviceLevelAgrmnt,String billingStreet,String billingCity, String billingState,String billingZip,
String billingCountry,String dunsNumber,String lineOfBus,String subType,String lastName,String euaBody,
String contentType,String attachName,String firstName, String title, String phone, String homePhone,
String fax, String email,String others,String[] amzDetails) {
Account restAcc = new Account(
OwnerId=ownerId,
Name=accountName,
Account_Manager__c=accountManager,
ParentId=parentAccount,
Website=website,
Company_Code__c=companyCode,
ATS_or_HRIS__c=atsOrHris,
Account_Set_up_Fee__c=accountSetUpFee,
Account_Status__c='active',
Type=type,
AnnualRevenue=annualRevenue,
Annual_AB_Revenue__c= annualRevenue,
Revenue_Stream__c = revenueStream,
Service_Level_Agreement__c = serviceLevelAgrmnt,
BillingStreet=billingStreet,
BillingCity= billingCity,
BillingState=billingState,
BillingPostalCode=billingZip,
BillingCountry=billingCountry,
ShippingStreet=billingStreet,
ShippingCity= billingCity,
ShippingState=billingState,
ShippingPostalCode=billingZip,
ShippingCountry=billingCountry,
D_U_N_S__c=dunsNumber,
//D_U_N_S_Number__c=dunsNumber,
Line_of_Business__c=lineOfBus,
ATS_Version__c=subType,
Other__c=others,
Amazon_Point_of_Contact__c=amzDetails[0],
Amazon_POC_Last_Name__c=amzDetails[1],
Amazon_POC_Email_Address__c= amzDetails[2]
);
insert restAcc;
// Account a = [select Id, Name from Account where Name = ''Shaik'];
Contact c = new Contact();
c.LastName = lastName;
c.FirstName = firstName;
c.Title = title;
c.Phone = phone;
c.HomePhone=homePhone;
c.Fax =fax;
c.Email= email;
c.AccountId = restAcc.Id;
insert c;
Attachment attch= new Attachment();
//attch.Name=attachName +'.pdf';
attch.Name=attachName;
euaBody = euaBody.replaceall('src','alt');
attch.Body=blob.toPDF(euaBody);
//attch.Body = Blob.valueOf(sstr);
attch.ParentId =restAcc.Id;
//attachmentPdf.body = blob.toPDF(pdfContent);
insert attch;
//Document doc = new Document();
//doc.Name = 'SF_Dashboard.pdf';
//doc.body = bodyPage;
//doc.folderId = '00l6F000001pq8s'; //your folder id
//doc.IsPublic = true;
//doc.Description = 'Salesforce Dashboard Report -' + String.valueOf(date.today().format());
//insert doc;
//insert doc;
return restAcc.Id;
}
@HttpDelete
global static void deleteCase() {
RestRequest request = RestContext.request;
String caseId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Case thisCase = [SELECT Id FROM Case WHERE Id = :caseId];
delete thisCase;
}
@HttpPut
global static ID upsertCase(String name,String parent, String accountMgr,String setUpFee,String vendorType,
Decimal annualRevenue, Decimal annualAbRevenue, String revenueStream,
String billingStreet,String billingCity, String billingState,String billingPostalCode,
String billingCountry) {
Account restAccUpdate = new Account(
Name=name,
ParentId=parent,
Account_Manager__c=accountMgr,
Account_Set_up_Fee__c=setUpFee,
Type=vendorType,
AnnualRevenue=annualRevenue,
Annual_AB_Revenue__c= annualAbRevenue,
Revenue_Stream__c = revenueStream,
BillingStreet=billingStreet,BillingCity= billingCity,BillingState=billingState,
BillingPostalCode=billingPostalCode,BillingCountry=billingCountry,
ShippingStreet=billingStreet,ShippingCity= billingCity,ShippingState=billingState,
ShippingPostalCode=billingPostalCode,ShippingCountry=billingCountry);
// Match case by Id, if present.
// Otherwise, create new case.
upsert restAccUpdate;
// Return the case ID.
return restAccUpdate.Id;
}
@HttpPatch
global static ID updateCaseFields() {
RestRequest request = RestContext.request;
String caseId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account thisCase = [SELECT Id FROM Account WHERE Id = :caseId];
// Deserialize the JSON string into name-value pairs
Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(request.requestbody.tostring());
// Iterate through each parameter field and value
for(String fieldName : params.keySet()) {
// Set the field and value on the Case sObject
thisCase.put(fieldName, params.get(fieldName));
}
update thisCase;
return thisCase.Id;
}
}