-
ChatterFeed
-
0Best Answers
-
6Likes Received
-
0Likes Given
-
5Questions
-
7Replies
Filtered Task and Event lists in Account detail view - This is how
As you may see, I've filtered the results via SOQL, you may extend the code to improve or anything else :)
I used a workaround for reading the events, because they are not readable via the 15 digits AccountId but with the 18 digit once. Crazy, but it works. All of you may correct me, if this may not be usable in future.
1) Add a apex class:
public with sharing class RelatedActivitesTest {
public List<Task> tasksLimited {get;set;}
public List<Event> eventsLimited {get;set;}
public List<Contact> conts {get;set;}
public RelatedActivitesTest(ApexPages.StandardController con){
conts = [SELECT id FROM Contact WHERE AccountId =:ApexPages.currentPage().getParameters().get('id')];
tasksLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid from task
where (
accountid=: ApexPages.currentPage().getParameters().get('id') or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
// Used convertID to get the external url repesantation of Account Id, which helps me getting all events. Internal Ids won't work somehow.
eventsLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid,whatid FROM Event
WHERE (
WhatId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
AccountId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
}
public static String convertID(String id){
if(id.length() == 18) return id;
String suffix = '';
for(Integer i=0;i<3;i++){
Integer flags = 0;
for(Integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);
if(c.compareTo('A') >= 0 && c.compareTo('Z') <= 0){
flags += 1 << j;
}
}
if (flags <= 25) {
suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);
}else suffix += '012345'.substring(flags-26,flags-26+1);
}
return id+suffix;
}
}
Create a visual force page:
<apex:page standardController="Account" extensions="RelatedActivitesTest" tabStyle="Account">
<apex:pageBlock title="Filtered Events">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!eventsLimited}" var="eventLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(eventLimited['id'])}">{!eventLimited.subject}</apex:outputLink>
</apex:column>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(eventLimited.description, 150)}" />
</apex:column>
<apex:column value="{!eventLimited.whoid}" headerValue="Member" />
<apex:column value="{!eventLimited.type}" headerValue="Type" />
<apex:column value="{!eventLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!eventLimited.ownerid}" headerValue="Assigned To" />
</apex:dataTable>
</apex:outputPanel>
</apex:pageBlock>
<apex:pageBlock title="Filtered Tasks">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!tasksLimited}" var="taskLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(taskLimited['id'])}">{!taskLimited.subject}</apex:outputLink>
</apex:column>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(taskLimited.description, 150)}" />
</apex:column>
<apex:column value="{!taskLimited.whoid}" headerValue="Member" />
<apex:column value="{!taskLimited.type}" headerValue="Type" />
<apex:column value="{!taskLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!taskLimited.ownerid}" headerValue="Assigned To" />
</apex:dataTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:page>
The visualforce page is connected to Account so you can add it to the Account view in your pagelayout.
If you want to change the filter, just change them to fit your needs.
Anyway, if you like my first post, give me a "like".
Thanks
Thimo
-
- Thimo
- November 26, 2014
- Like
- 6
- Continue reading or reply
Sending email notification to leads created from web to lead with trial license key
Hi,
I want to send out emails from web to lead to the customer - which isn't that problem - but this email should include a unique trial license key. For the key management I would use a custom object, but I don't know how to connect the key to the email (and to this unique user), display it in the mail and send it out.
Does anyone have a simple solution for this?
Thanks in advanced
Thimo
-
- Thimo
- August 26, 2013
- Like
- 0
- Continue reading or reply
Created a Task using PHP Toolkit, but no display in Chatter
Hi folks,
I just created a Task using the PHP Toolkit, with all appropritate Data:
$aObject->OwnerId = $_sfUserId;
$aObject->WhatId = $_sfAccountId;
$aObject->WhoId = $_sfContactId;
$aObject->Subject = "Angebot per E-Mail";
$aObject->Description = $message;
$aObject->ActivityDate = date("c");
$aObject->Status = "Abgeschlossen";
But the Chatter doesn't display the change or the new Task.
What can I do?
Do I have to create a separate Chatter message?
Thanks for help!
Thimo
-
- Thimo
- July 20, 2012
- Like
- 0
- Continue reading or reply
Created a Task using PHP Toolkit, but no display in Chatter
Hi folks,
I just created a Task using the PHP Toolkit, with all appropritate Data:
$aObject->OwnerId = $_sfUserId;
$aObject->WhatId = $_sfAccountId;
$aObject->WhoId = $_sfContactId;
$aObject->Subject = "Angebot per E-Mail";
$aObject->Description = $message;
$aObject->ActivityDate = date("c");
$aObject->Status = "Abgeschlossen";
But the Chatter doesn't display the change or the new Task.
What can I do?
Do I have to create a separate Chatter message?
Thanks for help!
Thimo
-
- Thimo
- July 16, 2012
- Like
- 0
- Continue reading or reply
Disable whole contact
-
- Thimo
- February 21, 2012
- Like
- 0
- Continue reading or reply
Filtered Task and Event lists in Account detail view - This is how
As you may see, I've filtered the results via SOQL, you may extend the code to improve or anything else :)
I used a workaround for reading the events, because they are not readable via the 15 digits AccountId but with the 18 digit once. Crazy, but it works. All of you may correct me, if this may not be usable in future.
1) Add a apex class:
public with sharing class RelatedActivitesTest {
public List<Task> tasksLimited {get;set;}
public List<Event> eventsLimited {get;set;}
public List<Contact> conts {get;set;}
public RelatedActivitesTest(ApexPages.StandardController con){
conts = [SELECT id FROM Contact WHERE AccountId =:ApexPages.currentPage().getParameters().get('id')];
tasksLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid from task
where (
accountid=: ApexPages.currentPage().getParameters().get('id') or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
// Used convertID to get the external url repesantation of Account Id, which helps me getting all events. Internal Ids won't work somehow.
eventsLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid,whatid FROM Event
WHERE (
WhatId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
AccountId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
}
public static String convertID(String id){
if(id.length() == 18) return id;
String suffix = '';
for(Integer i=0;i<3;i++){
Integer flags = 0;
for(Integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);
if(c.compareTo('A') >= 0 && c.compareTo('Z') <= 0){
flags += 1 << j;
}
}
if (flags <= 25) {
suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);
}else suffix += '012345'.substring(flags-26,flags-26+1);
}
return id+suffix;
}
}
Create a visual force page:
<apex:page standardController="Account" extensions="RelatedActivitesTest" tabStyle="Account">
<apex:pageBlock title="Filtered Events">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!eventsLimited}" var="eventLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(eventLimited['id'])}">{!eventLimited.subject}</apex:outputLink>
</apex:column>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(eventLimited.description, 150)}" />
</apex:column>
<apex:column value="{!eventLimited.whoid}" headerValue="Member" />
<apex:column value="{!eventLimited.type}" headerValue="Type" />
<apex:column value="{!eventLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!eventLimited.ownerid}" headerValue="Assigned To" />
</apex:dataTable>
</apex:outputPanel>
</apex:pageBlock>
<apex:pageBlock title="Filtered Tasks">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!tasksLimited}" var="taskLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(taskLimited['id'])}">{!taskLimited.subject}</apex:outputLink>
</apex:column>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(taskLimited.description, 150)}" />
</apex:column>
<apex:column value="{!taskLimited.whoid}" headerValue="Member" />
<apex:column value="{!taskLimited.type}" headerValue="Type" />
<apex:column value="{!taskLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!taskLimited.ownerid}" headerValue="Assigned To" />
</apex:dataTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:page>
The visualforce page is connected to Account so you can add it to the Account view in your pagelayout.
If you want to change the filter, just change them to fit your needs.
Anyway, if you like my first post, give me a "like".
Thanks
Thimo
-
- Thimo
- November 26, 2014
- Like
- 6
- Continue reading or reply
Sometimes I can log in via API, sometimes I can't.
Today however, sometimes, my requests go through fine. Other times, I get a:
SalesforceAuthenticationFailed: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
I've reset my token, refreshed my sandbox, tried connecting to both production and test - always the same outcome.
Every 10+ requests fail, then 1 goes through.
I feel this is definitely an issue with Salesforce, but have no idea how to get through to them.
Any help much appreciated.
- Cal Paterson
- February 23, 2015
- Like
- 0
- Continue reading or reply
Sending email notification to leads created from web to lead with trial license key
Hi,
I want to send out emails from web to lead to the customer - which isn't that problem - but this email should include a unique trial license key. For the key management I would use a custom object, but I don't know how to connect the key to the email (and to this unique user), display it in the mail and send it out.
Does anyone have a simple solution for this?
Thanks in advanced
Thimo
- Thimo
- August 26, 2013
- Like
- 0
- Continue reading or reply
Created a Task using PHP Toolkit, but no display in Chatter
Hi folks,
I just created a Task using the PHP Toolkit, with all appropritate Data:
$aObject->OwnerId = $_sfUserId;
$aObject->WhatId = $_sfAccountId;
$aObject->WhoId = $_sfContactId;
$aObject->Subject = "Angebot per E-Mail";
$aObject->Description = $message;
$aObject->ActivityDate = date("c");
$aObject->Status = "Abgeschlossen";
But the Chatter doesn't display the change or the new Task.
What can I do?
Do I have to create a separate Chatter message?
Thanks for help!
Thimo
- Thimo
- July 20, 2012
- Like
- 0
- Continue reading or reply
Created a Task using PHP Toolkit, but no display in Chatter
Hi folks,
I just created a Task using the PHP Toolkit, with all appropritate Data:
$aObject->OwnerId = $_sfUserId;
$aObject->WhatId = $_sfAccountId;
$aObject->WhoId = $_sfContactId;
$aObject->Subject = "Angebot per E-Mail";
$aObject->Description = $message;
$aObject->ActivityDate = date("c");
$aObject->Status = "Abgeschlossen";
But the Chatter doesn't display the change or the new Task.
What can I do?
Do I have to create a separate Chatter message?
Thanks for help!
Thimo
- Thimo
- July 16, 2012
- Like
- 0
- Continue reading or reply
Disable whole contact
- Thimo
- February 21, 2012
- Like
- 0
- Continue reading or reply