• Olbrest
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 14
    Replies
Hello, Sirs.

I have two custom objects: Object1, Object2.
Object 2 is related to Object1 and have lookup field to Object1.

I have overrode standart "New" button for Object2 to my custom visualforce page.

Object1 have folowing id: "a0E80000001TJxF".

In the detal page of Object1 (https://na6.salesforce.com/a0E80000001TJxF) When I clicked 'New' button I getting the following link:

https://c.na6.visual.force.com/apex/allocations?CF00N800000033Hc8=Wine+for+Oleg&CF00N800000033Hc8_lkid=a0E80000001TJxF&scontrolCaching=1&retURL=%2Fa0E80000001TJxF&sfdc.override=1

I should parse the 'a0E80000001TJxF'.

If I had url like 'https://c.na6.visual.force.com/apex/allocations?id=a0E80000001TJxF'. It's would not a problem for me to parse it.

But unfortunate I get field 'CF00N800000033Hc8_lkid' which I can't expecting.

I need a code which should parse this Id or 'CF00N800000033Hc8_lkid' field.
Message Edited by Olbrest on 04-07-2009 07:12 PM

Hello.

I have the salesforce object with ~ 10000 records.

 

I need to select specific range of records.

 

For example records from 5000 to 5500.

 

In MySql I use next query: [ select id from object limit 5000, 500 ]

 

But I can't found the way how I can make it in Apex SOQL.

Thank you.

Message Edited by Olbrest on 03-21-2009 06:38 AM

Hello, Sirs.

 

I have such Email template:

 

Dear {!Contact.FirstName},
Secret code is - {!??????????}

 

I must insert into email message my specific text message ( instead ???????? ).

 

 

 

Apex Code:

//AcID - Contact ID


//Eml - Email Template ID

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setReplyTo('support@force.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setTargetObjectId(AcId);
mail.setTemplateId(EmlId);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Which way I can do it ?


Thank you.

 

Message Edited by Olbrest on 03-04-2009 06:59 PM

Hello.

 

Class getPicanto returns array of equal objects.

 

Like:

xx 1

xx 1 

xx 1 

......

 

Need:

xy 1

xk 0

xw 1

.....

 

Please Help!

 

 

Code:

 

 

global class LaFormica {

public class Ispanola
{
public Wine__c Wine {get; set;}
public Integer Sd {get; set;}
}


public List<Ispanola> getPicanto() {
Wine__c[] Wns = [SELECT Gellato From Wine__c];
Ispanola[] Navs = new Ispanola[Wns.size()];

Integer k = 0;
Integer l = 0;
Ispanola Obj = new Ispanola();

for (Wine__c Wn : Wns){
Obj.Wine = Wn;
Obj.Sd = k;
Navs[l] = Obj;

k++;
l++;
if (k == 2){k = 0;}
}

return Navs;
}

 

 

<apex:page cache="true" showHeader="false" sidebar="false" controller="LaFormica">
<apex:repeat value="{!Picanto}" var="Wine">
Name = {!Wine.Wine.Gellato} <br>
Val = {!Wine.Sd}
</apex:repeat>
</apex:page>

 

 

Message Edited by Olbrest on 02-20-2009 06:19 PM

Hello.

 

How to send value from visualforce page to apex class ?

 

I tried to use this code, but it does not work.

 

 

global class Bibizanka { public String getBibizankaValue(String Bibiz){ return Bibiz; } }

 

 

<apex:page cache="true" showHeader="false" sidebar="false" controller="Bibizanka"> Bibizanka value = {!BibizankaValue('test')} </apex:page>

 

Thanks.

 

Hi.

 

I'm trying to access apex clases via PHP. But got error - 

 

Fatal error: Uncaught SoapFault exception: [soapenv:Client] Element {}item invalid at this location in /home/oleg/sites/site.php:30 Stack trace: #0 [internal function]: SoapClient->__call('Test', Array) #1 /home/oleg/sites/site.php(30): SoapClient->Test() #2 {main} thrown in /home/oleg/sites/site.php on line 30

 

Apex Code:

 

 

global class Test1 {

webservice static String Test2() {
return 'Got it';

}

 

 PHP Code:

 

 

<html>
<head>
<title> PHP SalesForce Test </title>
</head>
<body>

<?php
ini_set("soap.wsdl_cache_enabled", "0");
require_once('salesforceAPI/SforcePartnerClient.php');
require_once('salesforceAPI/SforceHeaderOptions.php');

$sfdc = new SforcePartnerClient();
$SoapClient = $sfdc->createConnection('salesforceAPI/wsdl.xml');

$loginResult = false;
$loginResult = $sfdc->login('login@login', 'password' . 'token');
$parsedURL = parse_url($sfdc->getLocation());

define ("_SFDC_SERVER_", substr($parsedURL['host'],0,strpos($parsedURL['host'], '.')));
define ("_WS_NAME_", 'Test1');
define ("_WS_WSDL_", _WS_NAME_ . '.xml');
define ("_WS_ENDPOINT_", 'https://' . _SFDC_SERVER_ . '.salesforce.com/services/wsdl/class/' . _WS_NAME_);
define ("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);

$client = new SoapClient(_WS_WSDL_);
$sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $sfdc->getSessionId()));
$client->__setSoapHeaders(array($sforce_header));

$responce = $client->Test2();

echo "Message is " . $response;

?>
</body>
</html>

 

 Thank you.

 

 

 

Hello, Sirs.

I need to display input button when 'numofrecords' have value > 0.

I tried to used that code:

Code:
{!IF(numofrec > 0,'<input type="button" onclick="action();" value="Do something" class="btn"/>',"")} 

But result of this code not a button, but only text - '<input type="button" onclick="action();" value="Do something" class="btn"/>'

How I can fix it ?

Thank you, Gentlemen.


Message Edited by Olbrest on 01-20-2009 01:29 PM
Hello, Sirs.

During apex.execute I got an arror - "No operation available for request".

It's a visualforce page.

When I use the same code on the Scontrol page, I have not get any errors.

How I can get data from class to javascript ?
Seems like philosophy of visualforce does not let it. Is it so ?

Thank you.


Code:
<apex:page controller="Controller">
<script type="text/javascript" src="/soap/ajax/13.0/connection.js"></script> 
<script type="text/javascript" src="/soap/ajax/13.0/apex.js"></script> 
<script type="text/javascript" src="/js/functions.js"></script>
<script language="javascript">

sforce.debug.trace = true;
sforce.connection.sessionId = "{!$Api.Session_ID}";

function test(){

var result = sforce.apex.execute("Controller","Testa",{Text: 'hello there'});
alert('test');
}

</script>
<input type="button" onclick="test();" value="Test" class="btn"/>
</apex:page>

 
Code:
global class Controller {
WebService static String Testa(String Text) {
return Text;
}

 



Message Edited by Olbrest on 01-17-2009 07:48 AM
Code:
Account ac = [select Name from Account where Id= :si.Myne_Account__c];
Opportunity s = new Opportunity(Name = "Hello", Account = ac.Name);
insert s;

I Got Error:
 

Error: Compile Error: Invalid initial expression type for field Account, expecting: SOBJECT:Account (or single row query result of that type)

Why ?
How to get quantity of records after select from database ?

I have such code. What I must set instead '????' ?

Code:
public void test3() {

Opportunity[] opp = [select ownerid from Opportunity];
????

}

 
Thank you.
Hello.

Can you help me ?

I have a table of Clients. How I can display the list of records on apex page using javascript code ?

I wrote some of apex code, may be we can use it ?

Thank you.

Code:
    <apex:pageblocktable value="{!clients}" var="gift" id="theTable" width="80%">
        <apex:column >
                <apex:facet name="header">Client</apex:facet>
                <apex:outputText value="{!clients.name}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Age</apex:facet>
                <apex:outputText value="{!clients.age}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Status</apex:facet>
                <apex:outputText value="{!clients.status}"/>
        </apex:column>

    </apex:pageblocktable> 

 



ZY: Sorry for my poor English.


Message Edited by Olbrest on 12-30-2008 06:58 AM

Hello.

I have the salesforce object with ~ 10000 records.

 

I need to select specific range of records.

 

For example records from 5000 to 5500.

 

In MySql I use next query: [ select id from object limit 5000, 500 ]

 

But I can't found the way how I can make it in Apex SOQL.

Thank you.

Message Edited by Olbrest on 03-21-2009 06:38 AM

Hello.

 

Class getPicanto returns array of equal objects.

 

Like:

xx 1

xx 1 

xx 1 

......

 

Need:

xy 1

xk 0

xw 1

.....

 

Please Help!

 

 

Code:

 

 

global class LaFormica {

public class Ispanola
{
public Wine__c Wine {get; set;}
public Integer Sd {get; set;}
}


public List<Ispanola> getPicanto() {
Wine__c[] Wns = [SELECT Gellato From Wine__c];
Ispanola[] Navs = new Ispanola[Wns.size()];

Integer k = 0;
Integer l = 0;
Ispanola Obj = new Ispanola();

for (Wine__c Wn : Wns){
Obj.Wine = Wn;
Obj.Sd = k;
Navs[l] = Obj;

k++;
l++;
if (k == 2){k = 0;}
}

return Navs;
}

 

 

<apex:page cache="true" showHeader="false" sidebar="false" controller="LaFormica">
<apex:repeat value="{!Picanto}" var="Wine">
Name = {!Wine.Wine.Gellato} <br>
Val = {!Wine.Sd}
</apex:repeat>
</apex:page>

 

 

Message Edited by Olbrest on 02-20-2009 06:19 PM

Hello.

 

How to send value from visualforce page to apex class ?

 

I tried to use this code, but it does not work.

 

 

global class Bibizanka { public String getBibizankaValue(String Bibiz){ return Bibiz; } }

 

 

<apex:page cache="true" showHeader="false" sidebar="false" controller="Bibizanka"> Bibizanka value = {!BibizankaValue('test')} </apex:page>

 

Thanks.

 

Hi.

 

I'm trying to access apex clases via PHP. But got error - 

 

Fatal error: Uncaught SoapFault exception: [soapenv:Client] Element {}item invalid at this location in /home/oleg/sites/site.php:30 Stack trace: #0 [internal function]: SoapClient->__call('Test', Array) #1 /home/oleg/sites/site.php(30): SoapClient->Test() #2 {main} thrown in /home/oleg/sites/site.php on line 30

 

Apex Code:

 

 

global class Test1 {

webservice static String Test2() {
return 'Got it';

}

 

 PHP Code:

 

 

<html>
<head>
<title> PHP SalesForce Test </title>
</head>
<body>

<?php
ini_set("soap.wsdl_cache_enabled", "0");
require_once('salesforceAPI/SforcePartnerClient.php');
require_once('salesforceAPI/SforceHeaderOptions.php');

$sfdc = new SforcePartnerClient();
$SoapClient = $sfdc->createConnection('salesforceAPI/wsdl.xml');

$loginResult = false;
$loginResult = $sfdc->login('login@login', 'password' . 'token');
$parsedURL = parse_url($sfdc->getLocation());

define ("_SFDC_SERVER_", substr($parsedURL['host'],0,strpos($parsedURL['host'], '.')));
define ("_WS_NAME_", 'Test1');
define ("_WS_WSDL_", _WS_NAME_ . '.xml');
define ("_WS_ENDPOINT_", 'https://' . _SFDC_SERVER_ . '.salesforce.com/services/wsdl/class/' . _WS_NAME_);
define ("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);

$client = new SoapClient(_WS_WSDL_);
$sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $sfdc->getSessionId()));
$client->__setSoapHeaders(array($sforce_header));

$responce = $client->Test2();

echo "Message is " . $response;

?>
</body>
</html>

 

 Thank you.

 

 

 

Hello, Sirs.

During apex.execute I got an arror - "No operation available for request".

It's a visualforce page.

When I use the same code on the Scontrol page, I have not get any errors.

How I can get data from class to javascript ?
Seems like philosophy of visualforce does not let it. Is it so ?

Thank you.


Code:
<apex:page controller="Controller">
<script type="text/javascript" src="/soap/ajax/13.0/connection.js"></script> 
<script type="text/javascript" src="/soap/ajax/13.0/apex.js"></script> 
<script type="text/javascript" src="/js/functions.js"></script>
<script language="javascript">

sforce.debug.trace = true;
sforce.connection.sessionId = "{!$Api.Session_ID}";

function test(){

var result = sforce.apex.execute("Controller","Testa",{Text: 'hello there'});
alert('test');
}

</script>
<input type="button" onclick="test();" value="Test" class="btn"/>
</apex:page>

 
Code:
global class Controller {
WebService static String Testa(String Text) {
return Text;
}

 



Message Edited by Olbrest on 01-17-2009 07:48 AM
How to get quantity of records after select from database ?

I have such code. What I must set instead '????' ?

Code:
public void test3() {

Opportunity[] opp = [select ownerid from Opportunity];
????

}

 
Thank you.
Hello.

Can you help me ?

I have a table of Clients. How I can display the list of records on apex page using javascript code ?

I wrote some of apex code, may be we can use it ?

Thank you.

Code:
    <apex:pageblocktable value="{!clients}" var="gift" id="theTable" width="80%">
        <apex:column >
                <apex:facet name="header">Client</apex:facet>
                <apex:outputText value="{!clients.name}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Age</apex:facet>
                <apex:outputText value="{!clients.age}"/>
        </apex:column>
        <apex:column >
                <apex:facet name="header">Status</apex:facet>
                <apex:outputText value="{!clients.status}"/>
        </apex:column>

    </apex:pageblocktable> 

 



ZY: Sorry for my poor English.


Message Edited by Olbrest on 12-30-2008 06:58 AM
Hi All,
Can anybody tell, how to call, the javascript onload() function in the <body> in a javascript. I wanted to call an alert statement, through a javascript on the onload function. Please help. Below is the code for reference:
 
<apex:page>
  
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    
<apex:pageBlock>
<apex:form>
  
<body onload="init();">       
<table width="100%">
<tr>
<td>
  <input type="text" id="txtName" />
  <input type="button" value="Save"  />
 
</td>
</tr>
</table>
</body>
 <script language="javascript">
sforce.connection.sessionId = '{!$Api.Session_ID}';
function init()
{
  alert('hi');
}
 </script>

  </apex:form>
</apex:pageBlock>
</apex:page>
  • December 26, 2008
  • Like
  • 0