• Siim
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 11
    Replies

I have a simple flow as follows:

 

1. Screen 1: Create a contact record Yes or No

2. Decision Yes or No

3. If i choose No, I go to the finish screen right away.

4.  If Yes, I go to screen 2 when i enter the contact name, address etc

5. Then i save my contact record 

6. Go back to step 1 which will ask me if i want to create a contact or not....

 

Q1: Here I have the same issue as mentionned in Here where the Yes is selected by default. Is there a way to bypass it?

 

Q2: I call my flow from a VF tab from the page as follows:

 

<apex:page sidebar="false" tabStyle="Contact" cache="false">
<flow:interview name="Ouverture_du_dossier_Client" finishLocation="{!URLFOR('/home/home.jsp')}"/>
</apex:page>

When I run the flow from the VF page, and the second time I reach step 4, my contact form retains all the previous values i had entered and this is a pain. Please also note that I disabled caching in my browser. Has anyone encountered this data caching issue when revisiting flow screens? 

 

Thanks in advance,

Siim

 

 

 

 

 

  • January 10, 2013
  • Like
  • 0

Hi there,

I'm not able to make my javascript remoting trial work.

My requirement: I want to save coordinate results i get from geocoding to my account.

I want to use CLIENT SIDE google geocoding to display an inline google map but i also want to save the coordinates.I am trying to use Javacript remoting to save the coordinates. Can i call the apex function directly in $(document).ready(function() as shown below?

My page:

<apex:page standardController="Account" extensions="testJS">

<head>
<!--
<apex:includeScript value="{!URLFOR($Resource.BuzzJS, 'buzz_js/jqueryui/js/jquery-1.4.4.min.js')}" />-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 
    //var j$ = jQuery.noConflict(); 
$(document).ready(function() {
  
  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }
  
  var map;
  var marker;
  
  var geocoder = new google.maps.Geocoder();
  var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";
  
  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
      
        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);
      
        //center map
        map.setCenter(results[0].geometry.location);
        
        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });
        
        var latitude = results[0].geometry.location.lat();
        var longitude = results[0].geometry.location.lng();
        alert("Latitude:- "+latitude);
        alert("Longitude:- "+longitude);
        alert("{!account.Name}");
        testing(latitude,longitude,"{!account}");
        
        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });
        
      }
      
    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });
  
  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
    function testing(var lat,var long,var acc) {
        testJS.setLatLong(lat,long,acc,function(result, event) {
        // callback function logic 
        if(event.status && event.result)
            alert("Update successful");
        }, {escape:true})
        
    } 
});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  background:transparent;
}
</style>

</head>
<body>
<div id="map"></div> 
</body>
</apex:page>

 

My controller is as follows:

 

global class testJS {
    public final Account acct;
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public testJS (ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
    public testJS(){}
    @RemoteAction
    global static void setLatLong ( Decimal lat, Decimal lon,Id accId) {
        Account acc = [select id, lat__c,lon__c from Account where id =:accid limit 1 ];
        acc.lat__c = lat;
        acc.lon__c = lon;
        update acc;
    }
}

 

 Am i missing something in implementing the javascript Remoting? Any help would be much appreciated. Many thanks, Siim

  • January 06, 2012
  • Like
  • 0

Hello,

I have the following VF page

<apex:page standardController="Call__c" recordSetVar="call" extensions="CallSetExt" action="{!removeAndRedirect}"></apex:page>

and the controller as follows

public with sharing class CallSetExt {

    private ApexPages.StandardSetController con;
    public CallSetExt(ApexPages.StandardSetController controller) {
        con = controller;
    }
    public PageReference removeAndRedirect()
    {
        delete con.getSelected();
        return new PageReference(ApexPages.currentPage().getParameters().get('retURL'));
    }
    public PageReference callPlanRedirect()
    {
        return (new PageReference('/apex/CallPlanning'));
    }
    public PageReference callReDirect()
    {
        return (new PageReference('/apex/CallPage1'));
    }

}

 

 When I try scanning my code for the security review, I get Cross Site Reference Forgery error for the above page.

Can anyone please help on how should I enforce Cross Site Reference Forgery in the above VF page? I saw the examples salesforce gave but i couldn't apply it to my case.

 

Thanks in advance,

Siim

 

 

  • August 15, 2011
  • Like
  • 0

I have a simple flow as follows:

 

1. Screen 1: Create a contact record Yes or No

2. Decision Yes or No

3. If i choose No, I go to the finish screen right away.

4.  If Yes, I go to screen 2 when i enter the contact name, address etc

5. Then i save my contact record 

6. Go back to step 1 which will ask me if i want to create a contact or not....

 

Q1: Here I have the same issue as mentionned in Here where the Yes is selected by default. Is there a way to bypass it?

 

Q2: I call my flow from a VF tab from the page as follows:

 

<apex:page sidebar="false" tabStyle="Contact" cache="false">
<flow:interview name="Ouverture_du_dossier_Client" finishLocation="{!URLFOR('/home/home.jsp')}"/>
</apex:page>

When I run the flow from the VF page, and the second time I reach step 4, my contact form retains all the previous values i had entered and this is a pain. Please also note that I disabled caching in my browser. Has anyone encountered this data caching issue when revisiting flow screens? 

 

Thanks in advance,

Siim

 

 

 

 

 

  • January 10, 2013
  • Like
  • 0

Hi there,

I'm not able to make my javascript remoting trial work.

My requirement: I want to save coordinate results i get from geocoding to my account.

I want to use CLIENT SIDE google geocoding to display an inline google map but i also want to save the coordinates.I am trying to use Javacript remoting to save the coordinates. Can i call the apex function directly in $(document).ready(function() as shown below?

My page:

<apex:page standardController="Account" extensions="testJS">

<head>
<!--
<apex:includeScript value="{!URLFOR($Resource.BuzzJS, 'buzz_js/jqueryui/js/jquery-1.4.4.min.js')}" />-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 
    //var j$ = jQuery.noConflict(); 
$(document).ready(function() {
  
  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }
  
  var map;
  var marker;
  
  var geocoder = new google.maps.Geocoder();
  var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";
  
  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
      
        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);
      
        //center map
        map.setCenter(results[0].geometry.location);
        
        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });
        
        var latitude = results[0].geometry.location.lat();
        var longitude = results[0].geometry.location.lng();
        alert("Latitude:- "+latitude);
        alert("Longitude:- "+longitude);
        alert("{!account.Name}");
        testing(latitude,longitude,"{!account}");
        
        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });
        
      }
      
    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });
  
  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
    function testing(var lat,var long,var acc) {
        testJS.setLatLong(lat,long,acc,function(result, event) {
        // callback function logic 
        if(event.status && event.result)
            alert("Update successful");
        }, {escape:true})
        
    } 
});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  background:transparent;
}
</style>

</head>
<body>
<div id="map"></div> 
</body>
</apex:page>

 

My controller is as follows:

 

global class testJS {
    public final Account acct;
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public testJS (ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
    public testJS(){}
    @RemoteAction
    global static void setLatLong ( Decimal lat, Decimal lon,Id accId) {
        Account acc = [select id, lat__c,lon__c from Account where id =:accid limit 1 ];
        acc.lat__c = lat;
        acc.lon__c = lon;
        update acc;
    }
}

 

 Am i missing something in implementing the javascript Remoting? Any help would be much appreciated. Many thanks, Siim

  • January 06, 2012
  • Like
  • 0

Hello,

I have the following VF page

<apex:page standardController="Call__c" recordSetVar="call" extensions="CallSetExt" action="{!removeAndRedirect}"></apex:page>

and the controller as follows

public with sharing class CallSetExt {

    private ApexPages.StandardSetController con;
    public CallSetExt(ApexPages.StandardSetController controller) {
        con = controller;
    }
    public PageReference removeAndRedirect()
    {
        delete con.getSelected();
        return new PageReference(ApexPages.currentPage().getParameters().get('retURL'));
    }
    public PageReference callPlanRedirect()
    {
        return (new PageReference('/apex/CallPlanning'));
    }
    public PageReference callReDirect()
    {
        return (new PageReference('/apex/CallPage1'));
    }

}

 

 When I try scanning my code for the security review, I get Cross Site Reference Forgery error for the above page.

Can anyone please help on how should I enforce Cross Site Reference Forgery in the above VF page? I saw the examples salesforce gave but i couldn't apply it to my case.

 

Thanks in advance,

Siim

 

 

  • August 15, 2011
  • Like
  • 0

I'm trying to create a custom OnClick JavaScript button that will update a date field on an Opportunity when clicked with today's date. 

 

Here is the code I'm using:

 

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
 
var newRecords = [];
 
var c = new sforce.SObject("Opportunity");
c.id ="{!Opportunity.Id}";
c.{!Opportunity.Media_Plan_Approved__c} = new Date();
newRecords.push(c);
 
result = sforce.connection.update(newRecords);
 
window.location.reload();

 

 

When I test the button though, I get a message in a pop up window that says:

"A problem with the OnClick JavaScript button or link was encountered:

Expected Identifier"

 

I really don't know Java that well.  Can anyone tell me what I'm doing wrong?

 

Thanks!!

Hi,

I am working on a Flex application integration with Salesforce.

It was working fine until i created a managed package. Now it  gives Page test2__MyExamplePage does not exist message.

I developed the application and created the managed package in my Test Account 1. Managed package namespace is test1.

I installed managed package to my Test Account 2. It also has a namespace named test2.

The problem is in this code:

 

/apex/MyExamplePage?objectId={!Campaign.Id}&returnUrl={!URLFOR( $Action.Campaign.View , Campaign.Id)}

 

And this code is defined in my object's custom button. Content Source is URL.

 

Whenever I click that button from Test Account 2, it tries to find test2.na6.salesforce.com/apex/MyExamplePage?xxxxxxxxxx.

 But it should try to connect to test1 namespace.

 

How can I forward it to the right namespace?

 

Thanks,

Umut