• Narayana Reddy 30
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 4
    Replies
Hi,
I have a requirement to check whether specific cookie is present or not and if cookie is not present, based on URL parameters, create the cookie and set the cookie . Cookie value need to be passed to common utility class --> method to store the cookie data in Salesforce object . Trying with below code . Kindly check and let me know if any suggestions . After reading the cookie value, is there any need to pass the data in hidden parameters to forms ?  (OR) Since cookie is already there in browser session, read the cookie value in main controller and pass the value to common utility class --> method ?

Cookie anaCookie = ApexPages.currentPage().getCookies().get('anaCookie '); 



ana_param1 = apexpages.currentpage().getparameters().get('ana_param1');
        ana_param2 = apexpages.currentpage().getparameters().get('ana_param2');
        ana_param3 = apexpages.currentpage().getparameters().get('ana_param3');

if (anaCookie == null && (ana_param1  != null || ana_param2  != null || ana_param3  != null )) {

 String anaCookieValue  = 'ana_param1='+ana_param1+'&'+'ana_param2='+ana_param2+'&'+'ana_param3='+ana_param3
                      anaCookie = new Cookie('anaCookie ',anaCookieValue,'.salesforce-sites.com',-1,true);
            ApexPages.currentPage().setCookies(new System.Cookie[]{anaCookie});
} else if (anaCookie != null) {
            anaCookieValue = anaCookie.getValue();
            List<string> anadataLiStr = anaCookieValue.split('&');
            for (string anadatast: anadataLiStr ){
              if (anadatast.contains('ana_param1'))
                  ana_param1= anadatast.substringAfter('=');
              else if (anadatast.contains('ana_param2'))
                  ana_param2 = anadatast.substringAfter('=');
              else if (anadatast.contains('ana_param3'))
                  ana_param3 = anadatast.substringAfter('=');
               }
    utilityclass.recordUpdate(anaCookieValue);
}

Utility class
=======
public utilityclass {

recordUpdate(Sting anaCookieValue) {
// Parse the cookie value as 3 parameters
// Assign three values to three parameters in object record
// Update the record
}
 

}



 
can you please let me know whether it is possible to write test class to validate Layout ? For example in task creation layout if the position of button is changed, is it possible for apex test class to detect the change and test class or method fails ?
Wanted to ensure layout changes are detected, so test method fails during validation and developer notices and fix the layout .
Is there any way to bypass lookup filter validation for specific user ?
Hi,
I have a scheduler class which reads list of objects (object1, object2, object3) and invokes batch class for each object.
Batchclass bc = new Batchclass(object1)
batchJobId= database.executeBatch(bc,1000);

I would like to delay the batch job execution if object is 'Contact' . CAn you please share how it needs to be done ?
Trying to simplify multifle if-else conditions . Below code is throwing error " Error: Compile Error: Expression cannot be a statement. " . Can you please let me know how to resolve the issue ?

if (hasFailedBatches) { Boolean inDMode = run.Run_Mode__c == 'inDMode' ? true:false; inDMode ? input.put('Status', 'Failed'):input.put('Status', 'Retrival fialed');
}
I have a requirement to split the string based on delimeter, compare the tokens with specific value and if it finds a match, clear that specific value or replace it with other value .
Example 1 : string 'test,krishna,shekhar, karjun' need to be split based on comma (,) and compare each value with word 'shekhar', since match is found clear the word shekhar from original string . So the updated string value will be ''test,krishna,karjun' ( Shekhar is removed including delimeter )
Can you plesae suggest the best way to achieve this rquirement ?
Could you please suggest on how to identify the unused code in the org ? Are there any free managed packages or tools from Salesforce or other vendors ?
Hi, 
Could you please let me know if there is any simple way to bypass triggering emails on record update ?  Also what all do we need to check to see whether email is getting triggered   ( apex code, triggers, workflow rules etc .. )  ?? 

If there is no simple way to bypass triggering email on record update, would like to know what all need to be checked and how to bypass triggering email from WF rules etc ?

Wanted to bypass all emails when standard object Contact or User record is updated 
Could you please let me know the best way to auto populate lookup field based on other field value while inserting the records .

E.g :
1. We have a custom object and it has a lookup field for contact object
2.  While inserting the records in custom object, auto populate contact lookup field value based on email address in the record
Hi,

Salresforce standard "Sharing" button is added to all opportunity page layouts, however we would like to control the visibility of the button based on profiles . Could you please let me know whether there is any profile or permission set permission which controls the "sharing" button visibility . If not how to control the visibility of the button .
Hi,

We would like to have a validation rule on click of Change owner link in record detail page . 
On click of "Change Owner", if the user is not part of two profiles (profile1 and profile2), throw the permission error message . This validation rule should trigger only on click of change login link. Validation rule should not trigger if the owner is getting updated via custom code .  Kindly let us know how to achieve above mentioned functionality 
can you please let me know whether it is possible to write test class to validate Layout ? For example in task creation layout if the position of button is changed, is it possible for apex test class to detect the change and test class or method fails ?
Wanted to ensure layout changes are detected, so test method fails during validation and developer notices and fix the layout .
Hi,
I have a scheduler class which reads list of objects (object1, object2, object3) and invokes batch class for each object.
Batchclass bc = new Batchclass(object1)
batchJobId= database.executeBatch(bc,1000);

I would like to delay the batch job execution if object is 'Contact' . CAn you please share how it needs to be done ?
I have a requirement to split the string based on delimeter, compare the tokens with specific value and if it finds a match, clear that specific value or replace it with other value .
Example 1 : string 'test,krishna,shekhar, karjun' need to be split based on comma (,) and compare each value with word 'shekhar', since match is found clear the word shekhar from original string . So the updated string value will be ''test,krishna,karjun' ( Shekhar is removed including delimeter )
Can you plesae suggest the best way to achieve this rquirement ?