- Michele Toscano
- NEWBIE
- 100 Points
- Member since 2014
- Applications Manager
- Cabot Corporation
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
21Questions
-
21Replies
An internal server error has occurred Error ID: 1713270143-4676084 (1964297404) quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
I have two Orgs with exactly the same code associated with Quick Action button and now, in one of my Orgs- I am receiving this message today when clicking on any of my quick action buttons: An internal server error has occurred
Error ID: 1713270143-4676084 (1964297404)
quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
Error ID: 1713270143-4676084 (1964297404)
quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
-
- Michele Toscano
- June 19, 2019
- Like
- 0
- Continue reading or reply
Increase Code Coverage - WrapperSoap
I'm at 50% code coverage of my test class. How can I increase the coverage?
Here is my apex class: (The lines bolded below are not covered...how can I cover them?)
Global class IncidentManagerCallout{
public static IncidentManager.ArrayOfSHSHresult GetIMData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMSearch(email);
}
public static IncidentManager.ArrayOfSHSHresult GetIMTimeStampSearchData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMTimeStampSearch(email);
}
}
And here is my test class:
@isTest(SeeAllData=true)
Global class TestIncidentManagerCallout{
static testMethod void Test(){
string email = GetUserInfo.GetCurrentUserEmail();
Test.setMock(WebServiceMock.class, new IncidentManagerMock());
IncidentManager.ArrayOfSHSHresult result = IncidentManagerCallout.GetIMData(email);
}
}
Here is my apex class: (The lines bolded below are not covered...how can I cover them?)
Global class IncidentManagerCallout{
public static IncidentManager.ArrayOfSHSHresult GetIMData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMSearch(email);
}
public static IncidentManager.ArrayOfSHSHresult GetIMTimeStampSearchData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMTimeStampSearch(email);
}
}
And here is my test class:
@isTest(SeeAllData=true)
Global class TestIncidentManagerCallout{
static testMethod void Test(){
string email = GetUserInfo.GetCurrentUserEmail();
Test.setMock(WebServiceMock.class, new IncidentManagerMock());
IncidentManager.ArrayOfSHSHresult result = IncidentManagerCallout.GetIMData(email);
}
}
-
- Michele Toscano
- June 20, 2018
- Like
- 0
- Continue reading or reply
Missing a )
Where am I missing a )? My syntax is incorrect when putting this into a Process Builder.
AND(
ISCHANGED([Price_Authorization_Request__c].Billing_Region__c ),
[Price_Authorization_Request__c].RecordType.Name = 'Standard PAR',
([Price_Authorization_Request__c].PAR_Status__c = 'Pending Approval' OR
[Price_Authorization_Request__c].PAR_Status__c = 'In-Progress')
)
AND(
ISCHANGED([Price_Authorization_Request__c].Billing_Region__c ),
[Price_Authorization_Request__c].RecordType.Name = 'Standard PAR',
([Price_Authorization_Request__c].PAR_Status__c = 'Pending Approval' OR
[Price_Authorization_Request__c].PAR_Status__c = 'In-Progress')
)
-
- Michele Toscano
- January 09, 2018
- Like
- 0
- Continue reading or reply
Javascript custom button: getting unexpected token { error
My sytax is not getting an error when I check it via my javascript button - however, when I click the button which executes it - it throws an unexpected token { error. What am I doing wrong?
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
-
- Michele Toscano
- October 26, 2017
- Like
- 0
- Continue reading or reply
Execute Anonymous Error
I'm receiving an error on Line: 1, Column 1
System.StringException: Unexpected end of expression.
System.schedule('IMSync_At00Minutes', '0 0***?',new IncidentManagerSync());
System.schedule('IMSync_At15Minutes', '0 15***?',new IncidentManagerSync());
System.schedule('IMSync_At30Minutes', '0 30***?',new IncidentManagerSync());
System.schedule('IMSync_At45Minutes', '0 45***?',new IncidentManagerSync());
Can someone tell me what I'm doing wrong? I'm trying to execute a process every 15 minutes. Did I get the syntax wrong somewhere?
System.StringException: Unexpected end of expression.
System.schedule('IMSync_At00Minutes', '0 0***?',new IncidentManagerSync());
System.schedule('IMSync_At15Minutes', '0 15***?',new IncidentManagerSync());
System.schedule('IMSync_At30Minutes', '0 30***?',new IncidentManagerSync());
System.schedule('IMSync_At45Minutes', '0 45***?',new IncidentManagerSync());
Can someone tell me what I'm doing wrong? I'm trying to execute a process every 15 minutes. Did I get the syntax wrong somewhere?
-
- Michele Toscano
- September 19, 2017
- Like
- 0
- Continue reading or reply
Restricting Opportunity Creation and Modification for project Go Live
Is there a quick way without having to go through all of my profiles to restrict users from creating or modifying an opportunity? I want to restrict access when uploading my opportunity related development work. What's the best and most efficient way to achieve this?
-
- Michele Toscano
- June 06, 2017
- Like
- 0
- Continue reading or reply
Is there a way to call a popup from a flow?
I'd like to send a message to the user when something isn't found in one of the tables that my flow uses- with a message letting them know the product is not found and then have them click OK to acknowledge it- and return to the flow
-
- Michele Toscano
- April 20, 2017
- Like
- 0
- Continue reading or reply
Extra 'OR' in workflow formula
How can I fix this syntax? I want the first two lines evaluated first followed by the last two lines....another pair of eyes would be greatly appreciated.
ISCHANGED((AccountId) = True || (AccountId) <> '' ) &&
Address_Line_1__c <> '' OR
ISCHANGED((Account.LCL_Account_Name__c) = True || (Account.LCL_Account_Name__c) <> '')
&& LCL_Address_Line_1__c <> ''
ISCHANGED((AccountId) = True || (AccountId) <> '' ) &&
Address_Line_1__c <> '' OR
ISCHANGED((Account.LCL_Account_Name__c) = True || (Account.LCL_Account_Name__c) <> '')
&& LCL_Address_Line_1__c <> ''
-
- Michele Toscano
- December 12, 2016
- Like
- 0
- Continue reading or reply
List has duplicate ids and too many SoQL queries, 'Set' is not an iterable object type, and cannot participate in s DML operations....so how can I proceed with what I'm trying to do?
I've already tried using Set instead of list but it has a problem with the DML (Update) ....so I reverted my code back which is working but then has 'duplicate ids' and too many SOQL queries...I've even tried using another Map- but there was an issue with the update. Maybe my syntax was off?? Please help.
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
//Modify query - remove nested subquery -11/2/16 MT
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
Map<Id, Integer> childRecCount= new Map<id, Integer>();
Map<Id, Integer> updatedCount= new Map<Id, Integer>();
Set<Id> prI= new Set<Id>();
for(Price_Authorization_Request__c parObj : Parlist){
prI.add(parObj.Id);
childRecCount.put(parObj.Id, 0);
updatedCount.put(parObj.Id, 0);
}
List<Pricing_Input__c> pInput= [select Id,Expiration_Date_Change_To__c,Effective_date__c, Price_Authorization_Request__c from Pricing_Input__c WHERE Price_Authorization_Request__c IN :prI];
//get original count
for(Pricing_Input__c pi :pInput){
childRecCount.put(pi.Price_Authorization_Request__c, childRecCount.get(pi.Price_Authorization_Request__c)+1);
if(pi.Expiration_Date_Change_To__c != null && pi.Expiration_Date_Change_To__c < system.today()) {
updatedCount.put(pi.Price_Authorization_Request__c, //only consider the updated count -11/3/16 MT
updatedCount.get(pi.Price_Authorization_Request__c)+1);
}
for(Price_Authorization_Request__c parObj : Parlist){
if( (childRecCount.get(parObj.Id) == updatedCount.get(parObj.Id) && childRecCount.get(parObj.Id) > 0) || (parObj.Expiration_Date__c < System.today() && childRecCount.get(parObj.Id) == 0)){ //consider # of childRecs on OR evaluation; -11/14/16 MT
parObj.Par_Status__c = 'Expired';
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
}
global void finish(Database.BatchableContext BC)
{}
}
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
//Modify query - remove nested subquery -11/2/16 MT
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
Map<Id, Integer> childRecCount= new Map<id, Integer>();
Map<Id, Integer> updatedCount= new Map<Id, Integer>();
Set<Id> prI= new Set<Id>();
for(Price_Authorization_Request__c parObj : Parlist){
prI.add(parObj.Id);
childRecCount.put(parObj.Id, 0);
updatedCount.put(parObj.Id, 0);
}
List<Pricing_Input__c> pInput= [select Id,Expiration_Date_Change_To__c,Effective_date__c, Price_Authorization_Request__c from Pricing_Input__c WHERE Price_Authorization_Request__c IN :prI];
//get original count
for(Pricing_Input__c pi :pInput){
childRecCount.put(pi.Price_Authorization_Request__c, childRecCount.get(pi.Price_Authorization_Request__c)+1);
if(pi.Expiration_Date_Change_To__c != null && pi.Expiration_Date_Change_To__c < system.today()) {
updatedCount.put(pi.Price_Authorization_Request__c, //only consider the updated count -11/3/16 MT
updatedCount.get(pi.Price_Authorization_Request__c)+1);
}
for(Price_Authorization_Request__c parObj : Parlist){
if( (childRecCount.get(parObj.Id) == updatedCount.get(parObj.Id) && childRecCount.get(parObj.Id) > 0) || (parObj.Expiration_Date__c < System.today() && childRecCount.get(parObj.Id) == 0)){ //consider # of childRecs on OR evaluation; -11/14/16 MT
parObj.Par_Status__c = 'Expired';
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
}
global void finish(Database.BatchableContext BC)
{}
}
-
- Michele Toscano
- November 30, 2016
- Like
- 0
- Continue reading or reply
Aggregrate query has too many rows for assignment
How can I get around the aggregrate query error? When I tried taking out the For loop- the execution then failed. Is there a better way to do it?
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c,(select Id,Expiration_Date_Change_To__c,Effective_date__c from Pricing_Inputs__r) from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']) //-->system does not like this
{
maprecTypewithId.put(rec.Name,rec.id);
}
for(Price_Authorization_Request__c parObj : Parlist)
{
if(parObj.Pricing_Inputs__r != null && !parObj.Pricing_Inputs__r.isEmpty())
{
Integer count = 0;
for(Pricing_Input__c PrcInputObj : parObj.Pricing_Inputs__r)
{
if(PrcInputObj.Expiration_Date_Change_To__c != null && PrcInputObj.Expiration_Date_Change_To__c < system.today())
{
count = count + 1;
}
}
if(count ==(parObj.Pricing_Inputs__r).size())
{
parObj.Par_Status__c = 'Expired';
// parObj.Expiration_Date__c=Date.valueOf(System.Today());
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
global void finish(Database.BatchableContext BC)
{}
}
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c,(select Id,Expiration_Date_Change_To__c,Effective_date__c from Pricing_Inputs__r) from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']) //-->system does not like this
{
maprecTypewithId.put(rec.Name,rec.id);
}
for(Price_Authorization_Request__c parObj : Parlist)
{
if(parObj.Pricing_Inputs__r != null && !parObj.Pricing_Inputs__r.isEmpty())
{
Integer count = 0;
for(Pricing_Input__c PrcInputObj : parObj.Pricing_Inputs__r)
{
if(PrcInputObj.Expiration_Date_Change_To__c != null && PrcInputObj.Expiration_Date_Change_To__c < system.today())
{
count = count + 1;
}
}
if(count ==(parObj.Pricing_Inputs__r).size())
{
parObj.Par_Status__c = 'Expired';
// parObj.Expiration_Date__c=Date.valueOf(System.Today());
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
global void finish(Database.BatchableContext BC)
{}
}
-
- Michele Toscano
- November 02, 2016
- Like
- 0
- Continue reading or reply
Invalid initial value type List for List
I've tried to put my query directly in a list and then loop through the list but I'm getting an error invalid value type list for list.
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>([select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']);
for(RecordType rec : listPARToUpdate)
{
maprecTypewithId.put(rec.Name,rec.id);
}
However, If I try it this way - I get the aggregrate query FOR loop error (due to large recrod set)
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
What is the best way to achieve this - without exceeding governor limits?
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>([select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']);
for(RecordType rec : listPARToUpdate)
{
maprecTypewithId.put(rec.Name,rec.id);
}
However, If I try it this way - I get the aggregrate query FOR loop error (due to large recrod set)
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
What is the best way to achieve this - without exceeding governor limits?
-
- Michele Toscano
- November 02, 2016
- Like
- 0
- Continue reading or reply
expecting a right parantheses, found 'and'
I am having trouble with the syntax on line 28 (bolded below) – the error I receive says: ‘expecting a right parentheses, found ‘and’’
How can I correct that part? I want it to check to be sure the expiration date is less than today and that the status is not currently in manually expired or expired. If it passes, execute the batch expiration.
global class Batch_ExpDate_NoPricIn
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired';
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List Parlist)
{
if(Parlist != null && !Parlist.isEmpty())
{
for(Price_Authorization_Request__c parObj : Parlist)
{
List NprList = [select Id,Expiration_Date__c, PAR_Status__c from Price_Authorization_Request__c Where Price_Authorization_Request__c =: parObj.Id];
if(NprList != null && NprList.size() > 0)
{
Integer count = 0;
for(Price_Authorization_Request__c PARObjNpr : NprList)
{
if(PARObjNpr.Expiration_Date__c != null && PARObjNpr.Expiration_Date__c < system.today() && PARObjNpr.PAR_status__c !='Manually Expired' and PARObjNpr.PAR_Status__c != 'Expired')
{
count = count + 1;
}
}
}
}
}
}
global void finish(Database.BatchableContext BC)
{}
}
How can I correct that part? I want it to check to be sure the expiration date is less than today and that the status is not currently in manually expired or expired. If it passes, execute the batch expiration.
global class Batch_ExpDate_NoPricIn
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired';
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List Parlist)
{
if(Parlist != null && !Parlist.isEmpty())
{
for(Price_Authorization_Request__c parObj : Parlist)
{
List NprList = [select Id,Expiration_Date__c, PAR_Status__c from Price_Authorization_Request__c Where Price_Authorization_Request__c =: parObj.Id];
if(NprList != null && NprList.size() > 0)
{
Integer count = 0;
for(Price_Authorization_Request__c PARObjNpr : NprList)
{
if(PARObjNpr.Expiration_Date__c != null && PARObjNpr.Expiration_Date__c < system.today() && PARObjNpr.PAR_status__c !='Manually Expired' and PARObjNpr.PAR_Status__c != 'Expired')
{
count = count + 1;
}
}
}
}
}
}
global void finish(Database.BatchableContext BC)
{}
}
-
- Michele Toscano
- November 01, 2016
- Like
- 0
- Continue reading or reply
Expecting a semi-colon , found '01'
Id 01pF000000452WnIAI = Database.executeBatch(new Batch_ExpDate_PricIn(), 190);
The id referenced is correct. What am I doing wrong here?
The id referenced is correct. What am I doing wrong here?
-
- Michele Toscano
- October 13, 2016
- Like
- 0
- Continue reading or reply
illegal assignment from list to list
global void execute(Database.BatchableContext BC, List Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map maprecTypewithId = new Map();
List listPARToUpdate = [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'];
for(RecordType rec : listPARToUpdate )
{
maprecTypewithId.put(rec.Name,rec.id);
}
How can I avoid my illegal assignment of lists? Also, where would I specify a batchable size of 190?
if(Parlist != null && !Parlist.isEmpty())
{
Map maprecTypewithId = new Map();
List listPARToUpdate = [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'];
for(RecordType rec : listPARToUpdate )
{
maprecTypewithId.put(rec.Name,rec.id);
}
How can I avoid my illegal assignment of lists? Also, where would I specify a batchable size of 190?
-
- Michele Toscano
- October 13, 2016
- Like
- 0
- Continue reading or reply
Test Code Coverage for listAcc
if(listacc != null && !listacc.isEmpty()) - if this never evaluates to true- then how can I increase my code coverage of the block of code which follows- in order to increase my test class code coverage?
Account acc = listacc[0];
samObj.Planning_Account__c= acc.ParentId;
samObj.Customer_Group__c= acc.Customer_Group_Description__c;
samObj.CABOT_Segment__c= acc.CABOT_Segment__c;
samObj.Account_Manager__c= acc.OwnerId;
samObj.Technical_Manager__c= acc.Technical_Service_Manager__c;
samObj.Ship_To_Address_Line_1__c= acc.Address_Line_1__c;
samObj.Ship_To_Address_Line_2__c= acc.Address_Line_2__c;
samObj.Ship_To_Address_Line_3__c= acc.Address_Line_3__c;
samObj.Ship_To_Address_Line_4__c= acc.Address_Line_4__c;
samObj.Account_Region__c= acc.Sub_Region__c;
samObj.Ship_To_Country__c= acc.Country__c;
samObj.Ship_To_State__c= acc.State__c;
samObj.Ship_To_City__c= acc.City__c;
samObj.Ship_To_Postal_Code__c= acc.Postal_Code__c;
Account acc = listacc[0];
samObj.Planning_Account__c= acc.ParentId;
samObj.Customer_Group__c= acc.Customer_Group_Description__c;
samObj.CABOT_Segment__c= acc.CABOT_Segment__c;
samObj.Account_Manager__c= acc.OwnerId;
samObj.Technical_Manager__c= acc.Technical_Service_Manager__c;
samObj.Ship_To_Address_Line_1__c= acc.Address_Line_1__c;
samObj.Ship_To_Address_Line_2__c= acc.Address_Line_2__c;
samObj.Ship_To_Address_Line_3__c= acc.Address_Line_3__c;
samObj.Ship_To_Address_Line_4__c= acc.Address_Line_4__c;
samObj.Account_Region__c= acc.Sub_Region__c;
samObj.Ship_To_Country__c= acc.Country__c;
samObj.Ship_To_State__c= acc.State__c;
samObj.Ship_To_City__c= acc.City__c;
samObj.Ship_To_Postal_Code__c= acc.Postal_Code__c;
-
- Michele Toscano
- August 15, 2016
- Like
- 0
- Continue reading or reply
Increasing code coverage for my test class
How can I be sure to cover the following lines of code in my apex test class? It's basically a method which is called to populateData ()
Could someone provide a code sample which would cover these lines? Many thanks!
Account acc = listacc[0];
samObj.Planning_Account__c= acc.ParentId;
samObj.Customer_Group__c= acc.Customer_Group_Description__c;
samObj.CABOT_Segment__c= acc.CABOT_Segment__c;
samObj.Account_Manager__c= acc.OwnerId;
samObj.Technical_Manager__c= acc.Technical_Service_Manager__c;
samObj.Ship_To_Address_Line_1__c= acc.Address_Line_1__c;
samObj.Ship_To_Address_Line_2__c= acc.Address_Line_2__c;
samObj.Ship_To_Address_Line_3__c= acc.Address_Line_3__c;
samObj.Ship_To_Address_Line_4__c= acc.Address_Line_4__c;
samObj.Account_Region__c= acc.Sub_Region__c;
samObj.Ship_To_Country__c= acc.Country__c;
samObj.Ship_To_State__c= acc.State__c;
samObj.Ship_To_City__c= acc.City__c;
samObj.Ship_To_Postal_Code__c= acc.Postal_Code__c;
Could someone provide a code sample which would cover these lines? Many thanks!
Account acc = listacc[0];
samObj.Planning_Account__c= acc.ParentId;
samObj.Customer_Group__c= acc.Customer_Group_Description__c;
samObj.CABOT_Segment__c= acc.CABOT_Segment__c;
samObj.Account_Manager__c= acc.OwnerId;
samObj.Technical_Manager__c= acc.Technical_Service_Manager__c;
samObj.Ship_To_Address_Line_1__c= acc.Address_Line_1__c;
samObj.Ship_To_Address_Line_2__c= acc.Address_Line_2__c;
samObj.Ship_To_Address_Line_3__c= acc.Address_Line_3__c;
samObj.Ship_To_Address_Line_4__c= acc.Address_Line_4__c;
samObj.Account_Region__c= acc.Sub_Region__c;
samObj.Ship_To_Country__c= acc.Country__c;
samObj.Ship_To_State__c= acc.State__c;
samObj.Ship_To_City__c= acc.City__c;
samObj.Ship_To_Postal_Code__c= acc.Postal_Code__c;
-
- Michele Toscano
- August 10, 2016
- Like
- 0
- Continue reading or reply
System.QueryException: List has no rows for assignment for SObject Class.SampleEditPAge.<init>: line 72, column 1
Visualforce page: (Line 72 in bold below)
<apex:page standardController="Sample_Request_Account_Information__c" extensions="SampleEditPAge" tabstyle="Sample_Request_Account_Information__c" id="pg">
<apex:form id="fm">
<apex:pagemessages id="SampleNotAllowed"/> <!--07/20/16 MT-->
<apex:actionFunction name="populateData" action="{!populateData}" immediate="true" reRender="se,se1,se2">
<apex:param name="accName" assignTo="{!accName}" value=""/>
</apex:actionFunction>
<div class="bPageTitle">
<div class="ptBody">
<div class="content">
<img src="/s.gif" alt="Sample Request Header" class="pageTitleIcon" title="Sample Request Header"/>
<h1 class="pageType">Sample Request Header Edit<span class="titleSeparatingColon">:</span></h1>
<h2 class="pageDescription"> New Sample Request Header</h2><div class="blank"> </div>
</div><div class="links">
<a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&target=co_edit.htm&section=CustomObjects&language=en_US&release=198.12.4&instance=CS7%27, %27Help%27, 1024, 768, %27width=1024,height=768,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,menubar=yes,directories=no,location=yes,dependant=no%27, false, false);" title="Help for this Page (New Window)">
<span class="helpLink">Help for this Page</span>
<img src="/s.gif" alt="" class="helpIcon"/>
</a></div></div>
<div class="ptBreadcrumb">
</div></div>
<apex:pageBlock title="Sample Request Header Edit" mode="edit" id="pd">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!savesamp}"/>
<apex:commandButton value="Save & New" action="{!saveandnew}" oncomplete="gotoNewpage();" rerender="sureid,fm"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="se">
<apex:facet name="header">
<span> <h3>Customer Information</h3></span>
<span class="pbSubExtra">
<span class="requiredLegend brandTertiaryFgr">
<span class="requiredExampleOuter">
<span class="requiredExample"> </span></span>
<span class="requiredMark">*</span>
<span class="requiredText"> = Required Information</span></span></span>
</apex:facet>
<apex:outputField value="{!samObj.Status__c}" id="f10"/>
<apex:inputField value="{!Sample_Request_Account_Information__c.Requested_Ship_From_Location__c}" id="f23"></apex:inputField>
<apex:inputField value="{!samObj.Planning_Account__c}" id="f1324"></apex:inputField>
<apex:inputField value="{!samObj.Transportation_Method__c}" id="f24"></apex:inputField>
<apex:inputField value="{!samObj.Account_Name__c}" required="true" onChange="var v = (document.getElementById(this.id + '_lkid')).value; populateData(v);" id="se2"/>
<apex:inputField value="{!samObj.Transportation_Notes__c}" id="f25"></apex:inputField>
<apex:inputField value="{!samObj.Contact_Name__c}" required="true" id="f20"></apex:inputField>
<Br/>
<apex:inputHidden value="{!gotoNewPage}" id="sureid"/>
<Br/>
<!-- <apex:actionRegion> -->
<apex:inputField value="{!samObj.LCL_Address__c}" id="f122">
<apex:actionSupport event="onchange" action="{!populatelcladdress}" reRender="se"/>
</apex:inputField>
<Br/>
<!-- </apex:actionRegion>-->
<apex:inputField value="{!samObj.JDE_Order_Number__c}" id="f215"></apex:inputField>
<apex:inputcheckbox value="{!samObj.Invoice_Required__c}" id="f26"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_1__c}" id="f12"></apex:outputField>
<apex:inputcheckbox value="{!samObj.COA_Required__c}" id="f27"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_2__c}" id="f13"></apex:outputField>
<apex:inputcheckbox value="{!samObj.MSDS_Required__c}" id="f28"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_3__c}" id="f14"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Data_Sheet_Required__c}" id="fMT001"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_4__c}" id="f15"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Freight_Charge__c}" id="f248"></apex:inputcheckbox>
<Br/>
<apex:inputField value="{!samObj.Total_weight__c}" id="f21239"></apex:inputField>
<apex:outputField value="{!samObj.Account_Region__c}" id="f212"></apex:outputField>
<apex:inputField value="{!samObj.Requested_Delivery_Date__c}" id="f2549"></apex:inputField>
<apex:outputField value="{!samObj.Ship_To_Country__c}" id="f17"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_State__c}" id="f18"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_City__c}" id="f16"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_Postal_Code__c}" id="f19"></apex:outputField>
<apex:outputField value="{!samObj.Approvel_Date__c}" id="f29"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Reference_Number__c}" id="f31"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_1__c}" id="f35"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_2__c}" id="f37"></apex:inputField>
<apex:outputField value="{!samObj.CABOT_Segment__c}" id="f211"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Group__c}" id="f2112"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Senior_Approver_Name__c}" id="f2341"></apex:inputField>
<apex:inputField value="{!samObj.Opportunity_Name__c}" id="f21"></apex:inputField>
<apex:inputField value="{!samObj.Account_Manager__c}" id="f3221"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Technical_Manager__c}" id="f33"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection id="se1">
<apex:inputField value="{!samObj.Notes__c}" style="width: 900px; height: 100px" id="f22"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2" id="se2">
<apex:outputField value="{!samObj.ownerId}" id="f11" rendered="{!hasIdval}">{!$User.FirstName} {!$User.LastName}</apex:outputField>
<apex:outputField value="{!samObj.ownerId}" rendered="{!hasNotIdval}" id="usr"></apex:outputField>
<apex:outputtext value="{!samObj.OAP_Order_Number__c}" id="f39"></apex:outputtext>
<apex:outputtext value="{!samObj.OAP_URL_Link__c}" id="f30"></apex:outputtext>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script>
function gotoNewpage()
{
// window.parent.location.href = '/apex/SampleEditPAge';
if(document.getElementById('pg:fm:pd:se:sureid') !=null)
{
var vals = document.getElementById('pg:fm:pd:se:sureid').value;
if(vals == 'sure')
window.parent.location.href = '/apex/SampleEditPAge';
}
}
</script>
</apex:page>
<apex:page standardController="Sample_Request_Account_Information__c" extensions="SampleEditPAge" tabstyle="Sample_Request_Account_Information__c" id="pg">
<apex:form id="fm">
<apex:pagemessages id="SampleNotAllowed"/> <!--07/20/16 MT-->
<apex:actionFunction name="populateData" action="{!populateData}" immediate="true" reRender="se,se1,se2">
<apex:param name="accName" assignTo="{!accName}" value=""/>
</apex:actionFunction>
<div class="bPageTitle">
<div class="ptBody">
<div class="content">
<img src="/s.gif" alt="Sample Request Header" class="pageTitleIcon" title="Sample Request Header"/>
<h1 class="pageType">Sample Request Header Edit<span class="titleSeparatingColon">:</span></h1>
<h2 class="pageDescription"> New Sample Request Header</h2><div class="blank"> </div>
</div><div class="links">
<a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&target=co_edit.htm&section=CustomObjects&language=en_US&release=198.12.4&instance=CS7%27, %27Help%27, 1024, 768, %27width=1024,height=768,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,menubar=yes,directories=no,location=yes,dependant=no%27, false, false);" title="Help for this Page (New Window)">
<span class="helpLink">Help for this Page</span>
<img src="/s.gif" alt="" class="helpIcon"/>
</a></div></div>
<div class="ptBreadcrumb">
</div></div>
<apex:pageBlock title="Sample Request Header Edit" mode="edit" id="pd">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!savesamp}"/>
<apex:commandButton value="Save & New" action="{!saveandnew}" oncomplete="gotoNewpage();" rerender="sureid,fm"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="se">
<apex:facet name="header">
<span> <h3>Customer Information</h3></span>
<span class="pbSubExtra">
<span class="requiredLegend brandTertiaryFgr">
<span class="requiredExampleOuter">
<span class="requiredExample"> </span></span>
<span class="requiredMark">*</span>
<span class="requiredText"> = Required Information</span></span></span>
</apex:facet>
<apex:outputField value="{!samObj.Status__c}" id="f10"/>
<apex:inputField value="{!Sample_Request_Account_Information__c.Requested_Ship_From_Location__c}" id="f23"></apex:inputField>
<apex:inputField value="{!samObj.Planning_Account__c}" id="f1324"></apex:inputField>
<apex:inputField value="{!samObj.Transportation_Method__c}" id="f24"></apex:inputField>
<apex:inputField value="{!samObj.Account_Name__c}" required="true" onChange="var v = (document.getElementById(this.id + '_lkid')).value; populateData(v);" id="se2"/>
<apex:inputField value="{!samObj.Transportation_Notes__c}" id="f25"></apex:inputField>
<apex:inputField value="{!samObj.Contact_Name__c}" required="true" id="f20"></apex:inputField>
<Br/>
<apex:inputHidden value="{!gotoNewPage}" id="sureid"/>
<Br/>
<!-- <apex:actionRegion> -->
<apex:inputField value="{!samObj.LCL_Address__c}" id="f122">
<apex:actionSupport event="onchange" action="{!populatelcladdress}" reRender="se"/>
</apex:inputField>
<Br/>
<!-- </apex:actionRegion>-->
<apex:inputField value="{!samObj.JDE_Order_Number__c}" id="f215"></apex:inputField>
<apex:inputcheckbox value="{!samObj.Invoice_Required__c}" id="f26"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_1__c}" id="f12"></apex:outputField>
<apex:inputcheckbox value="{!samObj.COA_Required__c}" id="f27"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_2__c}" id="f13"></apex:outputField>
<apex:inputcheckbox value="{!samObj.MSDS_Required__c}" id="f28"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_3__c}" id="f14"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Data_Sheet_Required__c}" id="fMT001"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_4__c}" id="f15"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Freight_Charge__c}" id="f248"></apex:inputcheckbox>
<Br/>
<apex:inputField value="{!samObj.Total_weight__c}" id="f21239"></apex:inputField>
<apex:outputField value="{!samObj.Account_Region__c}" id="f212"></apex:outputField>
<apex:inputField value="{!samObj.Requested_Delivery_Date__c}" id="f2549"></apex:inputField>
<apex:outputField value="{!samObj.Ship_To_Country__c}" id="f17"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_State__c}" id="f18"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_City__c}" id="f16"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_Postal_Code__c}" id="f19"></apex:outputField>
<apex:outputField value="{!samObj.Approvel_Date__c}" id="f29"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Reference_Number__c}" id="f31"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_1__c}" id="f35"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_2__c}" id="f37"></apex:inputField>
<apex:outputField value="{!samObj.CABOT_Segment__c}" id="f211"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Group__c}" id="f2112"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Senior_Approver_Name__c}" id="f2341"></apex:inputField>
<apex:inputField value="{!samObj.Opportunity_Name__c}" id="f21"></apex:inputField>
<apex:inputField value="{!samObj.Account_Manager__c}" id="f3221"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Technical_Manager__c}" id="f33"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection id="se1">
<apex:inputField value="{!samObj.Notes__c}" style="width: 900px; height: 100px" id="f22"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2" id="se2">
<apex:outputField value="{!samObj.ownerId}" id="f11" rendered="{!hasIdval}">{!$User.FirstName} {!$User.LastName}</apex:outputField>
<apex:outputField value="{!samObj.ownerId}" rendered="{!hasNotIdval}" id="usr"></apex:outputField>
<apex:outputtext value="{!samObj.OAP_Order_Number__c}" id="f39"></apex:outputtext>
<apex:outputtext value="{!samObj.OAP_URL_Link__c}" id="f30"></apex:outputtext>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script>
function gotoNewpage()
{
// window.parent.location.href = '/apex/SampleEditPAge';
if(document.getElementById('pg:fm:pd:se:sureid') !=null)
{
var vals = document.getElementById('pg:fm:pd:se:sureid').value;
if(vals == 'sure')
window.parent.location.href = '/apex/SampleEditPAge';
}
}
</script>
</apex:page>
-
- Michele Toscano
- July 25, 2016
- Like
- 0
- Continue reading or reply
quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
folowing is the lighting code :
<aura:component controller="ActivateAgreementController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" >
<aura:handler name="init" value="{!this}" action="{!c.validateandactivateagreement}"/>
<aura:attribute name="smsg" type="Boolean" default="false"/>
<aura:attribute name="emsg" type="Boolean" default="false"/>
<aura:attribute name="message" type="String"/>
<aura:if isTrue="{!v.emsg}">
<ui:message title="Error" severity="error" closable="false">
Owner Update failed. Please try again later or contact your System Admin.
</ui:message>
</aura:if>
<aura:if isTrue="{!v.smsg}">
<ui:message title="Confirmation" severity="confirm" closable="false">
<div>
ResultMessage:<ui:outputText value="{!v.message}"/>
</div>
Successfully updated Owner.
</ui:message>
</aura:if>
</aura:component>
({
validateandactivateagreement : function(component, event, helper) {
alert('start1');
var action = component.get("c.agreementactivate");
action.setParams({"id": component.get("v.recordId")});
action.setCallback(component,
function(response) {
var state = response.getReturnValue();
if (state === true){
$A.get('e.force:refreshView').fire();
component.set("v.smsg", true);
cmp.set("v.message", "hi");
} else {
component.set("v.emsg", true);
}
}
);
$A.enqueueAction(action);
}
})
global with sharing class ActivateAgreementController {
//Constructor
public ActivateAgreementController(ApexPages.StandardController controller) {
}
//Accepts the record id and sends a boolean status about the updation
@AuraEnabled @RemoteAction
global static Boolean agreementactivate(Id Agreementid){
try{
//Group oppQueue = [select Id from Group where Type = 'Queue' AND DeveloperName = 'Opportunity_Review_Queue'];
//Opportunity crec = [Select Id, OwnerId from Opportunity where Id=:oppid];
//crec.OwnerId = oppQueue.Id;
//update crec;
contract contract_record = [select Record_Type_Name__c,AccountId,telia_TC_Party__c,telia_Customer_contact_person__c,telia_Sales_person__c
,telia_Sales_responsible__c ,telia_Confidentiality_class__c,telia_Start_date__c ,telia_Signature_alternative__c
,CustomerSignedId ,CustomerSignedDate,telia_Customer_Signature_Place__c,Telia_Signed_By__c,Telia_Signed_Date__c,Signatories_Required__c from
contract where Id=:Agreementid];
return true;
}
catch(Exception e){
return false;
}
}
}
its failling from quick action in lighting .error message :
Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.
Action failed: forceChatter:lightningComponent$controller$doInit [Error while creating content for lightning component quick action]
quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
<aura:component controller="ActivateAgreementController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" >
<aura:handler name="init" value="{!this}" action="{!c.validateandactivateagreement}"/>
<aura:attribute name="smsg" type="Boolean" default="false"/>
<aura:attribute name="emsg" type="Boolean" default="false"/>
<aura:attribute name="message" type="String"/>
<aura:if isTrue="{!v.emsg}">
<ui:message title="Error" severity="error" closable="false">
Owner Update failed. Please try again later or contact your System Admin.
</ui:message>
</aura:if>
<aura:if isTrue="{!v.smsg}">
<ui:message title="Confirmation" severity="confirm" closable="false">
<div>
ResultMessage:<ui:outputText value="{!v.message}"/>
</div>
Successfully updated Owner.
</ui:message>
</aura:if>
</aura:component>
({
validateandactivateagreement : function(component, event, helper) {
alert('start1');
var action = component.get("c.agreementactivate");
action.setParams({"id": component.get("v.recordId")});
action.setCallback(component,
function(response) {
var state = response.getReturnValue();
if (state === true){
$A.get('e.force:refreshView').fire();
component.set("v.smsg", true);
cmp.set("v.message", "hi");
} else {
component.set("v.emsg", true);
}
}
);
$A.enqueueAction(action);
}
})
global with sharing class ActivateAgreementController {
//Constructor
public ActivateAgreementController(ApexPages.StandardController controller) {
}
//Accepts the record id and sends a boolean status about the updation
@AuraEnabled @RemoteAction
global static Boolean agreementactivate(Id Agreementid){
try{
//Group oppQueue = [select Id from Group where Type = 'Queue' AND DeveloperName = 'Opportunity_Review_Queue'];
//Opportunity crec = [Select Id, OwnerId from Opportunity where Id=:oppid];
//crec.OwnerId = oppQueue.Id;
//update crec;
contract contract_record = [select Record_Type_Name__c,AccountId,telia_TC_Party__c,telia_Customer_contact_person__c,telia_Sales_person__c
,telia_Sales_responsible__c ,telia_Confidentiality_class__c,telia_Start_date__c ,telia_Signature_alternative__c
,CustomerSignedId ,CustomerSignedDate,telia_Customer_Signature_Place__c,Telia_Signed_By__c,Telia_Signed_Date__c,Signatories_Required__c from
contract where Id=:Agreementid];
return true;
}
catch(Exception e){
return false;
}
}
}
its failling from quick action in lighting .error message :
Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.
Action failed: forceChatter:lightningComponent$controller$doInit [Error while creating content for lightning component quick action]
quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent
- ram kiran verma gottumukkla
- August 30, 2018
- Like
- 0
- Continue reading or reply
Increase Code Coverage - WrapperSoap
I'm at 50% code coverage of my test class. How can I increase the coverage?
Here is my apex class: (The lines bolded below are not covered...how can I cover them?)
Global class IncidentManagerCallout{
public static IncidentManager.ArrayOfSHSHresult GetIMData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMSearch(email);
}
public static IncidentManager.ArrayOfSHSHresult GetIMTimeStampSearchData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMTimeStampSearch(email);
}
}
And here is my test class:
@isTest(SeeAllData=true)
Global class TestIncidentManagerCallout{
static testMethod void Test(){
string email = GetUserInfo.GetCurrentUserEmail();
Test.setMock(WebServiceMock.class, new IncidentManagerMock());
IncidentManager.ArrayOfSHSHresult result = IncidentManagerCallout.GetIMData(email);
}
}
Here is my apex class: (The lines bolded below are not covered...how can I cover them?)
Global class IncidentManagerCallout{
public static IncidentManager.ArrayOfSHSHresult GetIMData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMSearch(email);
}
public static IncidentManager.ArrayOfSHSHresult GetIMTimeStampSearchData(string email){
IncidentManager.IncidentManagerWrapperSoap soapService = new
IncidentManager.IncidentManagerWrapperSoap ();
return soapService.IMTimeStampSearch(email);
}
}
And here is my test class:
@isTest(SeeAllData=true)
Global class TestIncidentManagerCallout{
static testMethod void Test(){
string email = GetUserInfo.GetCurrentUserEmail();
Test.setMock(WebServiceMock.class, new IncidentManagerMock());
IncidentManager.ArrayOfSHSHresult result = IncidentManagerCallout.GetIMData(email);
}
}
- Michele Toscano
- June 20, 2018
- Like
- 0
- Continue reading or reply
Javascript custom button: getting unexpected token { error
My sytax is not getting an error when I check it via my javascript button - however, when I click the button which executes it - it throws an unexpected token { error. What am I doing wrong?
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
- Michele Toscano
- October 26, 2017
- Like
- 0
- Continue reading or reply
Extra 'OR' in workflow formula
How can I fix this syntax? I want the first two lines evaluated first followed by the last two lines....another pair of eyes would be greatly appreciated.
ISCHANGED((AccountId) = True || (AccountId) <> '' ) &&
Address_Line_1__c <> '' OR
ISCHANGED((Account.LCL_Account_Name__c) = True || (Account.LCL_Account_Name__c) <> '')
&& LCL_Address_Line_1__c <> ''
ISCHANGED((AccountId) = True || (AccountId) <> '' ) &&
Address_Line_1__c <> '' OR
ISCHANGED((Account.LCL_Account_Name__c) = True || (Account.LCL_Account_Name__c) <> '')
&& LCL_Address_Line_1__c <> ''
- Michele Toscano
- December 12, 2016
- Like
- 0
- Continue reading or reply
Aggregrate query has too many rows for assignment
How can I get around the aggregrate query error? When I tried taking out the For loop- the execution then failed. Is there a better way to do it?
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c,(select Id,Expiration_Date_Change_To__c,Effective_date__c from Pricing_Inputs__r) from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']) //-->system does not like this
{
maprecTypewithId.put(rec.Name,rec.id);
}
for(Price_Authorization_Request__c parObj : Parlist)
{
if(parObj.Pricing_Inputs__r != null && !parObj.Pricing_Inputs__r.isEmpty())
{
Integer count = 0;
for(Pricing_Input__c PrcInputObj : parObj.Pricing_Inputs__r)
{
if(PrcInputObj.Expiration_Date_Change_To__c != null && PrcInputObj.Expiration_Date_Change_To__c < system.today())
{
count = count + 1;
}
}
if(count ==(parObj.Pricing_Inputs__r).size())
{
parObj.Par_Status__c = 'Expired';
// parObj.Expiration_Date__c=Date.valueOf(System.Today());
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
global void finish(Database.BatchableContext BC)
{}
}
global class Batch_ExpDate_PricIn implements Database.Batchable<sObject>,Database.Stateful
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired'; //Correct Status -11/2/16 MT
string expiredStr = 'Expired';
string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c,(select Id,Expiration_Date_Change_To__c,Effective_date__c from Pricing_Inputs__r) from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Price_Authorization_Request__c> Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']) //-->system does not like this
{
maprecTypewithId.put(rec.Name,rec.id);
}
for(Price_Authorization_Request__c parObj : Parlist)
{
if(parObj.Pricing_Inputs__r != null && !parObj.Pricing_Inputs__r.isEmpty())
{
Integer count = 0;
for(Pricing_Input__c PrcInputObj : parObj.Pricing_Inputs__r)
{
if(PrcInputObj.Expiration_Date_Change_To__c != null && PrcInputObj.Expiration_Date_Change_To__c < system.today())
{
count = count + 1;
}
}
if(count ==(parObj.Pricing_Inputs__r).size())
{
parObj.Par_Status__c = 'Expired';
// parObj.Expiration_Date__c=Date.valueOf(System.Today());
if(parObj.RecordType.Name == 'Standard PAR' && maprecTypewithId.get('ReadOnlyStandard PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyStandard PAR');
else if(parObj.RecordType.Name == 'Formula PAR' && maprecTypewithId.get('ReadOnlyFormula PAR') != null)
parObj.RecordTypeId = maprecTypewithId.get('ReadOnlyFormula PAR');
listPARToUpdate.add(parObj);
}
}
}
if(!listPARToUpdate.isEmpty())
update listPARToUpdate;
}
}
global void finish(Database.BatchableContext BC)
{}
}
- Michele Toscano
- November 02, 2016
- Like
- 0
- Continue reading or reply
Invalid initial value type List for List
I've tried to put my query directly in a list and then loop through the list but I'm getting an error invalid value type list for list.
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>([select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']);
for(RecordType rec : listPARToUpdate)
{
maprecTypewithId.put(rec.Name,rec.id);
}
However, If I try it this way - I get the aggregrate query FOR loop error (due to large recrod set)
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
What is the best way to achieve this - without exceeding governor limits?
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>([select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c']);
for(RecordType rec : listPARToUpdate)
{
maprecTypewithId.put(rec.Name,rec.id);
}
However, If I try it this way - I get the aggregrate query FOR loop error (due to large recrod set)
Map<String,string> maprecTypewithId = new Map<String,String>();
List<Price_Authorization_Request__c> listPARToUpdate = new List<Price_Authorization_Request__c>();
for(RecordType rec : [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'])
{
maprecTypewithId.put(rec.Name,rec.id);
}
What is the best way to achieve this - without exceeding governor limits?
- Michele Toscano
- November 02, 2016
- Like
- 0
- Continue reading or reply
Expecting a semi-colon , found '01'
Id 01pF000000452WnIAI = Database.executeBatch(new Batch_ExpDate_PricIn(), 190);
The id referenced is correct. What am I doing wrong here?
The id referenced is correct. What am I doing wrong here?
- Michele Toscano
- October 13, 2016
- Like
- 0
- Continue reading or reply
illegal assignment from list to list
global void execute(Database.BatchableContext BC, List Parlist) {
if(Parlist != null && !Parlist.isEmpty())
{
Map maprecTypewithId = new Map();
List listPARToUpdate = [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'];
for(RecordType rec : listPARToUpdate )
{
maprecTypewithId.put(rec.Name,rec.id);
}
How can I avoid my illegal assignment of lists? Also, where would I specify a batchable size of 190?
if(Parlist != null && !Parlist.isEmpty())
{
Map maprecTypewithId = new Map();
List listPARToUpdate = [select id,Name from recordType where SObjectType = 'Price_Authorization_Request__c'];
for(RecordType rec : listPARToUpdate )
{
maprecTypewithId.put(rec.Name,rec.id);
}
How can I avoid my illegal assignment of lists? Also, where would I specify a batchable size of 190?
- Michele Toscano
- October 13, 2016
- Like
- 0
- Continue reading or reply
Unexpected token: '{'
What is wrong with the syntax in this statement? I have a syntax error on the first if statement line saying unexpected token:
public pagereference savesamp()
//Prevent user from entering a sample request using an Inactive account or one without an address line 1 -07/19/16 MT
{
if({!ISPICKVAL(Account.Account_Status__c, "Inactive")} || {!Account.Address_Line_1__c} == '')
ApexPages.Message SampleNotAllowed = new ApexPages.Message(ApexPages.Severity.ERROR,'Account must be active and contain an address in order to raise a sample request.');
ApexPages.addMessage(SampleNotAllowed);
return null;
try{
upsert samObj;
}Catch(Exception ex)
{
ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,ex.getMessage());
ApexPages.addMessage(errorMessage);
return null;
}
return new pagereference('/'+samObj.id);
}
public pagereference savesamp()
//Prevent user from entering a sample request using an Inactive account or one without an address line 1 -07/19/16 MT
{
if({!ISPICKVAL(Account.Account_Status__c, "Inactive")} || {!Account.Address_Line_1__c} == '')
ApexPages.Message SampleNotAllowed = new ApexPages.Message(ApexPages.Severity.ERROR,'Account must be active and contain an address in order to raise a sample request.');
ApexPages.addMessage(SampleNotAllowed);
return null;
try{
upsert samObj;
}Catch(Exception ex)
{
ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,ex.getMessage());
ApexPages.addMessage(errorMessage);
return null;
}
return new pagereference('/'+samObj.id);
}
- Michele Toscano
- July 19, 2016
- Like
- 0
- Continue reading or reply