• lodoss1118
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 16
    Replies

hi i am trying create a formula field that calculates that expiry date from a start date and term

 

i got something like

 

startDate + terms * 30.4375

 

but it has some weird results? and does not handle leap years

 

anyone have a better formula :@

Hi i have object in salesforce that contains a city called Unterföhring it contains some weird character now when i do a sql on local db to find this city which it does contain Unterföhring i keep getting a no match.

 

$querySF = "SELECT Id, Name, Building_Name__c, Street__c, Building_Number__c, Postcode__c, City__c, Country__c, Building_Type__c, Building_Status__c, Building_Entry__c, Fibre_Access__c, POP_Type__c, Wayleave_Status__c ";
$querySF .= "FROM Location__c WHERE Active__c = true AND EXT_ID__c = null";

$resLocation = $sforce -> do_query($querySF, 2000);

foreach $location ( @{$resLocation} ) {

    $add = 1;
    $locationId = $location -> {'Id'}['Id'];

#print $locationId." ".$location -> {'Name'}." ".$location -> {'City__c'}."\n";

    # get tt city id
    
    $queryTT = "SELECT * FROM h_city WHERE name = '".$location -> {'City__c'}."'";
    $st = $db -> prepare($queryTT);
    $st -> execute;
    $row = $st -> fetchrow_hashref;
#    print $row -> {'h_city_id'}."\n";
    $cityID = $row -> {'h_city_id'};

    if ($row -> {'h_city_id'} < 1) {
        $add = 0;
    }

 

I am assuming that this is the problem   $queryTT = "SELECT * FROM h_city WHERE name = '".$location -> {'City__c'}."'"; it cannot match the name?

This is not my code and i am not a perl expert?

Hi guys i can't seem to get the hours and minutes to show in a datetime field in SFDC coming from an update from a java client app

 

        SimpleDateFormat timeStamp = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss");
        try {
            runRequest.setValue("Requested_Date__c", timeStamp.parse(timeStamp.format(new Date())));
        } catch (ParseException e) {
            System.out.println("Requested_Date__c Error : " + e.getCause());
        }

 

it updates the date time field but it never shows the hhmmss??

 

public class ParamsController
{
    public String URL = 'https://na132222.salesforce.com/apex/params?na5.visualforce.devmode=1&resourceDate=asads0000jjaa-2010-09-24&mode=summary&resourceDate=as212343243a-2012-10-24&';
    
    public String foundParam{get{return GetParam(URL, 'resourceDate');} set;}
    
    public ParamsController(){
        List<String> params = GetParams(URL, 'resourceDate');
        System.debug('###params ###: ' + params);
    }
    
    public List<String> GetParams(string param){
        List<String> strList = new List<String>();
        String href = URL;
        if(href.indexOf('?') > -1){
            String qryStr = href.substring(href.indexOf('?')).replaceAll('\\?', '').toLowerCase();
            List<String> aQryStr = qryStr.split('&');
            for(Integer i = 0; i < aQryStr.size(); i++){
                String strCur = aQryStr[i].toLowerCase();
                String strMatch = strCur.substring(0, strCur.indexOf('=') + 1);
                if(((param + '=').toLowerCase() == strMatch)){
                    List<String> aParam = aQryStr[i].split('=');
                    strList.add(aParam[1]);
                }
            }
        }
        return strList; 
    }
    
    public List<String> GetParams(string url, string param){
        return GetParams(System.currentPageReference().getUrl(), param);
    }
    
    public String GetParam(string url, string param){
        String str = '';
        String href = URL;
        if(href.indexOf('?') > -1){
            String qryStr = href.substring(href.indexOf('?')).replaceAll('\\?', '').toLowerCase();
            List<String> aQryStr = qryStr.split('&');
            for(Integer i = 0; i < aQryStr.size(); i++){
                String strCur = aQryStr[i].toLowerCase();
                String strMatch = strCur.substring(0, strCur.indexOf('=') + 1);
                System.debug('###aQryStr ###: ' + strMatch);
                if(((param + '=').toLowerCase() == strMatch)){
                    List<String> aParam = aQryStr[i].split('=');
                    str = aParam[1];
                    break;
                }
            }
        }
        return str; 
    }
    
    public String GetParam(string param){
        return GetParam(System.currentPageReference().getUrl(), param);
    }    
}

 

 I keep getting this System.LimitException: Maximum stack depth reached: 193

 

i am wondering if the holiday object can be used to check is the current date is not that of a holiday and how would one go about it?

Hi Friends,

 

I am new to salesforce. My requirement is that we are using our own LDAP authentication. Upon successful authentication it should redirect the user to salesforce free site url but before it hits free site URL I wanted to check in  the header URL to grab the HOST so that I can determine from where the request is coming from and if i found the reqest  is coming from valid HOST then i will let the user to see our free site page otherwise will show him the error page.

 

Note : We want to use salesforce free site.

 

Any suggestions would be really help full.

 

Thanks Guys!

 

I wrote the query:

 

Select count() from Account

 

I have around 20,000 accounts in the system.

So how am I suppouse to get their number in the system?

Thanks!

Hi is there anyway to keep a home page component on the left side if you move to another tab like accounts and contacts i got some javascript which i am assuming if the user is not on the home tab it will not work?

Hi guys i am trying to use the ajax toolkit in a homepage component, the problem is i have to login to get a session is there anyway i can do this without logging in. I have created an html area and added the following code:

 

 

<html>
<head>
	<script src="/soap/ajax/16.0/connection.js" type="text/javascript"></script>
	<script type="text/javascript">
		function ShowUser(){
		    //sforce.connection.login("**************8", "********");
			//sforce.connection.sessionId = '{!$Api.Session_ID}';
		    //var user = sforce.connection.getUserInfo();
			alert(document.cookie);
		}
		window.onload = ShowUser();
	</script>
</head>

<body>
</body>
</html>

 

But if i do not login it won't work?

I keep getting Too many SOQL Queries when I thought I wrote a bulk trigger until I did dataloader on update.. to get the porevious records.. Here is my code:

 

trigger bulktriggerfd on Placement__c (before insert,before update,after insert) { 
//Place the dataset in a Map to what is common in both objects 
//What would be the same through out the objects
Map<Id, Placement__c> PLAC = new Map<Id, Placement__c>();
for (Integer i = 0; i < Trigger.new.size(); i++) {
    if (System.Trigger.isInsert) {
        PLAC.put(Trigger.new[i].Participant__c,Trigger.new[i]); 
    }
    else if(System.Trigger.isUpdate){
        PLAC.put(Trigger.old[i].Participant__c,Trigger.new[i]);  
    }
}
//New List view 
List<Contact> updatedconField = new List<Contact>();
List<Placement__c> updatedplacField = new List<Placement__c>();

if(System.Trigger.isUpdate){
for (Contact c : [SELECT id,AccountId FROM Contact WHERE Id in :PLAC.keySet()]) {
        Placement__c parentAccount = PLAC.get(c.id);
        If(parentAccount.End_Date__c==null){
            c.AccountId = parentAccount.School__c;
            c.Current_Placement__c = parentAccount.Id;
            c.Current_Founder__c = parentAccount.Founder__c;
            c.Current_Program_City__c = parentAccount.Program_City__c;   
            c.Current_Role__c  = parentAccount.Role__c;  
            c.Current_Additional_Role_Info__c = parentAccount.Additional_Role_Info__c;
            c.Current_Weeks_Placed_in_Advance__c = parentAccount.Weeks_Placed_in_Advance__c;
            c.Current_Description__c   = parentAccount.Description__c; 
        }  
        if(parentAccount.End_Date__c!=null){
            List<Placement__c> pl = [Select id from Placement__c Where Id in :PLAC.keySet() and End_Date__c=null];
            if(pl.size()>0){
            c.AccountId = pl[0].School__c;
            c.Current_Placement__c = pl[0].Id;
            c.Current_Founder__c = pl[0].Founder__c;
            c.Current_Program_City__c = pl[0].Program_City__c;   
            c.Current_Role__c  = pl[0].Role__c;  
            c.Current_Additional_Role_Info__c = pl[0].Additional_Role_Info__c;
            c.Current_Weeks_Placed_in_Advance__c = pl[0].Weeks_Placed_in_Advance__c;
            c.Current_Description__c   = pl[0].Description__c; 
            }
            if(pl.size()==0){
            c.Current_Placement__c = null;
            c.Current_Program_City__c = null;   
            c.Current_Role__c  = null;  
            c.Current_Additional_Role_Info__c = null;
            c.Current_Weeks_Placed_in_Advance__c = null;
            c.Current_Description__c   = null;
            }
        }     
        System.Debug('parentAccount -  ' + parentAccount);
        
        updatedconField.add(c);
    }
    } 

if(System.Trigger.isInsert){
for (Contact c : [SELECT id,AccountId,Current_Placement__c FROM Contact WHERE Id in :PLAC.keySet()]) {
        Placement__c parentAccount = PLAC.get(c.id);
        If(parentAccount.End_Date__c==null){
            c.AccountId = parentAccount.School__c;
            c.Current_Placement__c = parentAccount.Id;
            c.Current_Founder__c = parentAccount.Founder__c;
            c.Current_Program_City__c = parentAccount.Program_City__c;   
            c.Current_Role__c  = parentAccount.Role__c;  
            c.Current_Additional_Role_Info__c = parentAccount.Additional_Role_Info__c;
            c.Current_Weeks_Placed_in_Advance__c = parentAccount.Weeks_Placed_in_Advance__c;
            c.Current_Description__c   = parentAccount.Description__c;             
            System.Debug('id = ' + parentAccount.Id);
        }
        System.Debug('parentAccountnew -  ' + parentAccount);
        
        updatedconField.add(c);
}
}    
    
    update updatedconField;
}

 

Thanks

 

Hi what i am trying achieve is to render a visualforce page to show only certain type of inputFields is this even possible. For example i want to determine something like which fields are empty and show only these fields in my custom visualforce page, i wish there was a dynamic visualforce component .