• Felix van Hove 9
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
apex:inputField does not seem to work with datePicker and dateTimePicker, if the SF standardStylesheet is not used. A page with the simple code

<apex:page sidebar="false" showHeader="false" standardStylesheets="false" standardController="Contact">
        <apex:form><apex:inputField showDatepicker="true" value="{!contact.birthdate}"/></apex:form>
</apex:page>

produces Javascript error messages as soon as the input field gets the focus in the rendered page:

Uncaught TypeError: Cannot read property 'currentStyle' of null
    at Object.getStyle (main.js:407)
    at Object.setStyle (main.js:406)
    at iframeShim.setStyle (main.js:1350)
    at DatePicker.hide (main.js:658)
    at HTMLDocument.DatePicker.closeHandler (main.js:646)
getStyle @ main.js:407
setStyle @ main.js:406
setStyle @ main.js:1350
DatePicker.hide @ main.js:658
DatePicker.closeHandler @ main.js:646
Navigated to [...]
main.js:18 Uncaught TypeError: Cannot read property 'addEventListener' of null
    at main.js:18
    at new DatePicker (main.js:646)
    at Function.DatePicker.getDatePicker (main.js:659)
    at Function.DatePicker.pickDate (main.js:660)
    at HTMLInputElement.onfocus (Test:7)
[...]

Is this a bug in Salesforce's Javascript? Or what limitations exist in the use of date and date-time pickers? Or have I missed anything?
iam ajay iam having contacts are not associated with accounts iam goal is if contact not having accountname i,e lookup feild in contact so, i need to give accountname i,e SONY which having in existing accounts for all contacts so iam trying but recurssive trigger error iam finding to avoid yhat iam created class with boolean  static variable and accesed in trigger yhat you can found below
 CLASS:
public class avoidrecurssive 
{
public static boolean firstrun=true;
     
}

TRIGGER:
trigger childtoparent on Contact (before update) 
{
    if(trigger.isbefore)
    {
        if(trigger.isupdate)
        {
   
list<schema.contact>  c =  new list<schema.contact>();
account a = [select id,name from account where name ='sony'];
c=[select id,name,accountid from contact where accountid = null ];
   
for(schema.contact cn:c)
{  
    if(avoidrecurssive.firstrun)
      {   
    avoidrecurssive.firstrun=false;
      cn.Accountid = a.id;
        update cn;
     
    }
}
  
      }
    }
}

SCRRENSHOT OF ERROR:
while updating existing contacts
User-added image
Hi,

I have an execute method which isnot covering in my test class , let me know how to cover it

I am having 3 method under execute method which i am calling seperately


MY BATCH CLASS EXECUTE METHOD

  // The execute method will call three methods
    global void execute(Database.BatchableContext bc, List<Contract__c> scope) {
        ContractfieldsupdateonAccount(scope);
        contractcommencementdate(scope);
        contractexpirydate(scope);

    }

MY TEST CLASS :

 Test.startTest();
                list<Contract__c> Cons = new list<Contract__c>();
     
                 Set<id> contractId = new Set<id>();
                 for(Contract__c c :Cons )
                 {
                    contractId.add(c.id);
                 }
            ContractBatchTriggerHandler batchObj = new ContractBatchTriggerHandler(contractId);
              List<contract__c> co=[SELECT Status__c, Account__c FROM Contract__c WHERE Status__c = 'Signed by Customer'];
              
              ContractBatchTriggerHandler.contractcommencementdate(co);
              ContractBatchTriggerHandler.contractexpirydate(co);
              ContractBatchTriggerHandler.ContractfieldsupdateonAccount(co);
              
                  
            Database.executeBatch(batchObj,2);
            Test.stopTest();

Kindly help me how to fix this issue

Thanks
apex:inputField does not seem to work with datePicker and dateTimePicker, if the SF standardStylesheet is not used. A page with the simple code

<apex:page sidebar="false" showHeader="false" standardStylesheets="false" standardController="Contact">
        <apex:form><apex:inputField showDatepicker="true" value="{!contact.birthdate}"/></apex:form>
</apex:page>

produces Javascript error messages as soon as the input field gets the focus in the rendered page:

Uncaught TypeError: Cannot read property 'currentStyle' of null
    at Object.getStyle (main.js:407)
    at Object.setStyle (main.js:406)
    at iframeShim.setStyle (main.js:1350)
    at DatePicker.hide (main.js:658)
    at HTMLDocument.DatePicker.closeHandler (main.js:646)
getStyle @ main.js:407
setStyle @ main.js:406
setStyle @ main.js:1350
DatePicker.hide @ main.js:658
DatePicker.closeHandler @ main.js:646
Navigated to [...]
main.js:18 Uncaught TypeError: Cannot read property 'addEventListener' of null
    at main.js:18
    at new DatePicker (main.js:646)
    at Function.DatePicker.getDatePicker (main.js:659)
    at Function.DatePicker.pickDate (main.js:660)
    at HTMLInputElement.onfocus (Test:7)
[...]

Is this a bug in Salesforce's Javascript? Or what limitations exist in the use of date and date-time pickers? Or have I missed anything?
I'm trying to deploy apex code changes to production and I keep getting the same error. "ChatterAnswersAuthProviderRegTest.validateCreateUpdateUser(), Details: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ProfileId]: [ProfileId] Class.ChatterAnswersAuthProviderRegTest.validateCreateUpdateUser: line 31, column 1"

We do not use Chatter Answers nor will we ever. We I try to disable them, I get the following error:
Error: You can't disable Chatter Answers if your records have any references to questions or replies from any application customizations, including: formula fields, triggers, workflow rules, and approval processes. You must remove these references before you can disable Chatter Answers: Workflow Rule: chatter_answers_num_subscriptions_above_limit_wf, Apex Class: ChatterAnswersEscalationTriggerTest, Workflow Rule: chatter_answers_no_best_reply_within_time_limit_wf, Workflow Field Update: X01R31000000Upij

I deactivated the two workflows and still cannot disable it.

I've read through the other threads on this and tried changing the code of ChatterAnswersAuthProviderRegTest to
@isTest
private class ChatterAnswersAuthProviderRegTest {
 static testMethod void validateCreateUpdateUser() {   
 }
}

When I try updating this apex code, I get a code coverage failure message.

What else can be done? We will never use Chatter Answers - is there a way just to eliminate this or set the profileID to some arbitrary value?