-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
23Questions
-
13Replies
Looking to reference a value from a related object
Hi there.
I have an object called "Work Orders". I have a related object called "Pre-Work Orders".
I want to reference the custom Status field from the Pre-Work order ON the Work Order record.
I don't know how to do this. Because it's a related object, I don't see any way to access it through the formula builder options?
I believe I can create a "related object" formula like so:
WorkOrder__r.Pre_Work_Order__r.Status__c
I keep getting this: Error: Field WorkOrder__r does not exist. Check spelling.
I'm unsure of the correct format I need to reference?
Any help would be appricated. Thank you.
-
- Dee Dee Aaron
- January 27, 2021
- Like
- 0
- Continue reading or reply
Help to Create Test Class Based on my Apex Trigger
I have an Apex trigger, but I will need help to create the test class. Thank you for your help in Advance:
Apex Trigger
trigger FeedCommentUpdatetoNetPlanning on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'GeoLinks Net Planning')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Awaiting Reply from Rep';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
-
- Dee Dee Aaron
- December 22, 2020
- Like
- 0
- Continue reading or reply
Code Coverage Failure Error
I am getting a code coverage failure warning. I'm not a developer, so I don't know where I went wrong? Thank you for your help.
1. I created an Apex Trigger and Apex Test Class
2. I attempted to deploy the change set and received:
Error: Code Coverage Failure
Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Apex Trigger
trigger FeedCommentUpdatetoNetPlanning on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'GeoLinks Net Planning')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Awaiting Reply from Rep';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
Test Class
@isTest
public class FeedCommentUpdatetoNetPlanning {
@isTest
public static void testFeedCommentUpdatetoNetPlanning() {
//Create a User with Profile 'Net Planning Department'
Id pid = [Select Id FROM Profile WHERE Name = 'Net Planning Department'].Id;
User u = new User();
u.ProfileId = pid;
//here fill all the required fields for the User Record
insert u;
SALES_ENGINEERING_REQUEST__c s = new SALES_ENGINEERING_REQUEST__c();
s.Status__c = //any Value othe than "Approved" and "Unable to Meet Request"
//here fill all the required fields for the SALES_ENGINEERING_REQUEST__c Record
s.Name = 'Test SER 1';
s.Layer__c = 'Layer 2';
//Since test class runs in the current user mode and in this Trigger lines will be covered only when the //User has a Profile - 'Net Planning Department' hence we need trigger this event as the new User created with this //Profile
System.runAs(u) {
FeedComment f = new FeedComment();
//here fill all the required fields for FeedCommentRecord
Test.startTest();
insert f;
Test.stopTest();
}
SALES_ENGINEERING_REQUEST__c updatedRecord = [SELECT Id,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE Id =: s.Id];
System.assertequals('Approved',updatedRecord.Status__c);
}
}
-
- Dee Dee Aaron
- December 21, 2020
- Like
- 0
- Continue reading or reply
Help with test class - where to insert required fields?
The two required fields that need to be inserted:
Name (Name) *Standard Text field.
Layer (Layer__c) *This is a picklist. The 2 options are "Layer 2" "Layer 3"
Can you please insert them for me?
*I see another area in the test class that says "insert f". I'm not sure what I need to insert in that spot?
Test class:
@isTest
public class FeedCommentTriggerTest {
@isTest
public static void testFeedCommentTrigger() {
//Create a User with Profile 'Net Planning Department'
Id pid = [Select Id FROM Profile WHERE Name = 'Net Planning Department'].Id;
User u = new User();
u.ProfileId = pid;
//here fill all the required fields for the User Record
insert u;
SALES_ENGINEERING_REQUEST__c s = new SALES_ENGINEERING_REQUEST__c();
s.Status__c = //any Value othe than "Approved" and "Unable to Meet Request"
//here fill all the required fields for the SALES_ENGINEERING_REQUEST__c Record
insert s;
//Since test class runs in the current user mode and in this Trigger lines will be covered only when the //User has a Profile - 'Net Planning Department' hence we need trigger this event as the new User created with this //Profile
System.runAs(u) {
FeedComment f = new FeedComment();
f.ParentId = s.Id;
//here fill all the required fields for FeedCommentRecord
Test.startTest();
insert f;
Test.stopTest();
}
SALES_ENGINEERING_REQUEST__c updatedRecord = [SELECT Id,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE Id =: s.Id];
System.assertequals('Approved',updatedRecord.Status__c);
}
}
Thank you for your help!
-
- Dee Dee Aaron
- December 21, 2020
- Like
- 0
- Continue reading or reply
Help to fill in 2 required fields on test class
My oringal Apex Trigger: (for reference if needed)
trigger FeedCommentTest on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'Net Planning Department')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Approved';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
The test class that was created by another member:
@isTest
public class FeedCommentTriggerTest {
@isTest
public static void testFeedCommentTrigger() {
//Create a User with Profile 'Net Planning Department'
Id pid = [Select Id FROM Profile WHERE Name = 'Net Planning Department'].Id;
User u = new User();
u.ProfileId = pid;
//here fill all the required fields for the User Record
insert u;
SALES_ENGINEERING_REQUEST__c s = new SALES_ENGINEERING_REQUEST__c();
s.Status__c = //any Value othe than "Approved" and "Unable to Meet Request"
//here fill all the required fields for the SALES_ENGINEERING_REQUEST__c Record
insert s;
//Since test class runs in the current user mode and in this Trigger lines will be covered only when the //User has a Profile - 'Net Planning Department' hence we need trigger this event as the new User created with this //Profile
System.runAs(u) {
FeedComment f = new FeedComment();
f.ParentId = s.Id;
//here fill all the required fields for FeedCommentRecord
Test.startTest();
insert f;
Test.stopTest();
}
SALES_ENGINEERING_REQUEST__c updatedRecord = [SELECT Id,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE Id =: s.Id];
System.assertequals('Approved',updatedRecord.Status__c);
}
}
The two required fields that need to be inserted:
Name (Name) *Standard Text field.
Layer (Layer__c) *This is a picklist. The 2 options are "Layer 2" "Layer 3"
Can you please insert them? I'm not sure how they need to be formatted.
*Question: I have some validation rules on this object. Will that cause any issues? (E.g. IF this field is blank then this other field is required). Thank you for your help.
*I see another area in the test class that says "insert f". I'm not sure what I need to insert in that spot?
Thank you for your help!
-
- Dee Dee Aaron
- December 17, 2020
- Like
- 0
- Continue reading or reply
Help to create a test class
I have an Apex class that works, but I need to create a test class for it. I'm not a developer and don't know how, so I sincerely appreciate your help. Thank you.
Apex Trigger:
trigger FeedCommentTest on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'Net Planning Department')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Approved';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
-
- Dee Dee Aaron
- December 16, 2020
- Like
- 0
- Continue reading or reply
Can you please help write a test class?
Could you please help me write a test class for this? Thank you for your help!
trigger FeedCommentUpdatetoNetPlanning on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'GeoLinks Net Planning')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Awaiting Response from Net Planning';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
-
- Dee Dee Aaron
- November 19, 2020
- Like
- 0
- Continue reading or reply
Help to write test class
trigger FeedCommentTest on FeedComment (after insert)
{
for(FeedComment f : Trigger.New)
{
if(UserInfo.getProfileId() == '00e6w000000QHyUAAW')
{
Sales_Engineering_Request__c SalesEngineeringRequestToUpdate = [SELECT ID FROM SALES_ENGINEERING_REQUEST__c WHERE ID =: f.ParentId];
SalesEngineeringRequestToUpdate.Status__c = 'Approved';
Update SalesEngineeringRequestToUpdate;
}
}
}
-
- Dee Dee Aaron
- November 18, 2020
- Like
- 0
- Continue reading or reply
Set criteria for trigger to fire.
If the Sales Engineering Request “Status” does not equal “Approved” or “Unable to Meet Request”, then trigger this.
How do I modify this? Thank you for your help.
My Trigger:
trigger FeedCommentTest on FeedComment (after insert)
{
for(FeedComment f : Trigger.New)
{
if(UserInfo.getProfileId() == '00e6w000000FjiUAAS')
{
Sales_Engineering_Request__c SalesEngineeringRequestToUpdate = [SELECT ID FROM SALES_ENGINEERING_REQUEST__c WHERE ID =: f.ParentId];
SalesEngineeringRequestToUpdate.Status__c = 'Approved';
Update SalesEngineeringRequestToUpdate;
}
}
}
-
- Dee Dee Aaron
- November 18, 2020
- Like
- 0
- Continue reading or reply
Trigger Help for FeedComment
https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK
https://developer.salesforce.com/forums/?id=906F0000000fyASIAY (https://developer.salesforce.com/forums/?id=906F0000000fyASIAY" style="color:#0563c1; text-decoration:underline)
I have a custom object called “Sales Engineering Request” and there’s a chatter feed on this object.
I have a custom “status” field with a picklist and I want the value to be updated based on the last Feed Comment that was made.
Criteria:
If status is in “Pending Review" or "Awaiting Reply from Net Planning" or "Awaiting Reply from Sales”, then update based on the last commenter.
If the last person who commented is part of the Net Planning Department (User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Sales”
If the last person who commented is NOT part of the Net Planning Department (Does NOT have User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Net Planning”
Note: I was able to get this to work using a process builder for the feeditem, but the feedcomment is not available from Workflows, Process Builders, or Flows, so I believe a trigger is the best path.
Thank you for your help.
-
- Dee Dee Aaron
- November 18, 2020
- Like
- 0
- Continue reading or reply
Help to write trigger.
https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK
I have a custom object called “Sales Engineering Request” and there’s a chatter feed on this object.
I have a custom “status” field with a picklist and I want the value to be updated based on the last Feed Comment that was made.
Criteria:
If status is in “Pending Review" or "Awaiting Reply from Net Planning" or "Awaiting Reply from Sales”, then update based on the last commenter.
If the last person who commented is part of the Net Planning Department (User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Sales”
If the last person who commented is NOT part of the Net Planning Department (Does NOT have User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Net Planning”
Note: I was able to get this to work using a process builder for the feeditem, but the feedcomment is not available from Workflows, Process Builders, or Flows, so I believe a trigger is the best path.
Thank you for your help.
-
- Dee Dee Aaron
- November 17, 2020
- Like
- 0
- Continue reading or reply
Help to setup a Trigger
https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK
I have a custom object called “Sales Engineering Request” and there’s a chatter feed on this object.
I have a custom “status” field with a picklist and I want the value to be updated based on the last Feed Comment that was made.
Criteria:
If status is in “Pending Review" or "Awaiting Reply from Net Planning" or "Awaiting Reply from Sales”, then update based on the last commenter.
If the last person who commented is part of the Net Planning Department (User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Sales”
If the last person who commented is NOT part of the Net Planning Department (Does NOT have User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Net Planning”
Any help is appreciated. Thank you so much!
-
- Dee Dee Aaron
- November 17, 2020
- Like
- 0
- Continue reading or reply
Help to create a Trigger.
I have a custom “status” field with a picklist and I want the value to be updated based on the last Feed Comment that was made.
So...
If status is in “Pending Review" or "Awaiting Reply from Net Planning" or "Awaiting Reply from Sales”, then update based on the last commenter.
If the last person who commented is part of the Net Planning Department (User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Sales”
If the last person who commented is NOT part of the Net Planning Department (Does NOT have User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Net Planning”
I believe I could create a trigger to do this, but I don’t know how? I found this article: https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK
Any help is appreciated. Thank you so much!
-
- Dee Dee Aaron
- November 17, 2020
- Like
- 0
- Continue reading or reply
Code Coverage Failure - Your code coverage is 0%.
Code Coverage Failure: Your code coverage is 0%.
This is the Apex Class:
public class DeleteUnacceptedQuotes
{
@InvocableMethod
public static void QuoteDelete(List<Id> OpportunityIds)
{
List<Quote> Quotes =[select id from quote
where Opportunity.id in :OpportunityIds
and Status != 'Accepted'];
delete Quotes;
}
}
Thank you for your help!
-
- Dee Dee Aaron
- November 12, 2020
- Like
- 0
- Continue reading or reply
Code Coverage Failure: Your code coverage is 0%.
Hi. I found this apex class online (it's super simple). It triggered successfully in my sandbox. When deploying to my production org, I tried validating and received an error:
Code Coverage Failure: Your code coverage is 0%.
This is the Apex Class:
public class DeleteUnacceptedQuotes
{
@InvocableMethod
public static void QuoteDelete(List<Id> OpportunityIds)
{
List<Quote> Quotes =[select id from quote
where Opportunity.id in :OpportunityIds
and Status != 'Accepted'];
delete Quotes;
}
}
Thank you for your help!
-
- Dee Dee Aaron
- November 03, 2020
- Like
- 0
- Continue reading or reply
Simple APEX class won't save.
Hi. I am adding this APEX class referenced in the following article:
https://automationchampion.com/tag/auto-delete-record-using-process-builder/
It won't save because I'm getting the following error:
Error: Compile Error: Unexpected token 'List'. at line 6 column 9
Thank you for your help.
Code listed here:
public class DeleteUnaccepted
Quotes { @InvocableMethod
public static void QuoteDelete(List<Id> OpportunityIds)
{
List Quotes =[select id from quote
where Opportunity.id in :OpportunityIds
and Status != 'Accepted'];
delete Quotes;
}
}
-
- Dee Dee Aaron
- October 19, 2020
- Like
- 0
- Continue reading or reply
Validation Rule: Must have at least 6 digits after the decimal point.
I’m looking to create a validation rule on a Geolocation field (longitude and latitude fields).
I want to ensure that the Sales reps are entering values that have a MINIMUM of 6 digits after the decimal place. How would I do this? I was thinking of creating a validation rule. But I’m not sure how to create the logic.
For example:
11.123456 (acceptable)
11.12345 (not acceptable)
Field Name: Coordinates __c
Thank you for your help!
-
- Dee Dee Aaron
- September 29, 2020
- Like
- 0
- Continue reading or reply
Help creating a Trigger or Flow to update the “opportunity product” dollar amount
We are looking to create tiered pricing without using a full-blown CPQ solution.
We sell equipment models with different speeds. When a different speed is entered, we want the pricing to autofill.
Note: We don’t want to create separate products to accommodate this because there would be way too many products (speeds range from 3 to 10,000).
What we’re looking for: IF a rep enters a download speed of 100 and an upload speed of 200, then enter the product price as $XXX.XX
Pricing is tiered. THINK: 1-100 is $100 per and 101-200 is $0.50 per etc. I’m not a developer and need help to formulate this flow or trigger. Any help would be appreciated. I will mark as best answer if you’re able to help accomplish this.
Object: Opportunity Product
Fields:
Upload_Speed_Mbps__c (Number field)
Download_Speed_Mbps__c (Number field)
UnitPrice (Currency)
-
- Dee Dee Aaron
- September 02, 2020
- Like
- 0
- Continue reading or reply
How to migrate files from 1 org to another?
- I already tried running a report to show all files, but it’s not showing any files.
- As a test, I attached a file myself. The report didn’t even show the file that was owned by me.
- Not sure what the best way is to go about this?
Thank you for your help.
-
- Dee Dee Aaron
- September 02, 2020
- Like
- 0
- Continue reading or reply
Ability to use tiered pricing without CPQ
We’re looking to create tiered pricing without using a full-blown CPQ solution.
We sell equipment models with different speeds. When a different speed is entered, we want the pricing to autofill.
Note: We don’t want to create separate products to accommodate this because there would be way too many products (speeds range from 3 to 10,000).
What we’re looking for: IF a rep enters a speed of 100/100, then enter the product price as $XXX.XX
Thank you for your help! Would I need to use a trigger to do this? What would you recommend?
Thank you for your help!
-
- Dee Dee Aaron
- September 02, 2020
- Like
- 0
- Continue reading or reply
Looking to reference a value from a related object
Hi there.
I have an object called "Work Orders". I have a related object called "Pre-Work Orders".
I want to reference the custom Status field from the Pre-Work order ON the Work Order record.
I don't know how to do this. Because it's a related object, I don't see any way to access it through the formula builder options?
I believe I can create a "related object" formula like so:
WorkOrder__r.Pre_Work_Order__r.Status__c
I keep getting this: Error: Field WorkOrder__r does not exist. Check spelling.
I'm unsure of the correct format I need to reference?
Any help would be appricated. Thank you.
- Dee Dee Aaron
- January 27, 2021
- Like
- 0
- Continue reading or reply
Help to fill in 2 required fields on test class
My oringal Apex Trigger: (for reference if needed)
trigger FeedCommentTest on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'Net Planning Department')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Approved';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
The test class that was created by another member:
@isTest
public class FeedCommentTriggerTest {
@isTest
public static void testFeedCommentTrigger() {
//Create a User with Profile 'Net Planning Department'
Id pid = [Select Id FROM Profile WHERE Name = 'Net Planning Department'].Id;
User u = new User();
u.ProfileId = pid;
//here fill all the required fields for the User Record
insert u;
SALES_ENGINEERING_REQUEST__c s = new SALES_ENGINEERING_REQUEST__c();
s.Status__c = //any Value othe than "Approved" and "Unable to Meet Request"
//here fill all the required fields for the SALES_ENGINEERING_REQUEST__c Record
insert s;
//Since test class runs in the current user mode and in this Trigger lines will be covered only when the //User has a Profile - 'Net Planning Department' hence we need trigger this event as the new User created with this //Profile
System.runAs(u) {
FeedComment f = new FeedComment();
f.ParentId = s.Id;
//here fill all the required fields for FeedCommentRecord
Test.startTest();
insert f;
Test.stopTest();
}
SALES_ENGINEERING_REQUEST__c updatedRecord = [SELECT Id,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE Id =: s.Id];
System.assertequals('Approved',updatedRecord.Status__c);
}
}
The two required fields that need to be inserted:
Name (Name) *Standard Text field.
Layer (Layer__c) *This is a picklist. The 2 options are "Layer 2" "Layer 3"
Can you please insert them? I'm not sure how they need to be formatted.
*Question: I have some validation rules on this object. Will that cause any issues? (E.g. IF this field is blank then this other field is required). Thank you for your help.
*I see another area in the test class that says "insert f". I'm not sure what I need to insert in that spot?
Thank you for your help!
- Dee Dee Aaron
- December 17, 2020
- Like
- 0
- Continue reading or reply
Help to create a test class
I have an Apex class that works, but I need to create a test class for it. I'm not a developer and don't know how, so I sincerely appreciate your help. Thank you.
Apex Trigger:
trigger FeedCommentTest on FeedComment (after insert)
{
Id profileId = UserInfo.getProfileId();
String profileName =[Select Id, Name from Profile where Id=:profileId].Name;
Set<id> SalesEngineeringSet = new Set<Id>();
List<SALES_ENGINEERING_REQUEST__c> serList = new List<SALES_ENGINEERING_REQUEST__c>();
for(FeedComment f : Trigger.New)
{
if(profileName == 'Net Planning Department')
{
SalesEngineeringSet.add(f.ParentId);
}
}
if(!SalesEngineeringSet.IsEmpty()){
for(SALES_ENGINEERING_REQUEST__c ser : [SELECT ID,Status__c FROM SALES_ENGINEERING_REQUEST__c WHERE ID In: SalesEngineeringSet]){
if(ser.Status__c != 'Approved' && ser.Status__c != 'Unable to Meet Request'){
ser.Status__c = 'Approved';
serList.add(ser);
}
}
}
if(!serList.IsEmpty())
update serList;
}
- Dee Dee Aaron
- December 16, 2020
- Like
- 0
- Continue reading or reply
Set criteria for trigger to fire.
If the Sales Engineering Request “Status” does not equal “Approved” or “Unable to Meet Request”, then trigger this.
How do I modify this? Thank you for your help.
My Trigger:
trigger FeedCommentTest on FeedComment (after insert)
{
for(FeedComment f : Trigger.New)
{
if(UserInfo.getProfileId() == '00e6w000000FjiUAAS')
{
Sales_Engineering_Request__c SalesEngineeringRequestToUpdate = [SELECT ID FROM SALES_ENGINEERING_REQUEST__c WHERE ID =: f.ParentId];
SalesEngineeringRequestToUpdate.Status__c = 'Approved';
Update SalesEngineeringRequestToUpdate;
}
}
}
- Dee Dee Aaron
- November 18, 2020
- Like
- 0
- Continue reading or reply
Code Coverage Failure - Your code coverage is 0%.
Code Coverage Failure: Your code coverage is 0%.
This is the Apex Class:
public class DeleteUnacceptedQuotes
{
@InvocableMethod
public static void QuoteDelete(List<Id> OpportunityIds)
{
List<Quote> Quotes =[select id from quote
where Opportunity.id in :OpportunityIds
and Status != 'Accepted'];
delete Quotes;
}
}
Thank you for your help!
- Dee Dee Aaron
- November 12, 2020
- Like
- 0
- Continue reading or reply
Code Coverage Failure: Your code coverage is 0%.
Hi. I found this apex class online (it's super simple). It triggered successfully in my sandbox. When deploying to my production org, I tried validating and received an error:
Code Coverage Failure: Your code coverage is 0%.
This is the Apex Class:
public class DeleteUnacceptedQuotes
{
@InvocableMethod
public static void QuoteDelete(List<Id> OpportunityIds)
{
List<Quote> Quotes =[select id from quote
where Opportunity.id in :OpportunityIds
and Status != 'Accepted'];
delete Quotes;
}
}
Thank you for your help!
- Dee Dee Aaron
- November 03, 2020
- Like
- 0
- Continue reading or reply
Validation Rule: Must have at least 6 digits after the decimal point.
I’m looking to create a validation rule on a Geolocation field (longitude and latitude fields).
I want to ensure that the Sales reps are entering values that have a MINIMUM of 6 digits after the decimal place. How would I do this? I was thinking of creating a validation rule. But I’m not sure how to create the logic.
For example:
11.123456 (acceptable)
11.12345 (not acceptable)
Field Name: Coordinates __c
Thank you for your help!
- Dee Dee Aaron
- September 29, 2020
- Like
- 0
- Continue reading or reply
How to migrate files from 1 org to another?
- I already tried running a report to show all files, but it’s not showing any files.
- As a test, I attached a file myself. The report didn’t even show the file that was owned by me.
- Not sure what the best way is to go about this?
Thank you for your help.
- Dee Dee Aaron
- September 02, 2020
- Like
- 0
- Continue reading or reply