• vaishali sharma
  • NEWBIE
  • 63 Points
  • Member since 2015
  • Salesforce developer
  • Mirketa

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 21
    Replies
I want to deploy an Apex class from sandbox to production.
The apex class has 88% code coverage in sandbox.
Is the code coverage in sandbox different from that in production?
User-added image
Hello,

I have a VF and Apex like below
 
<apex:page standardController="Case" extensions="customClass" action="{!Redirect}" >

</apex:page>


public with sharing class customClass{

    public PageReference Redirect(){
        String usrProfileName = [SELECT Profile.Name FROM User WHERE Id = :Userinfo.getUserId()].Profile.Name;
        String hostname = ApexPages.currentPage().getHeaders().get('Host'); 
        if(String.isNotBlank(usrProfileName))
        {
            if(usrProfileName.equals('XYZ') || usrProfileName.equals('PQR)){
                return null; //Continue the normal execution of VF page
            }else{ //PROBLEM: Explantion below
                pagereference pageref = new pagereference('https://'+hostname+'/'+'setup/ui/recordtypeselect.jsp?ent=Case&retURL=%2F500%2Fo&save_new_url=%2F500%2Fe%3FretURL%3D%252F500%252Fo');
                pageref.setredirect(true);
                return pageref;                
            }
        }       
        return null;
    }


}

When the code enters the second loop:
My required use case is:
1) normal creation of case should proceed
2) VF page is not required at all

Problem now:
1)the record selection page is displayed but, when "continue" is clicked, it always redirects the user to the same link, hence a contunour loop..
i want to let the user carry on normally creation of case, not any way linked ot VF page ?

thanks for suggestion !
Hi ,
 i am working on a trigger . where i need to map lead object with another objct field condition is they both dont have any kind of relation with each oher. please tell me the way to come out of this problem. my code is:
.......................................................code........................................................................................................................
for(Lead ld : trigger.new)
     {
    /* leadcriteria is the list which holds all the fetched record from CriteriaFields__r .
        for(Teams__c  teamtest : leadcriteria){
            integer i=0;
            for(CriteriaField__c criteria :teamtest.CriteriaFields__r ){
                i = i + 1 ;
               
 /*************** if(ld.criteria.Field_Api_Name__c == criteria.Field_Value__c){ ********************************/
                      if(i == teamtest.CriteriaFields__r.size())
                     {
                                
                     
                     }
                   }
                   else
                   {
                   
                      break;
                   }
              
            }
The line of code that i have commented i want to achieve something like this (ld.criteria.Field_Api_Name__c where ld is lead object. but both of these field dont have any relationship with each other.
hi , i want to call excute method inside finish method of batch class . How can i achieve this . When i try to do this it throws error 
/* Error: Compile Error: expecting a right parentheses, found 'BC' at line 100 column 58 */

     
    Global void finish(Database.BatchableContext BC){
      system.debug('finish method has beenn executed');
      if (flag == false)
         {
           BatchDuplicateRecord  batchDupreco = new BatchDuplicateRecord();
           batchDupreco.execute(Database.BatchableContext BC,List<sObject> scope);
            Database.executeBatch(batchDupreco,1000);
         }
       else
       {
          system.debug('your batch has succesfully executed');
       }
     }
    
How to ad knowledge bar component in macro instruction .
I need to add Knowledge bar component while adding macro instruction . please give solution for that
Hi :

We have got a requirement to send SMS and email using Process Builder. Email can easily be achieved by using email template/email alert.
Wondering what's the best way to do that for SMS?

We have got a subscription for Twilio. However as per other posts, it involves writing Apex code to send SMS using Twilio from Salesforce. That is probably possible when you have an interactive form to choose an user and sens SMS. However not sure if that's gonna work from Process Builder. 

Any help will be much appreciated.

Regards,
Anindya
I want to deploy an Apex class from sandbox to production.
The apex class has 88% code coverage in sandbox.
Is the code coverage in sandbox different from that in production?
User-added image
Hello,

I have a Trailhead account created using my gmail login
I have a Developer Edition account which was created with another email ID

I now find that I am unable to use the Trailhead playground when I want to install the data.com clean assessment app for the Data Quality module.

Is there a way to install the data.com assessment app on my Trailhead playground so that I can use the customer information that has already been built into it?

Thanks,

Karthik
Hi All,

Could you please share the trigger code which is used to update the address of contact? 
Hi all,

lets say it's Monday (I have solved this by using particular "Monday" date using datetime field) 10:00 am and I need to check whether this time falls into opening hours which does in below case.
Any suggestion of how to do that? Get actual time and somehow compare whether this falls in between opening and closing hours?
Can this be done by a single SOQL query? 

Opening Hours: 2017-01-02T07:30:00.000+0000
Closing Hours: 2017-01-02T19:30:00.000+0000

Appreciate your help on this.
Milan

 
Hello,

I have a VF and Apex like below
 
<apex:page standardController="Case" extensions="customClass" action="{!Redirect}" >

</apex:page>


public with sharing class customClass{

    public PageReference Redirect(){
        String usrProfileName = [SELECT Profile.Name FROM User WHERE Id = :Userinfo.getUserId()].Profile.Name;
        String hostname = ApexPages.currentPage().getHeaders().get('Host'); 
        if(String.isNotBlank(usrProfileName))
        {
            if(usrProfileName.equals('XYZ') || usrProfileName.equals('PQR)){
                return null; //Continue the normal execution of VF page
            }else{ //PROBLEM: Explantion below
                pagereference pageref = new pagereference('https://'+hostname+'/'+'setup/ui/recordtypeselect.jsp?ent=Case&retURL=%2F500%2Fo&save_new_url=%2F500%2Fe%3FretURL%3D%252F500%252Fo');
                pageref.setredirect(true);
                return pageref;                
            }
        }       
        return null;
    }


}

When the code enters the second loop:
My required use case is:
1) normal creation of case should proceed
2) VF page is not required at all

Problem now:
1)the record selection page is displayed but, when "continue" is clicked, it always redirects the user to the same link, hence a contunour loop..
i want to let the user carry on normally creation of case, not any way linked ot VF page ?

thanks for suggestion !
Hello
 I would like to make a mass email function based on the email addresses of a custom object email field.
How can i send please help me.
Thanks in advance.
 
Is it possible to use varaible or parameters in SAQL , Wave Analytics ? 
I have setup an approval process for a custom object. When the approval is submitted it goes to a users Manager, VP and then the COO for approval. It appears that anyone can create the record but whoever actually hits the Submit for Approval button determines the Manager and VP it goes to. I was wondering if it is possible to be based on a User lookup field ("Requestor") on the custom object instead of who is clicking on the Submit for Approval button. This way we can allow someone to submit the approval on behalf of the "Requestor", for example an exec admin. 
 
hi , i want to call excute method inside finish method of batch class . How can i achieve this . When i try to do this it throws error 
/* Error: Compile Error: expecting a right parentheses, found 'BC' at line 100 column 58 */

     
    Global void finish(Database.BatchableContext BC){
      system.debug('finish method has beenn executed');
      if (flag == false)
         {
           BatchDuplicateRecord  batchDupreco = new BatchDuplicateRecord();
           batchDupreco.execute(Database.BatchableContext BC,List<sObject> scope);
            Database.executeBatch(batchDupreco,1000);
         }
       else
       {
          system.debug('your batch has succesfully executed');
       }
     }
    
I need to retrieve all the validation rules associated with a given object, using the REST API.

Looking in doc/forums, I've found that I could retrieve validation rules associated with an object using the following query:

https:///services/data/v35.0/tooling/query?q=Select Id,Active,Description,ErrorDisplayField, ErrorMessage From ValidationRule Where EntityDefinitionId = 'xxxxx'

The problem is that I don't have the object'ID needed to filter, I only have its name. Is there any way to filter using the object's name?

Another alternative seems to be getting the object'ID, but it seems that Metadata REST API (i.e. describe) does not return it.

Any help on this is very appreciated.

Mariana
How to ad knowledge bar component in macro instruction .
Hello,

I am trying to play with Macros in service console. I was able to update the settings and get the macro created but having difficulty with the instructions. I am unable to select a context (no drop down options available) to proceed further with the instructions. I must be missing something really silly. Does anyone know what is it?

Thank you!

Hi,

I'm adding validation to apex class in which if a user enters a value above or below a certain figure then a warning message should appear asking the user if they wish to proceed with their selection.

However the warning message doesn't appear when the criteria is met.

The message will appear however when the criteria on the statement above (an error message) is met first. So basically for my warning message to appear, the user would have to meet the critieria of the error message first.
If they don't, then the warning message doesn't and the user can't progress to the next stage.

I tried swapping the code so the warning message was above the error message on the script but then neither message appears when the criteria is met.

See below error message and warning message.
if(offernew.Print_on_Bill__c==false && offernew.Commission_Payable_Term__c=='Monthly'){
            showpageblock4=true;
            Apexpages.addmessage(new ApexPages.Message(ApexPages.severity.FATAL,'You must check Print on Bill if Commission Payable Term is monthly')); 
            return null;
        }
         if(offernew.Commission_Value__c>0.025 || offernew.Commission_Value__c<0.001){
            Apexpages.addmessage(new ApexPages.Message(ApexPages.severity.WARNING,'Do you want to proceed with this commission value?')); 
            return null;
        }     

Does anyone now how to make this warning message appear without having to get the error message first?
Any help is much appreciated.

Thanks.

Any how can we get the count of all validation rules and workflows  in salesforce org.
I tried---
private static MetadataService.MetadataPort createService()
    {
        MetadataService.MetadataPort service = new MetadataService.MetadataPort();
        service.SessionHeader = new MetadataService.SessionHeader_element();
        service.SessionHeader.sessionId = UserInfo.getSessionId();
        return service;    
    }
MetadataService.MetadataPort service = createService();
        List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();     
        MetadataService.ListMetadataQuery queryWorkflow = new MetadataService.ListMetadataQuery();
        queryWorkflow.type_x = 'Workflow';
        queriesWorkflow.add(queryWorkflow);

But no luck plz help its urgent

Currently, with the code below, when a user clicks on the OK button, if there is a validation error the page refreshes, if not the record saves successfully and the user is redirected to another page. How can I avoid the page refresh without losing the validation message displaying on the page?.

 

Or, how can I force the user to select an option (this field is a picklist) to be able to click on the OK button, this would avoid having to deal with the validation.

 

VF:

 

<apex:message/>

<apex:inputField id="reasonres" required="true" value="{!case.Reason_Resolved__c}"  />
   
<apex:commandButton action="{!closecase}" value="OK"  />

 

controller:

 

public PageReference closecase() {
        
     caseobj.status='closed';
       
     if( caseobj.Reason_Resolved__c == null ) {
   
    caseobj.Reason_Resolved__c.addError('Please select a close reason');
    
     return null;
      }else{
      
       
     caseController.save();
     
      return Page.MySupport;}
       
     }

 

 

Thanks.