You need to sign in to do that
Don't have an account?
SImmy
Why am not able to save this code. It keeps getting error unexpected +=. Please help me
Account IT = new Account(); String integrationtransactionId= '0016F00001y5mQW'; List<String> fields = new List<String>(Account.SObjectType.getDescribe().fields.getMap().keySet()); String soql=''; soql=soql+' select '; soql=soql+String.join(fields, ','); System.debug('checking'+soql); soql=soql+' from Account where id=:integrationtransactionid'; System.debug('soqq'+soql); IT=database.query(soql); System.debug('itt'+IT); String ack=IT.Request__c; System.debug('acksss--'+ack);
I executed the same code in my anonymous and because I dont have request object i removed that and also database.query will not return any thing. check if you are getting the error from some where else.
Rounak Sharma Thanks for the reply. But my problem is I am not able to save this code to apex class.
Can you just try at your end please? and also database.query will return I believe because I have only used Account and request__c is just a field in account.
But it keeps giving me error i.e. Error: Compile Error: Unexpected token '+=
can you try this way?
String body = '<table allign="center"><tr><td>' +'<img id=r1sp1 src=' + strDocUrl + '></img>'+'<tr><td>' +'<br /><br />Dear Sir/Madam, ';
body += '<br /><br /> ' + 'Please find the attachment of the report';
body += '<br /><br />This is a system generated message, please do not reply. ';
body += '<br />Best Regards. <br /><br /><br />'+'</table>';
this is a sample code i did few time ago.
do let me know if it helps
thanks
It is not working in my org also. You can see the errrors here.
just use your code in class constructor or method it will work.
Hey, This is my code..
VF page:
<apex:page controller="ContactsVisualforceController" standardStylesheets="false">
<apex:form>
<apex:pageBlock title="Contacts List">
<apex:repeat value="{!displayAccounts}" var="acc">
<dl>
<dt>Account Name:</dt>
<dd><apex:outputText value="{!acc.Name}"/></dd>
</dl>
<dl><dt>Contact Names:</dt></dl>
<apex:pageblocktable value="{!acc.Contacts}" var="cont">
<apex:column value="{!cont.firstname}"/>
<apex:column value="{!cont.lastname}"/>
</apex:pageblocktable>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class ContactsVisualforceController {
public list<Account> displayAccounts {get; set;}
public ContactsVisualforceController(){
displayAccounts = [select id,name,(select id,name,firstname,lastname from Contacts) from Account];
}
}
This is working fine ok.. But now I want to display as Block means
AccountName1 here All related Contacts For that AccountName1 should display here
AccountName2 here All related Contacts For that AccountName2 should display here
AccountName3 here All related Contacts For that AccountName3 should display here
like this I want to display 10 records in one page and another 10 records on another page so pagination we have to use..
So I want how can we do that can anyone please tell me..
I understand your problem and I have gone through this also. The same code I tried in my org and I found its working fine in my org.Although this problem is not a org problem.This is syntax error.Please try my code once also that is given below.
public class testJoin {
public static void test(){
Account IT = new Account();
String integrationtransactionId= '0016F00001y5mQW';
List<String> fields = new List<String>(Account.SObjectType.getDescribe().fields.getMap().keySet());
String soql='';
soql=soql+' select ';
soql=soql+String.join(fields, ',');
System.debug('-->'+soql);
soql=soql+' from Account where id=:integrationtransactionid';
System.debug('-->'+soql);
IT=database.query(soql);
System.debug('itt'+IT);
// String ack=IT.Request__c; //I did comment this because this field is not exist in Account obj in my org.
// System.debug('acksss--'+ack);
}
}
I am sharing two snaps of code and its output also for you better help.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Hi Simmy
I am writing a Program. Please check it and it will help
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Suraj Tripathi