• Navin Selvaraj23
  • NEWBIE
  • 185 Points
  • Member since 2019
  • Senior Conultant

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 43
    Replies
I have method , method1() with a try catch block. I also have 2 more methods, method2() and method3() which does some operation and throws an exception.
I want to catch that exception and perform my operation based on the exception message. Below is the code.
I’m getting error here. Please help.

public void static method1(){

try{

Calls method

}catch(Exception ex){

    if (ex == ‘Configuration JSON value limit exceeded’){
        //DO AN OPERATION AND THROW A CUSTOM EXCEPTION
    }
    else if(‘RuleAction HTMLContent limit exceeded’){
        //DO A DIFFERENT OPERATION AND THROW A CUSTOM EXCEPTION
    }

}

}


public void static method2(){

If (//CONDITION SATISFIES){
Calls method3();
}
Else{
throw new StringException('Configuration JSON value limit exceeded');
}
}

public void static method3(){

If (//CONDITION SATISFIES){
Perform an operation
}
else
{
throw new StringException('RuleAction HTMLContent limit exceeded');
}
}
I am using Rollup Helper to rollup summary values to Account from various related objects. The problem is that I am now hitting CPU Limits because I have too many. Will creating triggers to do the rollup summaries help avoid the limits? 
I have done the Trailhead on Apex Unit Tests, and I just don't seem to be getting it. I wrote a trigger that will update my Opp Stage when my DocuSign Envelope Status = Completed. I need to test this so I can move it production. Your help is greatly appreciated!
Trigger updateRelatedOpportunity on dsfs__DocuSign_Status__c(before insert,before update){
    
    List<Id> oppIds = new List<Id>();
    for(dsfs__DocuSign_Status__c dc:trigger.new){
    if(dc.dsfs__Envelope_Status__c =='Completed'){	
    oppIds.add(dc.dsfs__Opportunity__c);  
    
    }
    }
    
    List<Opportunity> oppList = [select StageName from Opportunity where id in:oppIds];
    List<Opportunity> oppListnew  = new List<Opportunity>();
    
    for(Opportunity op : oppList){
    op.StageName ='SOW Received';
    oppListnew.add(op);
    }
    update oppListnew;

}
This is my Class


public class AccountHandler {
public static Account insertNewAccount(String name,INTEGER Phn) {
Account a = new Account();
a.Name = name;
a.phone = 'Phn';    
try
{
insert a;
} catch (Exception e) {
return null;
}
return a;
}
}



Calling from Execute Anonymous

AccountHandler.insertNewAccount('RKNN',12345);



In Account record page iam getting Phone field value as Phn . Instead of 12345 , which i had passed in method. How to get phone field value as 12345 as passed in execute anonymous block.
 

Example :

1.Update a phone number to backend

2.once successfull response comes from backend.

3.take the 'oldphone' and 'newphone'number value(planning to use trigger).

4.put both old and new phone number values in an array.

5.pass it to a table to form a  note text.

note text will be like 'Phone number chnaged from %Oldphone% to %newPhone%'

once the text updated with phone values.

update the text to backend

'

Hi

is there any possibility to create field dependency matrix dynamically using tooling api or meta data api.
 
If you guys have any idea, please help me on this. This is an urgent requirement. desperately needed this.


Regards,
Navin S
 
Hi,

I have a requirement to insert field dependency values dynamically.
is there any possibliltiy in tooling api or metadata api which is used inside salesforce where we can able to achieve this functionality.
I have 250+ controlling field values and 150+ dependent picklist values. Updating frequently this field dependency tooks a lot of time. So, is there any possiblity to insert the field dependency values dynamiclly.

Please help me on this as this is the urgent requirement for our projects.


Regards,
Navin S
Hello everyone,

I have an urgent requirement. I need to create a table with fixed header, fixed left column, fixed right column with both horizontal and vertical scrolling.

PFB the screenshot of the table. Please provide me the code if possible. 
Table image
i got vertical and horizontal scrolling. But i got issue in header and not able to make a fixed left column.

I have not used lightning data table.
I have used norma html table along with CSS. I am not good in css. So please help me with some working code with code in lightning component and css in style.css
Hello, 
I have just started learning SOQL and Apex programming concepts.  I need some help with retrieving results using SOQL query.  
The requirement is: to get all the records where Planning date__c is less than 14 days. 
Any help is appreciated. 

Thank you. 
How can I export activity history of all cases more than 2 years old into a .CSV file. I cant able to use the dataloader/workbench for this. what are all the alternatives?

I can able to run the below sample query from developer console i cant able to execute it in workbench.

Select (select Subject,Due_Date_SLO__c,activityType,CallBackEndTime__c,Status,Owner.Name,LastModifiedDate,Queue_Jumper__c FROM ActivityHistories) from Case where Id='5000c00001Wzaj6AAB'
I have method , method1() with a try catch block. I also have 2 more methods, method2() and method3() which does some operation and throws an exception.
I want to catch that exception and perform my operation based on the exception message. Below is the code.
I’m getting error here. Please help.

public void static method1(){

try{

Calls method

}catch(Exception ex){

    if (ex == ‘Configuration JSON value limit exceeded’){
        //DO AN OPERATION AND THROW A CUSTOM EXCEPTION
    }
    else if(‘RuleAction HTMLContent limit exceeded’){
        //DO A DIFFERENT OPERATION AND THROW A CUSTOM EXCEPTION
    }

}

}


public void static method2(){

If (//CONDITION SATISFIES){
Calls method3();
}
Else{
throw new StringException('Configuration JSON value limit exceeded');
}
}

public void static method3(){

If (//CONDITION SATISFIES){
Perform an operation
}
else
{
throw new StringException('RuleAction HTMLContent limit exceeded');
}
}
I am using Rollup Helper to rollup summary values to Account from various related objects. The problem is that I am now hitting CPU Limits because I have too many. Will creating triggers to do the rollup summaries help avoid the limits? 
326:  offer__Share offerShare=new offer__Share();     327:offerShare.userorgroupid =[Select id from user where id=:userinfo.getuserid()].id;  
   328: offerShare.AccessLevel = 'Edit';    
    329: insert offershare; 
I want to auto-populate the standard 'Lead Source' (picklist) field with a part of the string stored in another field called the Source Tracking Code. The Source Tracking Code looks something like this -- Offline>TradeShow>SHRM2018>>

For this I have created an Apex class to break the string into parts and then search for the part which matches the picklist values. Please note that I have created a custom picklist field Lead Source3 (using instead of Lead Source) for Testing


public class LeadSource {

public static void LeadSource(){
List<Lead> l = new List<Lead>();

for(Lead ls:l)
{
String alpha = ls.Manticore_Full_Promotion_Code__c;
List<String> lstAlpha = alpha.split('>');

Set<String> convertInSet = new Set<String>(lstAlpha);

String FinalValue;

if(convertInSet.contains('401k Exchange')){
    FinalValue = '401k Exchange';
}
else if(convertInSet.contains('Affiliate')){
    FinalValue = 'Affiliate';
}
else if(convertInSet.contains('Bing')){
    FinalValue = 'Bing';
}


ls.Lead_Source3__c = FinalValue;

}
 

}
}


After this I created a Trigger to run this Apex class as below

trigger LeadSource on Lead (before insert, before update) {


for(Lead myLeads:Trigger.new){

LeadSource.LeadSource();
}
}

I am new to Programming and to Salesforce, could somebody please help me figure out why I am not able to get anything populated on the Laed Source3 field.

Thanks,
Tanushree
 
Hello. I'm working on the API and am trying to query the table named "Order" and also sort the results. I get an error because the word order is a reserved word in SQL. How do I work around this? I've tried brackets and backticks around the table name, but neither of those worked.

SELECT OrderNumber FROM Order limit 5 order by OrderNumber

How do I use the reserved word "order" as the table name?

Thank you!
Hello I want to make trigger for If a Territory__c record’s sales representative is changed (and only when it is changed), repeat Requirement #2’s logic for all Accounts associated with the Territory.
Here is requirement 2:
Requirement #2: When an Account’s BillingPostalCode (aka Zip Code), is changed,           
1. Change the Account Owner to the sales representative assigned to the new zip code          
2. Change the Owner field of all the Account’s Contacts to the same sales rep           
3. Change the Owner field of all the Account’s Open Opportunities to the same sales rep    
Hi forum,

I need you help, I have a trigger when  I run it send the following message error:
"System.LimitException: Too many SOQL queries: 101"
this is the code:

It is necessary that the product codes that are in the SAF266ORDOOpenOrders _ C object  that in the Product2 object in SAPDELETED _ c = ' 0 ' field, in the Product object must pass SAPDELETED _ c = ' 1 '



trigger SAF266ORDOOpenOrders_tgr on SAF266ORDOOpenOrders__c (after insert, after update) {

 if (Trigger.isAfter){

 for (SAF266ORDOOpenOrders__c a : Trigger.New)
         {
             List<Product2> GetProdInactive = [SELECT id, CODESKU__c, SAPDELETED__c  FROM Product2 WHERE CODESKU__c =  :a.PRODCODEO__c and SAPDELETED__c  = '0' ];
             
             for(Product2 prodActive : GetProdInactive)
                {
                  prodActive.SAPDELETED__c = '1';
                }
                update GetProdInactive;    
              
         }

]


Please help to check and modify it. Thanks in advance.

Regards.
I have a custom lightning component that includes a table of contact records showing columns with various fields. I am able to click the contact link and it will take me to the record page. However when I try to right click and open the link in a new tab in chrome, it opens a blank tab with the title 'about:blank#blocked'. Is there a way to get around this?
I've tried work flow rules, process builder and apex triggers and keep running into a wall. Does anyone have a best practice for this? I simply need th Opportunity Record ID Number populated into my custom Job Number field in the Task in Lightning (shows up in Classic but lightning for some reason??)

Apex trigger or formula suggestions would be greatly appreciated.

Thanks!
Hi I want to perform this scenario Multiple sales representatives can be assigned to the same zip code territory. If this is the case, use a random function to select one of the assigned sales representatives  Object is Territory__c
Inside this object : 
Records  
Zip CodeSales Representative
91000Blake
91001Blake
91002Blake
91002Jacqueline
91010Jacqueline
91020Jacqueline
92010Denise
92020Aaron
           Can anyone please help me out??
Hello, 
I am troubleshooting a Trigger.isBefore where there is a List that pulls back almost 10,000 records. This is being triggered from a VF page and when they pick multiple appointments in an execution, it can hit the 50,000+ SOQL rows returned error. I wanted to replace the Trigger.New with Trigger.NewMap but since this is an isBefore trigger, the IDs won't be there so it won't work (if I'm understanding that correctly). Any other recommendations on how I can rewrite to pull back less records or to only run the query once? SOQL Query that is causing the issue is bolded below. 

trigger StudioSlotTriggerAll on Studio_Slot__c (before insert, before update) 
{
    if(Trigger.isBefore)
    {
        if(Trigger.isInsert || Trigger.isUpdate){
            Datetime startDate = Datetime.now();
            Datetime endDate = Datetime.now();
            Set<Id> studioIds = new Set<Id>();
            {
                for(Studio_Slot__c studioSlot : Trigger.new)
                {
                    
                    if(studioSlot.Start_Time__c >= studioSlot.End_Time__c)
                    {
                        studioSlot.addError('Start Date must be before End Date!');
                    }
                    else
                    {
                        if(studioSlot.Start_Time__c > startDate) 
                        {
                            startDate = studioSlot.Start_Time__c;
                        }
                        
                        if(studioSlot.End_Time__c > endDate)
                        {
                            endDate = studioSlot.End_Time__c;
                        }
                    }
                    
                    studioIds.add(studioSlot.Studio__c);
                }
            }
            
            List<Studio_Slot__c> existingStudioSlotList =
                [SELECT Start_Time__c, End_Time__c, Id, Studio__c
                 FROM Studio_Slot__c
                 WHERE Start_Time__c >= :startDate
                 AND End_Time__c <= :endDate
                 ORDER BY Start_Time__c 
                 Limit 10000 
                ];
 
            for(Studio_Slot__c studioSlot : Trigger.new)
            {
                for(Studio_Slot__c existingStudioSlot : existingStudioSlotList)
                {
                    //overlapping studio slots
                    if(studioSlot.Id != existingStudioSlot.Id && studioSlot.Studio__c == existingStudioSlot.Studio__c && (existingStudioSlot.Start_Time__c < studioSlot.End_Time__c && existingStudioSlot.End_Time__c > studioSlot.Start_Time__c))
                    {
                        studioSlot.addError('Studio Slot is overlapping with the existing studio slot(Id): ' + existingStudioSlot.Id);
                    }
                }
            }