• Vincent Ip 7
  • NEWBIE
  • 35 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
I am creating a map that pinpoints multiple locations (multiple locations in a MSA). The map involves two custom objects: Markets (MSA) and Properties. I have created the Visualforce Page and a related extension (both included below). The output should be split into two sections: the first (left) will be a list of the properties in the MSA, and the second block (right) will be the map itself. The VF Page and the extension compile without issue. When I run the page for an MSA value, the list appears on the left; however, the map does not appear. I must be missing something.

Visualforce Page
<apex:page sidebar="false" showHeader="false" standardController="Market__c" extensions="MSAProperty" >
  <!-- This page must be accessed with an Market Id in the URL. For example: 
       https://cs41.salesforce.com/apex/rrmultipropmap?id=a1255000002hr4G -->
  <apex:pageBlock >
    <apex:pageBlockSection Title="Properties in {!Market__c.Name} MSA"> 
      <apex:pageBlockTable value="{!mprops}" var="mp">
       <apex:column value="{!mp['Name']}"/>
       <apex:column value="{!mp['Address__c']}"/>
       <apex:column value="{!mp['City__c']}"/>
       <apex:column value="{!mp['State__c']}"/>
       <apex:column value="{!mp['Zip__c']}"/>
   <apex:map width="600px" height="400px" mapType="roadmap"
    center="{!mp.Address__c},{!mp.City__c},{!mp.State__c},{mp.Zip__c}">
     <apex:repeat value="{!mprops}" var="mp">
       <apex:mapMarker title="{! mp.Name }"
      position="{!mp.Address__c},{!mp.City__c},{!mp.State__c},{mp.Zip__c}"/>
     </apex:repeat>
   </apex:map>
     </apex:pageBlockTable>
    </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>

Apex Controller Extension
/*Controller class for the Multimktmap visualforce page used inline on Market layouts
to show only active Units related to the Property
*/
public class MSAProperty{
    public MSAProperty() {
    }
   public List<Property__c> mprops {get;set;}
   public MSAProperty(ApexPages.StandardController cont) {
      String ID = cont.getId();
      mprops = [Select Name, Address__c, City__c, State__c, Zip__c 
                  from Property__c 
                  where Market__c = :cont.getId()];
              }
        }
 
I'm currently facing an error with an iframed visualforce page in IE10-11.
 
Currently, we are integrating a Salesforce.com Visualforce page into a separate non salesforce web app.  Salesforce users work in a dual screen environment and will have salesforce open in one screen and this other web app open in the other.  Clickjack protection off for this headerless / sidebarless Visualforce page. 

The other web app has an iframe which contains this a Visualforce page, but this iframe has the “sandbox” attribute on.  The Visualforce page itself uses actionFunctions to communicate with Salesforce servers and rerender to do page ui updates. 
 
When we run this setup using Chrome / Firefox everything works as expected, but when running this in IE10-11, we get the following error.
 
Could not retrieve a valid progID of Class: Microsoft.XMLDOM. (original exception: Error: Automation server can't create object)
 
Any advise on how we can approach this error?  

For security reasons, we need to keep the Sandbox attribute on in the iframe.  Also our security team will not recommend an IE security setting change (The setting name was called "Initialize and script ActiveX controlls not marked as safe for scripting".  It does sound pretty scary). Right now we're thinking that our only option is to re-write the page with Javascript remoting and perform the re-rendering in javascript ourselves.  Wanted to see if anyone else had other thoughts.

Much thanks in advance!
 

 
 
Here's some sample code which exhibit similar errors
 
Non salesforce web app page
<html>
            <iframe sandbox="allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms allow-modals"
                        src="https://c.na35.visual.force.com/apex/IEXmlDomError" />
</html>


 
 
VF page - IEXmlDomError
<apex:page controller="IEXmlDomErrorController" sidebar="false" showHeader="false">
    <apex:form >
        <apex:actionFunction name="actionMethod" action="{!actionMethod}" rerender="rerenderPanel"/>
        <input type="button" value="run action function" onClick="actionMethod();"/>
 
        <apex:outputPanel id="rerenderPanel" layout="block">
            <apex:outputPanel rendered="{!clickOccurred}">
                <div style='border:1px solid red;border-radius:5px'>
                        Hello World!
                </div>
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:form>
</apex:page>


 
Apex Controller
public class IEXmlDomErrorController {
 
    public Boolean clickOccurred {get;set;}
    public IEXmlDomErrorController(){
        clickOccurred = false;
    }
   
    public PageReference actionMethod(){
        clickOccurred=!clickOccurred;
        return null;
    }
   
}



 
From the documentation:
Bulk API Limits
You can submit up to 5,000 batches per rolling 24 hour period. You can't create new batches associated with a job that is more than 24 hours old.

http://resources.docs.salesforce.com/202/19/en-us/sfdc/pdf/salesforce_app_limits_cheatsheet.pdf


Does the above statement mean that for one job I cannot create  more than 5000 batches, or does it mean that I cannot ever create more than 5000 batches in 24 hours, regardless of the number of jobs?   The statement seems to indicate the prior, but wanted to make sure.

So, just to have an example,  if in a day, I were to create 5000 jobs and each job had one batch in it, would i be able to create that 5001st Job and create a single batch for that?  Again, just making sure i'm reading this right.
 
From the documentation:
Bulk API Limits
You can submit up to 5,000 batches per rolling 24 hour period. You can't create new batches associated with a job that is more than 24 hours old.

http://resources.docs.salesforce.com/202/19/en-us/sfdc/pdf/salesforce_app_limits_cheatsheet.pdf


Does the above statement mean that for one job I cannot create  more than 5000 batches, or does it mean that I cannot ever create more than 5000 batches in 24 hours, regardless of the number of jobs?   The statement seems to indicate the prior, but wanted to make sure.

So, just to have an example,  if in a day, I were to create 5000 jobs and each job had one batch in it, would i be able to create that 5001st Job and create a single batch for that?  Again, just making sure i'm reading this right.
 
HI,

Can any one help me out in covering the test code for below batch class, so far i covered 55% but am getting an error.Here am attching my test class even,please check and suggest me how to resolve it.
@istest
public class FieldsValidator_test {
public static String CRON_EXP = '0 0 0 15 3 ? 2022';
  static testMethod void FVtest(){
   
   Test.startTest();
       List< ObjectsExistingFieldsInfo__c> objex = new List<ObjectsExistingFieldsInfo__c>();
       
        ObjectsExistingFieldsInfo__c obj1 = new ObjectsExistingFieldsInfo__c();
        obj1.Object_API_Name__c = 'Account';
        obj1.Fields_Count__c = 1.9666;
        obj1.Fields_Info__c = 'SICCode__c';
        obj1.CurrencyIsoCode = 'AUD';
        objex.add(obj1);
        
        ObjectsExistingFieldsInfo__c obj2 = new ObjectsExistingFieldsInfo__c();
        obj2.Object_API_Name__c = 'Contact';
        obj2.Fields_Count__c = 1.9666;
        obj2.Fields_Info__c = 'SICCode__c';
       obj2.CurrencyIsoCode ='AUD';
        objex.add(obj2);
        
        ObjectsExistingFieldsInfo__c obj3 = new ObjectsExistingFieldsInfo__c();
        obj3.Object_API_Name__c = 'Opportunity';
        obj3.Fields_Count__c = 1.9666;
        obj3.Fields_Info__c = '';
       obj3.CurrencyIsoCode ='AUD';
        objex.add(obj3);
        
        ObjectsExistingFieldsInfo__c obj4 = new ObjectsExistingFieldsInfo__c();
        obj4.Object_API_Name__c = 'Lead';
        obj4.Fields_Count__c = 1.9666;
        obj4.Fields_Info__c = 'SICCode__c';
       obj4.CurrencyIsoCode ='AUD';
        objex.add(obj4);
        
        ObjectsExistingFieldsInfo__c obj5 = new ObjectsExistingFieldsInfo__c();
        obj5.Object_API_Name__c = 'CampaignMember';
        obj5.Fields_Count__c = 1.9666;
        obj5.Fields_Info__c = 'SICCode__c';
        obj5.CurrencyIsoCode ='AUD';
        objex.add(obj5);
        
        ObjectsExistingFieldsInfo__c obj6 = new ObjectsExistingFieldsInfo__c();
        obj6.Object_API_Name__c = 'zqu__Quote__c';
        obj6.Fields_Count__c = 1.9666;
        obj6.Fields_Info__c = 'SICCode__c';
        obj6.CurrencyIsoCode ='AUD';
        objex.add(obj6);

         Insert objex;
         

      FieldsValidator obj = new FieldsValidator ();
      DataBase.executeBatch(obj);
       Test.stopTest();

   }
}


Any help greatly appreciated.

Thanks in Advance
global class FieldsValidator implements Database.Batchable<Sobject> {
    global Database.queryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator('select name, fields_info__c, fields_count__c from ObjectsExistingFieldsInfo__c');
    }
    global void execute(Database.BatchableContext bc, List<SObject> sobjLst) {
        String[] types = new String[]{'Account','Contact'};
        String emailBody = '';
        // Make the describe call
        Schema.DescribeSobjectResult[] results = Schema.describeSObjects(types);
        Map<String,List<Field>> objFieldsDesMap = new Map<String,List<Field>>();
        // For each returned result, get some info
        for(Schema.DescribeSobjectResult res : results) {
            Map<String, Schema.SObjectField> objectFields = res.fields.getMap();
            for(Schema.SObjectField fDes : objectFields.values()) {
                if(fDes.getDescribe().isCustom()) {
                    system.debug(fDes.getDescribe().getName()+'@@@'+fDes.getDescribe().getType());
                    String fieldAPIName = String.valueOf(fDes.getDescribe().getName());
                    String fieldDataType = String.valueOf(fDes.getDescribe().getType());
                    if(objFieldsDesMap.containsKey(res.getName())) {
                        objFieldsDesMap.get(res.getName()).add(new Field(fieldAPIName,fieldDataType));
                    }
                    else {
                        objFieldsDesMap.put(res.getName(),new List<Field>{new Field(fieldAPIName,fieldDataType)});
                    }
                }       
            }
        }
        Map<String, ObjectsExistingFieldsInfo__c> objectInfoMap = new Map<String, ObjectsExistingFieldsInfo__c>();
        for(ObjectsExistingFieldsInfo__c objInfo : [select Field_API_Name__c , Fields_Count__c, Fields_Info__c from 
        ObjectsExistingFieldsInfo__c where Field_API_Name__c in: types]) {
            objectInfoMap.put(objInfo.Field_API_Name__c,objInfo);
        }
        for(String type : types) {
            if(objectInfoMap.get(type).fields_count__c == null) {
                objectInfoMap.get(type).fields_count__c = objFieldsDesMap.get(type).size();
                objectInfoMap.get(type).fields_info__c = JSON.serialize(objFieldsDesMap.get(type));
            }       
            else {
                System.debug('entering to else condition...');
                System.debug('entering to for loop..');
                List<Field> exstingFields = new List<Field>();
                List<Field> newFields = new List<Field>();
                Map<String,Field> bkupexstingFields = new Map<String,Field>();
                Map<String,Field> bkupnewFields = new Map<String,Field>();
                exstingFields = (List<Field>)JSON.deserialize(objectInfoMap.get(type).fields_info__c, List<Field>.class);
                System.debug('exstingFields: '+exstingFields);
                newFields.addAll(objFieldsDesMap.get(type));
                System.debug('objFieldsDesMap: '+objFieldsDesMap);
                System.debug('newFields: '+newFields);
                for(Field f : exstingFields) {
                    bkupexstingFields.put(f.apiName,f);
                }
                for(Field f : newFields) {
                    bkupnewFields.put(f.apiName,f);
                }
                for(Field f : exstingFields) {
                    bkupnewFields.remove(f.apiName);
                }
                for(Field f : newFields) {
                    bkupexstingFields.remove(f.apiName);
                }
                System.debug(bkupnewFields+'@@@'+bkupexstingFields);
                emailBody += type + ' : ';
                //for new fields
                for(Field f :bkupnewFields.values()) {
                    emailBody += f.apiName + ' with datatype '+f.dataType+' is newly created.'; 
                }
                objectInfoMap.get(type).fields_count__c = objFieldsDesMap.get(type).size();
                objectInfoMap.get(type).fields_info__c = JSON.serialize(objFieldsDesMap.get(type));
            }
        }
        /*** Sending Email ***/
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new List<String>{system.label.Dev_Admin});
        mail.setSubject('Fields Update');
        mail.setPlainTextBody(emailBody);
        update objectInfoMap.values();
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
    }
    global void finish(Database.BatchableContext bc) {
    } 
    public class Field {
        String apiName, dataType;
        public Field(String apiName, String dataType) {
            this.apiName = apiName;
            this.dataType = dataType;
        }
    }
}
Hi,

I am trying to duplicate Notes on Opportunity on Lead conversion.
For this i have created a trigger on Note Object : 
It looks like this: 

trigger Note_move_to_oppty on Note (before update) {
    List<Id> noteIds = new List<Id>();
    for (Note note: Trigger.new) {
        system.debug('---note.ParentId='+note.ParentId)  ;
        system.debug('---Trigger.oldMap.get(note.Id).ParentId='+Trigger.oldMap.get(note.Id).ParentId)  ;
        if(note.ParentId != Trigger.oldMap.get(note.Id).ParentId && note.ParentId.getSObjectType() == Contact.getSObjectType())        
            noteIds.add(note.Id);
    }
    if (noteIds.size() > 0) {
        Note_To_Opp_Future.insertNote(noteIds);
    }
}

But this trigger does not fire :(
Any ideas what am I doing wrong?

Thank you in advance
I am creating a map that pinpoints multiple locations (multiple locations in a MSA). The map involves two custom objects: Markets (MSA) and Properties. I have created the Visualforce Page and a related extension (both included below). The output should be split into two sections: the first (left) will be a list of the properties in the MSA, and the second block (right) will be the map itself. The VF Page and the extension compile without issue. When I run the page for an MSA value, the list appears on the left; however, the map does not appear. I must be missing something.

Visualforce Page
<apex:page sidebar="false" showHeader="false" standardController="Market__c" extensions="MSAProperty" >
  <!-- This page must be accessed with an Market Id in the URL. For example: 
       https://cs41.salesforce.com/apex/rrmultipropmap?id=a1255000002hr4G -->
  <apex:pageBlock >
    <apex:pageBlockSection Title="Properties in {!Market__c.Name} MSA"> 
      <apex:pageBlockTable value="{!mprops}" var="mp">
       <apex:column value="{!mp['Name']}"/>
       <apex:column value="{!mp['Address__c']}"/>
       <apex:column value="{!mp['City__c']}"/>
       <apex:column value="{!mp['State__c']}"/>
       <apex:column value="{!mp['Zip__c']}"/>
   <apex:map width="600px" height="400px" mapType="roadmap"
    center="{!mp.Address__c},{!mp.City__c},{!mp.State__c},{mp.Zip__c}">
     <apex:repeat value="{!mprops}" var="mp">
       <apex:mapMarker title="{! mp.Name }"
      position="{!mp.Address__c},{!mp.City__c},{!mp.State__c},{mp.Zip__c}"/>
     </apex:repeat>
   </apex:map>
     </apex:pageBlockTable>
    </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>

Apex Controller Extension
/*Controller class for the Multimktmap visualforce page used inline on Market layouts
to show only active Units related to the Property
*/
public class MSAProperty{
    public MSAProperty() {
    }
   public List<Property__c> mprops {get;set;}
   public MSAProperty(ApexPages.StandardController cont) {
      String ID = cont.getId();
      mprops = [Select Name, Address__c, City__c, State__c, Zip__c 
                  from Property__c 
                  where Market__c = :cont.getId()];
              }
        }
 
Hi,

This is a strange problem that I'm facing. I've a mobile VF page (SPA) using JQueryMobile and whenever I try to scroll up in iOS, it results in blank page. However, also noted that if I wait for sometime (somewhere between 10 secs to 2 mins) I am able to scroll up/down normally without any blank screen. Probably the page needs sometime to load properly in iOS, however, since I've not idea the time it finishes up loading, I cannot resolve this issue. Any help would be welcome.

Note: This page works fine in Android, not issues at all.
Code Sample
Visualforce:
<apex:page docType="html-5.0" applyHtmlTag="false"  controller="TemporaryApexController" showHeader="false" sidebar="false" standardStyleSheets="true" id="MobilePage" readOnly="true">
    <head>
      <title>Test iOS Scrolling Page</title>
          <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=1"></meta>
        <meta name="apple-mobile-web-app-capable" content="yes"></meta>    
      <!-- JQuery Mobile -->
    <apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"/>
      <apex:styleSheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
      <apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.3.1/jquery.mobile-1.3.1.min.js"/>       
    </head>  
    <body>
        <!-- ------------------------ -->
        <!-- -------- Page 1 -------- -->
        <!-- ------------------------ -->
        <div data-role="page" id="page1">

            <!-- header -->
            <div data-role="header"   class="header-large" data-theme="c" id="page2Header">

            <h2>Test Data</h2>
            </div>
            <!-- /header -->    

            <!-- content --> 
            <div data-role="content" style="text-align:center">       
               <div style="overflow:auto;">
               <table data-role="table" data-mode="columntoggle" class="ui-responsive ui-shadow"  id="activeOppTable">
                   <thead>
                        <tr>
                        <th data-priority="1">Account Name</th>
                        </tr>
                   </thead>
                    <tbody>
                        <apex:repeat value="{!accList}" var="accVar">
                            <tr>
                                <td>{!accVar.Name}</td>
                            </tr>
                        </apex:repeat>
                    </tbody>
               </table>    
               </div>
            </div>
            <!-- /content -->

        </div> <!-- /page -->
    </body>
</apex:page>



Apex Controller:
public class TemporaryApexController
{
    public List<Account> accList {get;set;} {accList = new List<Account>();}
    
    public TemporaryApexController(){
        accList = [select Id, Name from Account LIMIT 50];
    }
}



Additional Links:
While sarching for information on this, also found this known issue which reports similiar issue being fixed in Winter'16 Patch 9.4 release. However, evidently, the problem remains:
https://success.salesforce.com/issues_view?id=a1p300000008Y6nAAE

Thanks,
Ayan