• Sankar Ganesh
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 5
    Replies
I have detail page URL button in which I have to open two URL based on some criteria. I tried using If condition but I am getting servlet keyword in the URL. can anyone suggest me how to remove servlet and open the correct link.
below is the URL format I tried.
{!IF( Campaign.UI_Theme__c  = 'Theme4d', '/lightning/r/Report/00Oi0000006Cp9L/view?fv0={!Campaign.Name}', '/00Oi0000006Cp9L')}

In classic I am getting URL as /servlet/%2F00Oi0000006Cp9L

Can anyone help me to remove Servlet from URL. `
I need to create a custom report tying Contact with Account and Relationship.

Contact - Child of Account
Relationship - Child of Contact
No relationship between Account and Relationship

I tried joined report but I am getting no fields in common error. Can anyone suggest me how we could achieve this.
I am getting last page as  a blank page while using renderas PDF. I used  Style="page-break-inside:avoid;page-break-after:auto ; but still I am getting blank page. Kindly suggest me how to solve this .
 
<head>
       <style type="text/css" media="print">
           @page {
                   margin-top: 5.0cm;
                   margin-left: 1.0cm;
                   margin-bottom: 30px;
                   margin-right: 1.0cm;      
                   
            
                     @top-center {
                                 content: element(header);
                                 }
                     @bottom-left {
                                 content: element(footer);
                                  }
               }
                  div.header {
                              position: running(header);
                             
                             }
                   div.footer{
                              
                                page-break-after:avoid;
                                page-break-inside:avoid;
                                position: running(footer);
                             }          
                     
               
                        #table1{
                          border-collapse: collapse;
                          
                        }
                        #table1 td{
                           border:1px solid black;
                           padding:5px;
                        }
                       
                      
                                    
        </style>
     </head>

I am facing this problem for below code
 
<div class="footer">
   <table width="100%">
    <tr>
       <td align="center">footer content here</td>
    </tr>
   </table>
  </div>
 

 <div>
   <apex:variable var="count" value="{!0}" />
    <table id="table1" width="100%">
       <tr id="hrow1">
            <td align="center" width="27%" ><b>Item</b></td>
            <td align="center" width="40%"><b>Description</b></td>
            <td align="center" width="8%"><b>Qty</b></td>
            <td align="center" width="10%"><b>Cost</b></td>
            <td align="center" width="15%"><b>Total</b></td>
       </tr>
        <apex:repeat value="{!Quote.QuoteLineItems}" var="line" >
          <tr>
            <td><b><apex:outputText value="{!line.Product2.Name}"/></b></td>
            <td><apex:outputText value="{!line.Line_Item_Description__c}" escape="false"/></td>
            <td><apex:outputField value="{!line.Quantity}"/></td>
            <td > <apex:outputText value="{0, number, ###,###,###,##0.00}">  <apex:param value="{!line.UnitPrice}" /> </apex:outputText></td>
            <td> <b>  <apex:outputText value="{0, number, ###,###,###,##0.00}">  <apex:param value="{!line.TotalPrice}" /> </apex:outputText> </b></td>
        </tr>
        <apex:variable var="count" value="{!count+1}"/>
       </apex:repeat>
       <tr style="page-break-inside:avoid;"> 
           <td colspan="6" style="border-top:none;" >&nbsp; </td>
       </tr> 
    </table>
        
     <table width="100%" style="border-collapse: collapse;page-break-inside:avoid;page-break-after:auto;">
          <tr>
             <td colspan="2">{!Quote.Customer_Message__c}</td>
             <td colspan="2" align="right" ><b> Total:</b></td>
             <td align="right"><b><apex:outputField value="{!Quote.TotalPrice}"/></b></td>
       
         </tr> 
     </table>
   
 </div>

 
I am in integration of quickbook with salesforce. I found that client is using desktop version of quickbook. Can anyone tell me how to integrate salesforce with desktop application.
Hi folks,

I have salesforce integrated with xero. I am accessing invoices by following https://api.xero.com/api.xro/2.0/Invoices

I need to filter the modified date of invoice after '2017-10-11'. I found UpdatedDateUTC is used to refer modified date.

I tried following but unable to get the desired results. Anyone know how to get this.

 request.setEndpoint('https://api.xero.com/api.xro/2.0/Invoices?UpdatedDateUTC > =DateTime(2012,11,10,00,00,00)');
 request.setEndpoint('https://api.xero.com/api.xro/2.0/Invoices?UpdatedDateUTC > = 2017-09-11');
Hi,
I am planing to take pd2 certification. I came to know that pd1 is mandatory for pd2. 

I want to know that how to take pd1 certification also do we need to complete any other certification for pd1?

Hi Everyone,

In production I can't use create pdf button as it shows 'there must be an active template to create pdf'. I checked quote templates but there is no template available when I try to create new template it ask for existing one (there is no existing template). Can anybody tell what I am missing here.

I have visual force page if user click proceed then I have to redirect to order object with some pre-populating values of my custom object.
I am not able to pass EffectiveDate as salesforce date format doesn't take this. I have salesforce date format as DD/MM/YYYY so I convert date to this format but still I am getting error for the above code.
I have used sforce.one.createRecord it works for string field but it doesn't work for date field. I can't set default value to date asit is standard field and I tried {!Today} and {!Now} which doesn't work in javascript. Kindly suggest a solution for this.
 
<script>

function GenerateOrder(){

  var d = new Date();               
  var day = d.getDate();           
  var monthIndex = d.getMonth()+1;          
  var year = d.getFullYear();

  var todaydate=day + '/' + monthIndex + '/' + year;

      var defaultValues = { 
                                 'Cart_No__c' : '{!Crt.Id}',
                                 'AccountId' : '{!Crt.Account__c}',
                                 'EffectiveDate' : todaydate
                           };

      sforce.one.createRecord("Order", null, defaultValues);
  }
</script>

 
When I pass a String to XML I have £ Symbol.Suppose if the string is 'test£' then it gives the exception as invalid String as we have £ in String. Is that possible to replace this £ symbol. I tried  
&pound; and &#163;

but both not working. 

Is there any other way to solve this?
I have give here some important code where I struck to make coverage.I struck in SaveAssest()  if condition under for loop. In getparts() partslist serial number is set as null but in visual force page we change that dynamically by calling that function and by changing its field but I can't able to do in test class.
If I call getparts() from test class partslist 2nd parameter is set as null so I can't able to cover that if condition in SaveAssest() which checks for not blank.How to resolve this.
Controller:
public class SitePartsUpdate{
  public List<SiteParts> getParts(){
        if(flag){
        PartsList=new List<SiteParts>();
        for(SalesOrderLineItems__c OLI:SalesOLI){
            for(integer i=0;i<OLI.Quantity__c;i++){
                PartsList.add(new SiteParts(OLI.Product__r.Name,''));
            }
        }
        }
        
         system.debug('!!!!!!!!!!!!!!'+PartsList); 
        
        return PartsList;
    }




 public pagereference SaveAssest(){
        urlFlag= false;
        system.debug('====================================='+PartsList);
        SitePartsUpdate();
        flag=false;
        UpdateSN=new List<Inventory_Transaction__c>();
        RepeatSN=new Set<String>();
              
              for(SiteParts SNum :PartsList){
              
           
              
              if(!String.isBlank(SNum.serial)){
              system.debug('&&&&&&&&&&&&'+SNum.serial+'@@@@@@@@@@@@@');
              if(SN.containsKey(SNum.serial)){
              system.debug('>>>>>>>>>'+SN.get(SNum.serial).Product__c+'>>>>>>>>>'+SNum.productName+'>>>>>>>>>'+SN.get(SNum.serial).Name+'>>>>>>>>>'+SNum.serial);
              if(SN.get(SNum.serial).Product__c==SNum.productName && SN.get(SNum.serial).Name==SNum.serial){
              system.debug('~~~~~~~~~~~~~~~~'+SNum.serial+'@@@@@@@@@@@@@');
              if(!RepeatSN.contains(SNum.serial)){
              system.debug('@@@@@@@@'+SNum.serial+'@@@@@@@@@@@@@');
              RepeatSN.add(SNum.serial);
              SN.get(SNum.serial).Transaction_Type__c='Delivered';
              SN.get(SNum.serial).SalesOrder__c=SalesId;
              if(SNum.selected){
                  
                  UpdateSN.add(SN.get(SNum.serial));
              } else {
                  system.debug('SN ======'+SN.get(SNum.serial));
                  unSelectedSN.add(SN.get(SNum.serial));
              }
              system.debug('$$$$$$$$$'+SNum.serial+'@@@@@@@@@@@@@');
              }else{ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Serial Number must be unique'));
                    return null;
                  }
              }else{ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Wrong Serial Number'));
                    return null;
                  }
              }
              else{ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Wrong Serial Number'));
                    return null;
                  }
              }else{ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Serial Number is mandatory'));
                    return null;
                  }
              
              
            }
           }
    
   
    public class SiteParts{
        
        public String productName{get; set;}
        public String serial{get;set;}
        public Boolean selected{get;set;}
        
        public SiteParts(String Name, String SN){
          productName=Name;
          serial=SN;
        }
    }
}

Visualforce page:
<apex:page controller="SitePartsUpdate" action="{!SitePartsUpdate}">
<apex:form>
<apex:pageBlock>

<apex:pageBlock id="MPbid">
<apex:pageblockButtons >
<apex:commandButton value="Save" action="{!SaveAssest}" reRender="MPbid" />
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageblockButtons>

<apex:pageBlockTable value="{!Parts}" var="prt" id="Pbid">
<apex:column headerValue="Log Asset">
<!--<apex:facet name="header">
<apex:inputCheckbox id="chkbox"/>
</apex:facet>-->
<apex:inputCheckbox value="{!prt.selected}" />
</apex:column>



<apex:column headerValue="Product Name">
<apex:outputText >{!prt.productName}</apex:outputText>
</apex:column>

<apex:column headerValue="Serial Number">
<apex:inputtext value="{!prt.serial}"  styleClass="jq_req" />
</apex:column>

</apex:pageBlockTable>

</apex:pageBlock>

</apex:form>

</apex:page>

Test class:
@isTest(seeAlldata=true)
public class SitePartsUpdateTest{
    static testMethod void SitePartsUpdateMethod(){
Apexpages.currentpage().getparameters().put('id',String.valueof(Sales.Id));
    
   
     SitePartsUpdate Spu=new SitePartsUpdate();
     Spu.SitePartsUpdate();
     
      List<SitePartsUpdate.SiteParts> PartsList=new List<SitePartsUpdate.SiteParts>();
   SitePartsUpdate.SiteParts sp=new SitePartsUpdate.SiteParts('Test','123');
    PartsList.add(sp);
   
   Spu.getParts(); 
   
   
    Spu.SaveAssest();
    Spu.Cancel();
}
}

 
I installed the package for export to excel of red kite and I followed the steps for installation as mentioned in this link http://www.redkitetechnologies.com/apps/export-to-excel/ 
Its not working when we export all records.If I select a particular record to export then I have upto 20 or 50 records varies to each object but can't select more to export.
I have created the below visualforce page for export to excel button
<apex:page standardController="Account" recordSetVar="recordSet" extensions="RKExportToExcel.ExportToExcelController" readOnly="true" sidebar="false" showHeader="false">

	<c:ExportToExcelComponent exportController="{!exportController}" />

</apex:page>

All the other controller and component are package. Can any one face this issue before or how to export the records to excel in list view.
I am not able to get the expected ouput using Ischanged function.Here is my formula
AND(ISCHANGED( Copy_Email_for_Sheet__c ) , RecordTypeName__c = 'Fire Suppression Service Sheet')
This works fine when we edit using Edit button but not on detail page.I mean if edit on detail page using double click, any solutions for this where I am making mistake.
I give the crieria as created, and every time it's edited and if I give the the criteria as created, and any time it's edited to subsequently meet criteria then it gives the same result
List has no rows for assignment
Everything works fine when I have values but if I have no values then this error occur while searching I came to know that I have to change object to list.If I change then this error occur 
Unknown property 'VisualforceArrayList.name' 
I give some part of my code
Visual force component:
// Visual force component

<apex:component controller="LongProjectOrderController" access="global" rendered="true">
  <apex:attribute description="lpo" name="lpo"  type="SalesOrder__c"/>
<table align="right">
<tr>
<td><b>Order No:</b></td>
<td>{!lpo.Name}</td>
</tr>
                           
<tr>
<td><b>Raised By:</b></td>
<td>{!lpo.CreatedBy.Name}</td>
</tr>
</table>

  <table>
 <tr>
<td><b>Summary of agreed Payment Schedule:</b></td>
<td><apex:outputText rendered="{!(ChildRecords.Room1_Payment_Include_In_Print__c == true)}" value="{!ChildRecords.PAYMENT_SCHEDULE_Room1__c}" /></td>
<td><apex:outputText rendered="{!(ChildRecords.Room2_Payment_Include_In_Print__c == true)}" value="{!ChildRecords.PAYMENT_SCHEDULE_Room2__c}" /></td>
</tr>
</table>

</apex:component>

controller
public with sharing class LongProjectOrderController {
public String MasterRecordId        {get; set;}
  
    public Project__c ChildRecords{get; set;}
   
    public LongProjectOrderController()
    {
     MasterRecordId =ApexPages.currentPage().getParameters().get('id');
   
      if(!String.isBlank(MasterRecordId)){
           
            
                 ChildRecords =
                [
                    SELECT Name,CreatedBy.Name,Room1_Payment_Include_In_Print__c,Room2_Payment_Include_In_Print__c
                       
                    FROM
                        Project__c
                    WHERE 
                        Long_Project_Order__c = :MasterRecordId
                ];
   
    }
}
}


 
Here I send email to email address given in field.when I give different mail id in each field its working but If I send give same email address on every field the attachment is send one time instead of multiple time.Why?
 


 Private void SendEmailAttachment(Map<id,Mechanical_Service_Sheet__c> NewMSSMap,Map<id,Mechanical_Service_Sheet__c> oldMSSMap){
        //Variable Declaration
        List<id> listMSSIds=new List<Id>();    
        String templateName;
        List<String> mailId;
        System.Debug('--------Starting----------');
        
        // list of Mechanical Service Sheet Id
        for(Mechanical_Service_Sheet__c ms:NewMSSMap.values()){
            listMSSIds.add(ms.id);
        }
        
        List<Mechanical_Service_Sheet__c> MSSList=[SELECT id,Name,Copy_Email_for_Sheet__c,Email_Confirmation_to__c,Email_for_HQ_Notification__c,Engineer_s_Email_Address__c,RecordType.Name,Fire_Extinguisher_Service_complete__c
                                                   FROM Mechanical_Service_Sheet__c WHERE ID=:listMSSIds];
        for(Mechanical_Service_Sheet__c ms:MSSList){        
            if(Test.isrunningtest()||(ms.Email_Confirmation_to__c!=NULL && ms.RecordType.Name=='Sprinkler Service Sheet' &&  ms.Fire_Extinguisher_Service_complete__c==true &&
                   ms.Fire_Extinguisher_Service_complete__c!=oldMSSMap.get(ms.id).Fire_Extinguisher_Service_complete__c)){
                mailId = new List<String>();
                templateName='Sprinkler Confirmation';
                mailId.add(ms.Email_Confirmation_to__c);
                System.Debug('--------SSSmailId----------'+mailId);
                EmailAttachment(templateName,listMSSIds,ms,mailId,false);
            }
}
}
Private void EmailAttachment(String templateName,List<id> listMSSIds,Mechanical_Service_Sheet__c Mss,List<String> toAddress, Boolean isOriginal ){
        // get The Email Template Id 
        
        EmailTemplate template = [Select id,name,subject from EmailTemplate 
                                  where name =:templateName];
        
        //Added the below code to prevent the mail to owner
        Contact tempContact  = new Contact();
        tempContact.LastName ='TestLast';
        tempContact.firstName = 'Testname';
        tempContact.email = toAddress[0];
        tempContact.Account = [select id, name from Account limit 1];
        Insert tempContact;

        //get The List Of Attachments In Mechanical Service Sheet
        List<Attachment> attachmentList=new List<Attachment>();
        if(Mss.RecordType.Name=='Sprinkler Service Sheet' || Mss.RecordType.Name=='Riser Service Sheet'|| Mss.RecordType.Name=='Suppression System And Room Integrity Test'|| Mss.RecordType.Name=='Hydrant Service Sheet'|| Mss.RecordType.Name=='Fire Suppression Service Sheet'){
            attachmentList=[select name,body from Attachment Where ParentId IN:listMSSIds];
              }
        efaList = new List<Messaging.Emailfileattachment>();
        email = new Messaging.SingleEmailMessage();
        if(Mss.Email_for_HQ_Notification__c!=Null){
        String[] toAddresses=new String[]{Mss.Email_for_HQ_Notification__c};
        email.setToAddresses(toAddresses);
        
        }
        
        if(Mss.Copy_Email_for_Sheet__c!=Null){
        String[] toAddresses=new String[]{Mss.Copy_Email_for_Sheet__c};
        email.setToAddresses(toAddresses);
        
        }
       
        if(Mss.Engineer_s_Email_Address__c!=Null){
        String[] bccAddresses=new String[]{Mss.Engineer_s_Email_Address__c};
        email.setBccAddresses(bccAddresses);
        }
       
        email.setTemplateId(template.id);
        email.setTargetObjectId(tempContact.id);
        email.setWhatId(Mss.Id);
        email.setSaveAsActivity(false);
        System.Debug('--------attachmentList----------'+attachmentList);
        for(Attachment a:attachmentList){
            efa= new  Messaging.Emailfileattachment(); 
            efa.setFileName(a.name);
            efa.setBody(a.body);
            efaList.add(efa);
                                 
        }
        email.setFileAttachments(efaList);
        List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>();
        lstMsgs.add(email);
        if(!Test.isRunningTest()){
        Messaging.sendEmail(lstMsgs);
        }
        
        //Delete the temp contact.
        delete tempContact;
        System.Debug('--------Ending----------'+lstMsgs); 
                                                                 
    }      
I created custom reports in which I give opportunity as primary and activity as secondary but while running report I am not able to display opportunity with no open activity.what condition should I give there
Hai, I have two object named Employee and visit, here Employee is a lookup. In Employee I have one field called job time and in Visit the field name is last visit(both fields are in number type). I need to poulate the value of job time in last visit.how should I do that someone tells me use formula type with same name and return type as number.I do the same using formula type but I can't get the result I wanted.What should I do?
My requirement is whenever the active checkbox(default checked) is unchecked then user must enter resign otherwise error should show to user.Below is my code for this requirement but it doesn`t work and I didn't get any error in validation.
       AND(ISCHANGED( Active__c ), ISBLANK( Resign_Date__c ) )
Since I am a I have some struggle.
I have to get two numbers and my  labels  for that is value1 and value2.I have another button called submit when I press that I should get sum.
How should I get a sum here.
My Apex code of two numbers

public class Sample{
public Integer userinput{ get;set;}
public Integer userinput1{ get;set;}
public Integer sum(){
Integer c=userinput+userinput1;
return c;
}
public pageReference getsum()
{
  sum(); 

  return null; 

}    

}

My visualforce page

<apex:page controller="Sample" >
 <apex:form >
 <apex:pageBlock >

<apex:outputLabel >Value1</apex:outputLabel>
<apex:inputText value="{!userinput}"/> <br/><br/>
<apex:outputLabel >Value2</apex:outputLabel>
<apex:inputText value="{!userinput1}"/>
<apex:commandButton value="submit" action="{!getsum}"/><br/><br/>
<apex:outputLabel >sum</apex:outputLabel>
<apex:outputField value="{}" />

 </apex:pageBlock>
 </apex:form>
</apex:page>
I am getting last page as  a blank page while using renderas PDF. I used  Style="page-break-inside:avoid;page-break-after:auto ; but still I am getting blank page. Kindly suggest me how to solve this .
 
<head>
       <style type="text/css" media="print">
           @page {
                   margin-top: 5.0cm;
                   margin-left: 1.0cm;
                   margin-bottom: 30px;
                   margin-right: 1.0cm;      
                   
            
                     @top-center {
                                 content: element(header);
                                 }
                     @bottom-left {
                                 content: element(footer);
                                  }
               }
                  div.header {
                              position: running(header);
                             
                             }
                   div.footer{
                              
                                page-break-after:avoid;
                                page-break-inside:avoid;
                                position: running(footer);
                             }          
                     
               
                        #table1{
                          border-collapse: collapse;
                          
                        }
                        #table1 td{
                           border:1px solid black;
                           padding:5px;
                        }
                       
                      
                                    
        </style>
     </head>

I am facing this problem for below code
 
<div class="footer">
   <table width="100%">
    <tr>
       <td align="center">footer content here</td>
    </tr>
   </table>
  </div>
 

 <div>
   <apex:variable var="count" value="{!0}" />
    <table id="table1" width="100%">
       <tr id="hrow1">
            <td align="center" width="27%" ><b>Item</b></td>
            <td align="center" width="40%"><b>Description</b></td>
            <td align="center" width="8%"><b>Qty</b></td>
            <td align="center" width="10%"><b>Cost</b></td>
            <td align="center" width="15%"><b>Total</b></td>
       </tr>
        <apex:repeat value="{!Quote.QuoteLineItems}" var="line" >
          <tr>
            <td><b><apex:outputText value="{!line.Product2.Name}"/></b></td>
            <td><apex:outputText value="{!line.Line_Item_Description__c}" escape="false"/></td>
            <td><apex:outputField value="{!line.Quantity}"/></td>
            <td > <apex:outputText value="{0, number, ###,###,###,##0.00}">  <apex:param value="{!line.UnitPrice}" /> </apex:outputText></td>
            <td> <b>  <apex:outputText value="{0, number, ###,###,###,##0.00}">  <apex:param value="{!line.TotalPrice}" /> </apex:outputText> </b></td>
        </tr>
        <apex:variable var="count" value="{!count+1}"/>
       </apex:repeat>
       <tr style="page-break-inside:avoid;"> 
           <td colspan="6" style="border-top:none;" >&nbsp; </td>
       </tr> 
    </table>
        
     <table width="100%" style="border-collapse: collapse;page-break-inside:avoid;page-break-after:auto;">
          <tr>
             <td colspan="2">{!Quote.Customer_Message__c}</td>
             <td colspan="2" align="right" ><b> Total:</b></td>
             <td align="right"><b><apex:outputField value="{!Quote.TotalPrice}"/></b></td>
       
         </tr> 
     </table>
   
 </div>

 
Hi,
I am planing to take pd2 certification. I came to know that pd1 is mandatory for pd2. 

I want to know that how to take pd1 certification also do we need to complete any other certification for pd1?
I have visual force page if user click proceed then I have to redirect to order object with some pre-populating values of my custom object.
I am not able to pass EffectiveDate as salesforce date format doesn't take this. I have salesforce date format as DD/MM/YYYY so I convert date to this format but still I am getting error for the above code.
I have used sforce.one.createRecord it works for string field but it doesn't work for date field. I can't set default value to date asit is standard field and I tried {!Today} and {!Now} which doesn't work in javascript. Kindly suggest a solution for this.
 
<script>

function GenerateOrder(){

  var d = new Date();               
  var day = d.getDate();           
  var monthIndex = d.getMonth()+1;          
  var year = d.getFullYear();

  var todaydate=day + '/' + monthIndex + '/' + year;

      var defaultValues = { 
                                 'Cart_No__c' : '{!Crt.Id}',
                                 'AccountId' : '{!Crt.Account__c}',
                                 'EffectiveDate' : todaydate
                           };

      sforce.one.createRecord("Order", null, defaultValues);
  }
</script>

 
Here I send email to email address given in field.when I give different mail id in each field its working but If I send give same email address on every field the attachment is send one time instead of multiple time.Why?
 


 Private void SendEmailAttachment(Map<id,Mechanical_Service_Sheet__c> NewMSSMap,Map<id,Mechanical_Service_Sheet__c> oldMSSMap){
        //Variable Declaration
        List<id> listMSSIds=new List<Id>();    
        String templateName;
        List<String> mailId;
        System.Debug('--------Starting----------');
        
        // list of Mechanical Service Sheet Id
        for(Mechanical_Service_Sheet__c ms:NewMSSMap.values()){
            listMSSIds.add(ms.id);
        }
        
        List<Mechanical_Service_Sheet__c> MSSList=[SELECT id,Name,Copy_Email_for_Sheet__c,Email_Confirmation_to__c,Email_for_HQ_Notification__c,Engineer_s_Email_Address__c,RecordType.Name,Fire_Extinguisher_Service_complete__c
                                                   FROM Mechanical_Service_Sheet__c WHERE ID=:listMSSIds];
        for(Mechanical_Service_Sheet__c ms:MSSList){        
            if(Test.isrunningtest()||(ms.Email_Confirmation_to__c!=NULL && ms.RecordType.Name=='Sprinkler Service Sheet' &&  ms.Fire_Extinguisher_Service_complete__c==true &&
                   ms.Fire_Extinguisher_Service_complete__c!=oldMSSMap.get(ms.id).Fire_Extinguisher_Service_complete__c)){
                mailId = new List<String>();
                templateName='Sprinkler Confirmation';
                mailId.add(ms.Email_Confirmation_to__c);
                System.Debug('--------SSSmailId----------'+mailId);
                EmailAttachment(templateName,listMSSIds,ms,mailId,false);
            }
}
}
Private void EmailAttachment(String templateName,List<id> listMSSIds,Mechanical_Service_Sheet__c Mss,List<String> toAddress, Boolean isOriginal ){
        // get The Email Template Id 
        
        EmailTemplate template = [Select id,name,subject from EmailTemplate 
                                  where name =:templateName];
        
        //Added the below code to prevent the mail to owner
        Contact tempContact  = new Contact();
        tempContact.LastName ='TestLast';
        tempContact.firstName = 'Testname';
        tempContact.email = toAddress[0];
        tempContact.Account = [select id, name from Account limit 1];
        Insert tempContact;

        //get The List Of Attachments In Mechanical Service Sheet
        List<Attachment> attachmentList=new List<Attachment>();
        if(Mss.RecordType.Name=='Sprinkler Service Sheet' || Mss.RecordType.Name=='Riser Service Sheet'|| Mss.RecordType.Name=='Suppression System And Room Integrity Test'|| Mss.RecordType.Name=='Hydrant Service Sheet'|| Mss.RecordType.Name=='Fire Suppression Service Sheet'){
            attachmentList=[select name,body from Attachment Where ParentId IN:listMSSIds];
              }
        efaList = new List<Messaging.Emailfileattachment>();
        email = new Messaging.SingleEmailMessage();
        if(Mss.Email_for_HQ_Notification__c!=Null){
        String[] toAddresses=new String[]{Mss.Email_for_HQ_Notification__c};
        email.setToAddresses(toAddresses);
        
        }
        
        if(Mss.Copy_Email_for_Sheet__c!=Null){
        String[] toAddresses=new String[]{Mss.Copy_Email_for_Sheet__c};
        email.setToAddresses(toAddresses);
        
        }
       
        if(Mss.Engineer_s_Email_Address__c!=Null){
        String[] bccAddresses=new String[]{Mss.Engineer_s_Email_Address__c};
        email.setBccAddresses(bccAddresses);
        }
       
        email.setTemplateId(template.id);
        email.setTargetObjectId(tempContact.id);
        email.setWhatId(Mss.Id);
        email.setSaveAsActivity(false);
        System.Debug('--------attachmentList----------'+attachmentList);
        for(Attachment a:attachmentList){
            efa= new  Messaging.Emailfileattachment(); 
            efa.setFileName(a.name);
            efa.setBody(a.body);
            efaList.add(efa);
                                 
        }
        email.setFileAttachments(efaList);
        List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>();
        lstMsgs.add(email);
        if(!Test.isRunningTest()){
        Messaging.sendEmail(lstMsgs);
        }
        
        //Delete the temp contact.
        delete tempContact;
        System.Debug('--------Ending----------'+lstMsgs); 
                                                                 
    }      
My requirement is whenever the active checkbox(default checked) is unchecked then user must enter resign otherwise error should show to user.Below is my code for this requirement but it doesn`t work and I didn't get any error in validation.
       AND(ISCHANGED( Active__c ), ISBLANK( Resign_Date__c ) )