- Doondi
- NEWBIE
- 80 Points
- Member since 2017
- Sr.Salesforce Developer
- VRSainyam Technology Solutions Private L
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
1Likes Given
-
28Questions
-
63Replies
How to display link fields under related list?
Hi,
I want to display links just like shown in below(If we click on view, the student's marks sheet need to be displayed in another window)

More Info:
I am doing Integration, The school children Marks sheets are stored in a different database,
I have received a URL for Integration.
I have placed them in Remote site settings.
What's next?
How do I receive that JSON file/Response?
Do I need to write any apex classes? Or can I just keep the URL in formula field?
I want to display links just like shown in below(If we click on view, the student's marks sheet need to be displayed in another window)
More Info:
I am doing Integration, The school children Marks sheets are stored in a different database,
I have received a URL for Integration.
I have placed them in Remote site settings.
What's next?
How do I receive that JSON file/Response?
Do I need to write any apex classes? Or can I just keep the URL in formula field?
-
- Doondi
- February 08, 2019
- Like
- 0
- Continue reading or reply
How to write test class for if (list.size > 0 )?
Hello Dev's
Please help me to write test class for If(list.size >0 )
here is my trigger code
What I tried till now is I have created data for all the objects and I am getting coverage for that, but I am not able to pass this If(list.size > ) ) condition
it's very urgent.
Please help me to write test class for If(list.size >0 )
here is my trigger code
List <Project__c> ProjectList = [select id,Name,OwnerId from Project__c where Name =: Name]; // Region__c is custom settings to avoid hard coding ID's of particular profile to which record should be assigned if it meets Region__c condigion on deal object) Region__c user = Region__c.getInstance(Userinfo.getUserId()); if (ProjectList.size() == 0) { if(deal.Manager__c == Null && deal.Property__r.Region__c == 'Asia') { deal.Manager__c = user.Asia__c; } Projects.add(new Project__c (Name = 'test Name', OwnerId = deal.Manager__c )); insert Project; } else if ((ProjectList.size() > 0)) { if(deal.Manager__c == Null && deal.Property__r.Region__c == 'Asia') { deal.Manager__c = user.Asia__c; } String Name : deal.Name Project__c NewProjectList = [select id,Name,OwnerId from Project__c where Name =: Name]; NewProjectList.OwnerId = deal.Manager__c; update NewProjectList; }
What I tried till now is I have created data for all the objects and I am getting coverage for that, but I am not able to pass this If(list.size > ) ) condition
it's very urgent.
-
- Doondi
- January 22, 2019
- Like
- 0
- Continue reading or reply
custom Settings: To Avoid hard coding Id : Trigger : Test Class
Hi below is my Simple Trigger and Test classes.
I am not able to Cover the code for Custom settings, can anyone help me
My test class:
The problem - not able to Pass the values into if conditions
I am not able to Cover the code for Custom settings, can anyone help me
trigger CreateRecord on Deals__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name from Project__c where id in :triggerIds]; List <Project__c> newProject = new List<Project__c>() ; for(Deals__c Deal : [Select id,Name,Property__r.Region__c,Type__c,Status__c,Manager__c,Property__r.Site__c from LMS_Deal__c where id IN :triggerIds]) { if(Deal.Type__c == 'New') { string Name = Deal.Name + ' - ' + Deal.Property__r.Site__c; List <Project__c> ProjectList = [select id,Name,OwnerId,Property__r.Site__c from Project__c where Name =: Name]; Region__c customSettings = Region__c.getInstance(Userinfo.getUserId()); if (ProjectList.size() == 0) { if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; } newProject.add(new Project__c ( Name = Deal.Name + ' - ' + Deal.Property__r.Site__c, OwnerId = Deal.Manager__c insert newProject; }//if else if (ProjectList.size() >> 0) { if(Deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; } Project__c NewProjectList = [select id,Name,OwnerId,Property__r.Site__c,Property__r.Region__c from Project__c where Name =: Name]; NewProjectList.OwnerId = Deal.Manager__c; update NewProjectList; } } } }
My test class:
@isTest(SeeAllData=true) private class CreateRecordTest { static testmethod void CreateRecord(){ // creating property Property__c prop = new Property__c(Name = 'Test property', Site_c = 'New Site', Region__c = 'Delhi'); insert prop; // creating Units Unit__c units = new Unit__c(Name = 'Test Unit', Property_Unit__c = prop.Id); insert units; // creating a user Profile objProfile = [SELECT Id, Name FROM Profile WHERE Name='System Administrator']; User objUser = new User(Alias = 'Swill', Email='swill@mymail.com', EmailEncodingKey='UTF-8', LastName='Will', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = objProfile.Id, TimeZoneSidKey='America/Los_Angeles', UserName='will@gmail.com'); insert objUser; // creating another user for assigning custom setting Profile objProfile1 = [SELECT Id, Name FROM Profile WHERE Name='System Administrator']; User objUser1 = new User(Alias = 'Kaka', Email='kaka@kakamail.com', EmailEncodingKey='UTF-8', LastName='Mkaka', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = objProfile1.Id, TimeZoneSidKey='America/Los_Angeles', UserName='kaka_M@gmail.com'); insert objUser1; // creating custom settings Region__c CustomSettings = new Region__c ( Name = 'test custom setting', Delhi__c = objUser1.Id); insert CustomSettings; // creating deal Deal__c deal = new Deal__c(Name = 'Test Deal', Manager__c = objUser1.Id, Type__c = 'New'); insert LMSdeal1; // creating property Project__c TP = new Project__c( Name = deal.Name + ' - ' + deal.Property__r.Site__c, OwnerId = deal.Manager__c); insert TP; } }
The problem - not able to Pass the values into if conditions
if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; }
-
- Doondi
- January 19, 2019
- Like
- 0
- Continue reading or reply
How to assign a OwnerId to an user based on custom field value?
Hi,
My logic is: If (Manager__c == Null && region__c == 'South'
then assign the newly created record to South_Zonal_Manager__c
My requirement is something like this, can someone help me.
Twist here for me is I have 4 regions (east, west, north, south) and I have 4 different zonal managers
My logic is: If (Manager__c == Null && region__c == 'South'
then assign the newly created record to South_Zonal_Manager__c
My requirement is something like this, can someone help me.
Twist here for me is I have 4 regions (east, west, north, south) and I have 4 different zonal managers
-
- Doondi
- January 09, 2019
- Like
- 0
- Continue reading or reply
Is this Bulk Trigger, if so how do I write test classes for this trigger?
Hello, Champ's,
Below is my trigger, works fine if I am inserting one record or updating one record.
I would like to know if it qualifies for a BULK trigger.
Intro: Two custom objects, School__c and Admission__c,
whenever a new school__c record is inserted or updated with the TYPE and STATUS conditions,
Then
New admission__c record to be created with the mentioned values.
It will be great if anyone can help me with test classes.
Below is my trigger, works fine if I am inserting one record or updating one record.
I would like to know if it qualifies for a BULK trigger.
Intro: Two custom objects, School__c and Admission__c,
whenever a new school__c record is inserted or updated with the TYPE and STATUS conditions,
Then
New admission__c record to be created with the mentioned values.
trigger CreateAdmissionRecord on School__c (after insert, after update) { Student_Trigger__c TT = Student_Trigger__c.getvalues(UserInfo.getProfileId()); set<id> triggerIds = trigger.newMap.keyset(); List <Admission__c> Project = [select id, Name,Deal__r.Student__r.Name from Admission__c where id in :triggerIds]; List <Admission__c> newadmissions = new List<Admission__c>() ; for(School__c scool : [Select id,Name,Type__c,Status__c,Manager__c, Class__r.Name, Class__c,Unit__c,New_Flag__c from School__c where id in :triggerIds]) { // the below line is to active or de active the trigger in production from CUSTOM SETTINGS if((TT.Active__c == TRUE) && // While INSERTING or UPDATE the school record, a New Admission record to be created based // on the below condition[if Type__c = New and Status__c = changed] (scool.Type__c == 'New') && (scool.Status__c == 'Changed') { // the below string tries to check for duplicate names and avoid creating duplicate records. string Name = scool.Name + ' - ' + scool.Class__r.Name; List <Admission__c> ProjectList = [select id, Name,Deal__r.Class__r.Name from Admission__c where Name =: Name]; if (ProjectList.size() > 0) { if(!ProjectList.isEmpty()) insert newadmissions; } else{ newadmissions.add(new Admission__c ( Name = scool.Name + ' - ' + scool.Class__r.Name, OwnerId = scool.Manager__c, Status__c = 'Project Not Started', Unit__c = scool.Unit__c, New_Unit__c = scool.New_Flag__c ) ); } } insert newadmissions; } }
It will be great if anyone can help me with test classes.
-
- Doondi
- December 20, 2018
- Like
- 0
- Continue reading or reply
Why after update trigger is giving 0% test coverage?
Trigger
Test Class
trigger CreateRecord on Deal__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name, Deal__r.Property__r.Name from Project__c where id in :triggerIds]; List <Project__c> projectsForInsert = new List<Project__c>() ; for(Deal__c deal : [Select id, Type__c, Property__r.Name, Property__c from Deal__c where id in :triggerIds]) { if( deal.Type__c == 'New' ) { projectsForInsert.add(new Project__c ( Name = deal.Property__r.Name, // this field is giving ID instead of Name Property__c = deal.Property__c // This field is giving correct update. ) ); } } insert projectsForInsert; }
Test Class
@isTest public class CreateNewRecordTest{ public static testMethod void CreateNewRecordTestMethod(){ Deal__c DL = new Deal__c (type__c='interested', status__c = 'Quik'); Project__c Proj = new Project__c( Name = 'King size project', Deal__c = 'ultimate'); insert Proj; }}}
-
- Doondi
- December 17, 2018
- Like
- 0
- Continue reading or reply
Trigger is giving me Id instead of Name?
Hi,
Below is my simple Trigger on two custom objects with MD relationship,
For Name I am getting Id, where as for Property__c I am getting correct Value.
below is my trigger
Below is my simple Trigger on two custom objects with MD relationship,
For Name I am getting Id, where as for Property__c I am getting correct Value.
below is my trigger
trigger CreateNewRecord on Deal__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name, Deal__r.Property__r.Name from Project__c where id in :triggerIds]; for(Deal__c deal : Trigger.new) { if( deal.Type__c == 'New' ) Project.add(new Project__c ( Name = deal.Property__r.Name, // this field is giving ID instead of Name Property__c = deal.Property__c // This field is giving correct update. ) ); } insert Project; }
-
- Doondi
- November 12, 2018
- Like
- 0
- Continue reading or reply
tablesorter not sorting $ values properly and reading digits as wrong
Hi,
I am Using TableSorter and it's not sorting $ values properly,
Any suggestion would be a great help.
Here is my Js code:
This is my Pageblocktable code:

I am Using TableSorter and it's not sorting $ values properly,
Any suggestion would be a great help.
Here is my Js code:
<script type="text/javascript"> $j = jQuery.noConflict(); $j(document).ready(function () { $j("[id$=theaddrs]").tablesorter(); }); </script>
This is my Pageblocktable code:
<apex:pageblock mode="details" id="theaddrsblock" > <apex:pageBlockTable value="{!Records}" var="r" styleclass="fixme" id="theaddrs" styleClass="tablesorter" headerClass="header"> <apex:column value="{!r.Units__c}"></apex:column> <apex:column value="{!r.Annual_Sale__c}" ></apex:column> <--10 more colomns here; which are sorting perfectly--> </apex:pageBlockTable> </apex:pageblock>This is the output am getting :
-
- Doondi
- October 24, 2018
- Like
- 0
- Continue reading or reply
Prepopulating Field Values on Related list
Hi, I wanted to know how I can prepopulate the Lookup values.
There are two custom objects (school__c and student__c) having master detail relationship to Opportunities.
This is my button code:
I want student__c also to be pre populated.
There are two custom objects (school__c and student__c) having master detail relationship to Opportunities.
This is my button code:
<button class="slds-button slds-button_neutral"> <apex:outputLink value="!URLFOR($Action.Opportunity.New,null)}"> Add </apex:outputLink> </button>When I click on add, by default I am getting only School__c as prepopulated,
I want student__c also to be pre populated.
-
- Doondi
- September 27, 2018
- Like
- 0
- Continue reading or reply
why am not able to Sorting arrow's?
Below is my simple VF page and I have used tablesorter plug in, (http://tablesorter.com/docs/)
It's working fine but I am not able to get/see Sorting arrows.
It's working fine but I am not able to get/see Sorting arrows.
<apex:page standardController="Property__c" showHeader="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" lightningStylesheets="true"> <apex:includeScript value="{!$Resource.latest}"/> <apex:includeScript value="{!$Resource.tablesorter}"/> <apex:includeScript value="{!$Resource.metadata}"/> <apex:includeScript value="{!$Resource.tablesortermin}"/> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" /> <script type="text/javascript"> $j = jQuery.noConflict(); $j(document).ready(function () { $j("[id$=theaddrs]").tablesorter(); }); </script> <script> $j(document).ready(function() { $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); } ); </script> <script type="text/javascript" src="/path/to/jquery-latest.js"></script> <script type="text/javascript" src="/path/to/jquery.tablesorter.js"></script> <apex:form > <apex:includeScript value="{!$Resource.svg4everybody}"/> <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <apex:slds /> </head> <body> <div class="slds-scope"> <div class="myapp"> <div class="slds-grid slds-m-top_large"> <div class="slds-col slds-col_rule-right slds-p-right_large slds-size_12-of-12"> <apex:pageblock mode="details" id="theaddrsblock" > <apex:pageBlockTable value="{!Property__c}" var="index" styleclass="fixme" id="theaddrs" styleClass="tablesorter" headerClass="header"> <apex:column value="{!index.Name}" > </apex:column> <apex:column value="{!index.Phone__c}"> </apex:column> <apex:column value="{!index.LandMark__c}"> </apex:column> <apex:column value="{!index.Block__c}"> </apex:column> <apex:column value="{!index.Rent__c}"> </apex:column> </apex:pageBlockTable> </apex:pageblock> </div> </div> </div> </div> </body> </html> </apex:form> </apex:page>
-
- Doondi
- August 28, 2018
- Like
- 0
- Continue reading or reply
Query to get opportunities from custom object?
Hi,
I have 3 objects:
Opportunity
Pro__c
Unc__c
(Pro__c and Unc__c has lookup to opportunities)
To get unc__c values from Opportunities i am using this query,
select name from opportunity where unc__r.id='idvalue'
can I query from Unc__c to get opportunities??
If so, How?
I have 3 objects:
Opportunity
Pro__c
Unc__c
(Pro__c and Unc__c has lookup to opportunities)
To get unc__c values from Opportunities i am using this query,
select name from opportunity where unc__r.id='idvalue'
can I query from Unc__c to get opportunities??
If so, How?
-
- Doondi
- August 08, 2018
- Like
- 0
- Continue reading or reply
drop down direction, up or down based on the space available?
Hi, below is my CSS code (pure) for drop down menu:
.onclick-menu
{
position: relative;
display: inline-block;
}
.onclick-menu:before
{
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: "\f0d7";
padding: 5px;
border: 1px solid rgb(221, 219, 218);
background-color: rgb(255, 255, 255);
color: rgb(112, 110, 107);
border-radius: .25rem;
}
.onclick-menu-content li a
{
text-decoration: none;
display: block;
padding: .5rem .75rem;
color: rgba(27, 82, 151, 1.0);
}
.onclick-menu-content li a:hover
{
background-color: rgb(236, 235, 234);
text-decoration: none;
color: rgba(27, 82, 151, 1.0);
}
.onclick-menu:focus
{
pointer-events: none;
outline: none;
}
.onclick-menu:focus .onclick-menu-content {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.onclick-menu-content
{
position: absolute;
z-index: 1;
background: rgb(255, 255, 255);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);
border: 1px solid rgb(221, 219, 218);
border-radius: .25rem;
left: -40px;
/* use opacity to fake immediate toggle */
opacity: 0;
visibility: hidden;
transition: visibility 0.5s;
}
By default it's direction is down.....
Can we make it auto (up or down) based on space available?
.onclick-menu
{
position: relative;
display: inline-block;
}
.onclick-menu:before
{
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: "\f0d7";
padding: 5px;
border: 1px solid rgb(221, 219, 218);
background-color: rgb(255, 255, 255);
color: rgb(112, 110, 107);
border-radius: .25rem;
}
.onclick-menu-content li a
{
text-decoration: none;
display: block;
padding: .5rem .75rem;
color: rgba(27, 82, 151, 1.0);
}
.onclick-menu-content li a:hover
{
background-color: rgb(236, 235, 234);
text-decoration: none;
color: rgba(27, 82, 151, 1.0);
}
.onclick-menu:focus
{
pointer-events: none;
outline: none;
}
.onclick-menu:focus .onclick-menu-content {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.onclick-menu-content
{
position: absolute;
z-index: 1;
background: rgb(255, 255, 255);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);
border: 1px solid rgb(221, 219, 218);
border-radius: .25rem;
left: -40px;
/* use opacity to fake immediate toggle */
opacity: 0;
visibility: hidden;
transition: visibility 0.5s;
}
By default it's direction is down.....
Can we make it auto (up or down) based on space available?
-
- Doondi
- August 01, 2018
- Like
- 0
- Continue reading or reply
Actions on List Views - Lightning
Hi,
I have a custom visualforce page with few fields and action colum (edit and Delete).
This page is good in classic.
How to achieve the same look and feel as in lightning dafault?
see the below picture for more clarity.
I have a custom visualforce page with few fields and action colum (edit and Delete).
This page is good in classic.
How to achieve the same look and feel as in lightning dafault?
see the below picture for more clarity.
-
- Doondi
- July 19, 2018
- Like
- 0
- Continue reading or reply
Go to list(13) on relatedList
Hi,
I wanted to know how to build "Go to LIst(13) Link available on related list of Master object.
fucntionality I require:
when user click on "Go to List"
I need to redirect to page that has Master object's related list.
below is the picture of requirement.

I wanted to know how to build "Go to LIst(13) Link available on related list of Master object.
fucntionality I require:
when user click on "Go to List"
I need to redirect to page that has Master object's related list.
below is the picture of requirement.
-
- Doondi
- July 17, 2018
- Like
- 0
- Continue reading or reply
List index out of bounds: 35
Hi,
I have below code for "{!RecordsPerPage}",
If user chooses 40 records to display and if there are only 35 records, Then I am getting this error.
How to avoid this?
Here is my controller for RecordsPerPage
I have below code for "{!RecordsPerPage}",
If user chooses 40 records to display and if there are only 35 records, Then I am getting this error.
How to avoid this?
Here is my controller for RecordsPerPage
public pageReference RecordsPerPage() { if (PageSize < total) { if (math.mod(total,PageSize)>0) { totalpagecount=total/PageSize+1; }//if else { totalpagecount=total/PageSize; }//else }//if else { totalpagecount=10; } Set<String> setIds = new Set<String>(); PageNo = PageNoCount = 1; IsNext = IsLast = false; IsPrevious = IsFirst = true; List<Unit__c> accountList = getAccountsData(setIds); accountList = SortByFields(accountList, sortExpression, sortDirection); Records.clear(); for(Integer i = 0; i < PageSize; i++){ Records.add(accountList[i]); } return null; }
-
- Doondi
- July 11, 2018
- Like
- 0
- Continue reading or reply
why am not getting values in my vf page?
Hi, I am trying to build a related list ,
Units has Master relation to praperty
below is my class and page: But I am not getting values in my page.
Thanks in advance.
Units has Master relation to praperty
below is my class and page: But I am not getting values in my page.
Thanks in advance.
public class DeleteFlag { public Property__c prop{get; set;} Public Unit__c unts{get;set;} public List<Unit__c> Records {get; set;} public DeleteFlag(ApexPages.StandardController controller) { prop=new Property__c(); unts = new unit__c(); Records = [select Name,Property_Unit__c FROM Unit__c WHERE Property_Unit__c = :Prop.Name]; system.debug(prop.Name); }
-
- Doondi
- July 03, 2018
- Like
- 0
- Continue reading or reply
Query to get related records ?
Hi,
I am trying to build a vf page to display related list of records of a custom object
Here is my class and page:
public class DeleteFlag { public List<Unit__c> Records {get; set;} public DeleteFlag(ApexPages.StandardController controller) { Records =[Select Name, from Unit__c WHERE Name='a013B000003i1vZ']; } <apex:page standardcontroller="Property__c" extensions="DeleteFlag"> <apex:pageBlock mode="details" > <apex:form > <apex:pageBlockTable value="{!Records}" var="index" > <apex:column value="{!index.Name}"/> <apex:column value="{!index.Property_Unit__c}"/> </apex:pageBlockTable> </apex:form> </apex:pageBlock> </apex:page>In the above code, I am hard coding parent values,
how to equal it to ID ( Unit__c has Look up to property__c)
-
- Doondi
- July 02, 2018
- Like
- 0
- Continue reading or reply
Update record without any action?
Hi,
I have custom object: School__c, in that I have a (checkbox)custom field: Old student__c.
There are more than 1000 records in that school object.
I want to udpate Old Student__c =true.
I don't want to edit each and every record and do it manually.
I don't want to bring back data with tools and again update-it's RISKY
Let me know How I can achive this.
Thanks in advance.
I have custom object: School__c, in that I have a (checkbox)custom field: Old student__c.
There are more than 1000 records in that school object.
I want to udpate Old Student__c =true.
I don't want to edit each and every record and do it manually.
I don't want to bring back data with tools and again update-it's RISKY
Let me know How I can achive this.
Thanks in advance.
-
- Doondi
- June 29, 2018
- Like
- 0
- Continue reading or reply
"export to excel" button on custom list view page
Hi,
I Have custom visualforce page for List views (example : ALL views, Major views etc...)
Now I want to button to export for Major views.
[if user select all views and click on export button, then I need all records to download,
If user select Major views and click on export button then I need Major views records]
Any tips and liks on how I can achieve this ?
I Have custom visualforce page for List views (example : ALL views, Major views etc...)
Now I want to button to export for Major views.
[if user select all views and click on export button, then I need all records to download,
If user select Major views and click on export button then I need Major views records]
Any tips and liks on how I can achieve this ?
-
- Doondi
- June 26, 2018
- Like
- 0
- Continue reading or reply
Column sorting and alpha sorting are conflicting
Hi,
I have below code for custom list view
I am using this class as extension
When column sorting works, the alpha sort doens't work. and vice versa
any anyone tell where I am goinng wrong?
I have below code for custom list view
I am using this class as extension
When column sorting works, the alpha sort doens't work. and vice versa
any anyone tell where I am goinng wrong?
public class AccountListViewController { public static string Selectedview{get;set;} private Integer total; //column sorting private List<Accounting__c> accounts; private String sortDirection = 'ASC'; private String sortExp = 'name'; //public static string Selectedview{get;set;} public static integer PageSize {get;set;} //private Integer total; private string inputQuery = 'Select Name, Account_Name__c, Account_Category__c, Statement_Type__c from Accounting__c '; public AccountListViewController(ApexPages.StandardSetController controller ){ Selectedview='All'; PageSize = 25; accounts = Database.query(inputQuery + 'limit '+ PageSize); } //column sorting start public String sortExpression { get { return sortExp; } set { //if the column is clicked on then switch between Ascending and Descending modes if (value == sortExp) sortDirection = (sortDirection == 'ASC')? 'DESC' : 'ASC'; else sortDirection = 'ASC'; sortExp = value; System.debug('Hi'+sortExp+' '+sortExp +'!'); } } public String getSortDirection() { //if not column is selected if (sortExpression == null || sortExpression == '') return 'ASC'; else return sortDirection; } public void setSortDirection(String value) { sortDirection = value; system.debug('value'+''+value); } public List<Accounting__c> getAccounts() { return accounts; } public PageReference ViewData() { //build the full sort expression string sortFullExp = sortExpression + ' ' + sortDirection; //query the database based on the sort expression accounts = Database.query(inputQuery + ' order by ' + sortFullExp + ' limit ' + PageSize); system.debug('srini'+''+'srini'); return null; } public PageReference PageSizeData() { PageSize = 25; system.debug('pagesize'+''+'pagesize'); return null; } public Integer getTotal() { total = [SELECT count() FROM Accounting__c]; system.debug('total'); return total; } //column sorting ending list<Accounting__c> acclist = [Select Name, Account_Name__c, Account_Category__c, Statement_Type__c from accounting__c]; public list<String> alphabet{ get{ //To display a list of alphabets on vf page alphabet = new list<string>{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Others','All'}; return alphabet; } set; } public String alphaSearchAcc{get;set;} // To get commandlink parameter for alphabet selected public Pagereference getalphaSearch(){ //To update account list as per the alphabet selected by the user if (alphaSearchAcc=='All'){ system.debug('All'); accList = [Select Name, Account_Name__c, Account_Category__c, Statement_Type__c from Accounting__c]; system.debug('acclist'); } else{ accList = [Select Name, Account_Name__c, Account_Category__c, Statement_Type__c from Accounting__c WHERE Name LIKE :('%' + alphaSearchAcc + '%') ]; system.debug('acclist'); } ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accList); // stdSetController= ssc; return null; } }
-
- Doondi
- June 07, 2018
- Like
- 0
- Continue reading or reply
send email to contact // Help please
Hello everyone, please tell me how to create a template for email distribution in the builder process, a letter for the CONTACT field of the EVENT object, with an attached PDF file with a list of participants who belong to the EVENT object. The mailing condition is set only need an email alert
the scheme is given below
the scheme is given below
- Vitaliy Beliy 15
- November 21, 2019
- Like
- 0
- Continue reading or reply
How to display link fields under related list?
Hi,
I want to display links just like shown in below(If we click on view, the student's marks sheet need to be displayed in another window)

More Info:
I am doing Integration, The school children Marks sheets are stored in a different database,
I have received a URL for Integration.
I have placed them in Remote site settings.
What's next?
How do I receive that JSON file/Response?
Do I need to write any apex classes? Or can I just keep the URL in formula field?
I want to display links just like shown in below(If we click on view, the student's marks sheet need to be displayed in another window)
More Info:
I am doing Integration, The school children Marks sheets are stored in a different database,
I have received a URL for Integration.
I have placed them in Remote site settings.
What's next?
How do I receive that JSON file/Response?
Do I need to write any apex classes? Or can I just keep the URL in formula field?
- Doondi
- February 08, 2019
- Like
- 0
- Continue reading or reply
custom Settings: To Avoid hard coding Id : Trigger : Test Class
Hi below is my Simple Trigger and Test classes.
I am not able to Cover the code for Custom settings, can anyone help me
My test class:
The problem - not able to Pass the values into if conditions
I am not able to Cover the code for Custom settings, can anyone help me
trigger CreateRecord on Deals__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name from Project__c where id in :triggerIds]; List <Project__c> newProject = new List<Project__c>() ; for(Deals__c Deal : [Select id,Name,Property__r.Region__c,Type__c,Status__c,Manager__c,Property__r.Site__c from LMS_Deal__c where id IN :triggerIds]) { if(Deal.Type__c == 'New') { string Name = Deal.Name + ' - ' + Deal.Property__r.Site__c; List <Project__c> ProjectList = [select id,Name,OwnerId,Property__r.Site__c from Project__c where Name =: Name]; Region__c customSettings = Region__c.getInstance(Userinfo.getUserId()); if (ProjectList.size() == 0) { if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; } newProject.add(new Project__c ( Name = Deal.Name + ' - ' + Deal.Property__r.Site__c, OwnerId = Deal.Manager__c insert newProject; }//if else if (ProjectList.size() >> 0) { if(Deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; } Project__c NewProjectList = [select id,Name,OwnerId,Property__r.Site__c,Property__r.Region__c from Project__c where Name =: Name]; NewProjectList.OwnerId = Deal.Manager__c; update NewProjectList; } } } }
My test class:
@isTest(SeeAllData=true) private class CreateRecordTest { static testmethod void CreateRecord(){ // creating property Property__c prop = new Property__c(Name = 'Test property', Site_c = 'New Site', Region__c = 'Delhi'); insert prop; // creating Units Unit__c units = new Unit__c(Name = 'Test Unit', Property_Unit__c = prop.Id); insert units; // creating a user Profile objProfile = [SELECT Id, Name FROM Profile WHERE Name='System Administrator']; User objUser = new User(Alias = 'Swill', Email='swill@mymail.com', EmailEncodingKey='UTF-8', LastName='Will', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = objProfile.Id, TimeZoneSidKey='America/Los_Angeles', UserName='will@gmail.com'); insert objUser; // creating another user for assigning custom setting Profile objProfile1 = [SELECT Id, Name FROM Profile WHERE Name='System Administrator']; User objUser1 = new User(Alias = 'Kaka', Email='kaka@kakamail.com', EmailEncodingKey='UTF-8', LastName='Mkaka', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = objProfile1.Id, TimeZoneSidKey='America/Los_Angeles', UserName='kaka_M@gmail.com'); insert objUser1; // creating custom settings Region__c CustomSettings = new Region__c ( Name = 'test custom setting', Delhi__c = objUser1.Id); insert CustomSettings; // creating deal Deal__c deal = new Deal__c(Name = 'Test Deal', Manager__c = objUser1.Id, Type__c = 'New'); insert LMSdeal1; // creating property Project__c TP = new Project__c( Name = deal.Name + ' - ' + deal.Property__r.Site__c, OwnerId = deal.Manager__c); insert TP; } }
The problem - not able to Pass the values into if conditions
if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi') { Deal.Manager__c = customSettings.Delhi__c; }
- Doondi
- January 19, 2019
- Like
- 0
- Continue reading or reply
Is this Bulk Trigger, if so how do I write test classes for this trigger?
Hello, Champ's,
Below is my trigger, works fine if I am inserting one record or updating one record.
I would like to know if it qualifies for a BULK trigger.
Intro: Two custom objects, School__c and Admission__c,
whenever a new school__c record is inserted or updated with the TYPE and STATUS conditions,
Then
New admission__c record to be created with the mentioned values.
It will be great if anyone can help me with test classes.
Below is my trigger, works fine if I am inserting one record or updating one record.
I would like to know if it qualifies for a BULK trigger.
Intro: Two custom objects, School__c and Admission__c,
whenever a new school__c record is inserted or updated with the TYPE and STATUS conditions,
Then
New admission__c record to be created with the mentioned values.
trigger CreateAdmissionRecord on School__c (after insert, after update) { Student_Trigger__c TT = Student_Trigger__c.getvalues(UserInfo.getProfileId()); set<id> triggerIds = trigger.newMap.keyset(); List <Admission__c> Project = [select id, Name,Deal__r.Student__r.Name from Admission__c where id in :triggerIds]; List <Admission__c> newadmissions = new List<Admission__c>() ; for(School__c scool : [Select id,Name,Type__c,Status__c,Manager__c, Class__r.Name, Class__c,Unit__c,New_Flag__c from School__c where id in :triggerIds]) { // the below line is to active or de active the trigger in production from CUSTOM SETTINGS if((TT.Active__c == TRUE) && // While INSERTING or UPDATE the school record, a New Admission record to be created based // on the below condition[if Type__c = New and Status__c = changed] (scool.Type__c == 'New') && (scool.Status__c == 'Changed') { // the below string tries to check for duplicate names and avoid creating duplicate records. string Name = scool.Name + ' - ' + scool.Class__r.Name; List <Admission__c> ProjectList = [select id, Name,Deal__r.Class__r.Name from Admission__c where Name =: Name]; if (ProjectList.size() > 0) { if(!ProjectList.isEmpty()) insert newadmissions; } else{ newadmissions.add(new Admission__c ( Name = scool.Name + ' - ' + scool.Class__r.Name, OwnerId = scool.Manager__c, Status__c = 'Project Not Started', Unit__c = scool.Unit__c, New_Unit__c = scool.New_Flag__c ) ); } } insert newadmissions; } }
It will be great if anyone can help me with test classes.
- Doondi
- December 20, 2018
- Like
- 0
- Continue reading or reply
Why after update trigger is giving 0% test coverage?
Trigger
Test Class
trigger CreateRecord on Deal__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name, Deal__r.Property__r.Name from Project__c where id in :triggerIds]; List <Project__c> projectsForInsert = new List<Project__c>() ; for(Deal__c deal : [Select id, Type__c, Property__r.Name, Property__c from Deal__c where id in :triggerIds]) { if( deal.Type__c == 'New' ) { projectsForInsert.add(new Project__c ( Name = deal.Property__r.Name, // this field is giving ID instead of Name Property__c = deal.Property__c // This field is giving correct update. ) ); } } insert projectsForInsert; }
Test Class
@isTest public class CreateNewRecordTest{ public static testMethod void CreateNewRecordTestMethod(){ Deal__c DL = new Deal__c (type__c='interested', status__c = 'Quik'); Project__c Proj = new Project__c( Name = 'King size project', Deal__c = 'ultimate'); insert Proj; }}}
- Doondi
- December 17, 2018
- Like
- 0
- Continue reading or reply
Trigger is giving me Id instead of Name?
Hi,
Below is my simple Trigger on two custom objects with MD relationship,
For Name I am getting Id, where as for Property__c I am getting correct Value.
below is my trigger
Below is my simple Trigger on two custom objects with MD relationship,
For Name I am getting Id, where as for Property__c I am getting correct Value.
below is my trigger
trigger CreateNewRecord on Deal__c (after insert, after update) { set<id> triggerIds = trigger.newMap.keyset(); List <Project__c> Project = [select id, Name, Deal__r.Property__r.Name from Project__c where id in :triggerIds]; for(Deal__c deal : Trigger.new) { if( deal.Type__c == 'New' ) Project.add(new Project__c ( Name = deal.Property__r.Name, // this field is giving ID instead of Name Property__c = deal.Property__c // This field is giving correct update. ) ); } insert Project; }
- Doondi
- November 12, 2018
- Like
- 0
- Continue reading or reply
tablesorter not sorting $ values properly and reading digits as wrong
Hi,
I am Using TableSorter and it's not sorting $ values properly,
Any suggestion would be a great help.
Here is my Js code:
This is my Pageblocktable code:

I am Using TableSorter and it's not sorting $ values properly,
Any suggestion would be a great help.
Here is my Js code:
<script type="text/javascript"> $j = jQuery.noConflict(); $j(document).ready(function () { $j("[id$=theaddrs]").tablesorter(); }); </script>
This is my Pageblocktable code:
<apex:pageblock mode="details" id="theaddrsblock" > <apex:pageBlockTable value="{!Records}" var="r" styleclass="fixme" id="theaddrs" styleClass="tablesorter" headerClass="header"> <apex:column value="{!r.Units__c}"></apex:column> <apex:column value="{!r.Annual_Sale__c}" ></apex:column> <--10 more colomns here; which are sorting perfectly--> </apex:pageBlockTable> </apex:pageblock>This is the output am getting :
- Doondi
- October 24, 2018
- Like
- 0
- Continue reading or reply
Prepopulating Field Values on Related list
Hi, I wanted to know how I can prepopulate the Lookup values.
There are two custom objects (school__c and student__c) having master detail relationship to Opportunities.
This is my button code:
I want student__c also to be pre populated.
There are two custom objects (school__c and student__c) having master detail relationship to Opportunities.
This is my button code:
<button class="slds-button slds-button_neutral"> <apex:outputLink value="!URLFOR($Action.Opportunity.New,null)}"> Add </apex:outputLink> </button>When I click on add, by default I am getting only School__c as prepopulated,
I want student__c also to be pre populated.
- Doondi
- September 27, 2018
- Like
- 0
- Continue reading or reply
lightning:tile in 2 columns
Hello Helpers
I am playign with component Lightning:tile and trying to display some records(retrieved from Opportunities and related Account) in tiles
I am able to do this but the tiles are in 1 column
I would like to have 2 columns
This is what I have now.

The information I want to display are stored in a 2 dimensional strign array (v.mydataLst in my code)
The columns are in a separate string array
I am using a couple of aura:iteration to fetch the array data items and the column headers but it does not looks as I would like to look
Any advice?
Thanks in advance
Csaba
<aura:iteration items="{!v.mydataLst}" var="records" >
<div id="Tilu" class="slds-size_1-of-2 slds-box">
<lightning:tile label="{!records[0]}">
<aura:set attribute="media">
<lightning:icon iconName="standard:groups"/>
</aura:set>
<aura:iteration items="{!v.mycolumnsLst}" var="col" indexVar="colCount">
<aura:if isTrue="{!(colCount > 0)}">
<aura:iteration items="{!records}" var="recItem" indexVar="rowcount">
<aura:if isTrue="{!(rowcount == colCount)}">
<dl class="slds-dl_horizontal" >
<dt class="slds-dl_horizontal__label">
<p class="slds-truncate" >{!col.label}:</p>
</dt>
<dd class="slds-dl_horizontal__detail slds-tile__meta">
<p class="slds-truncate" >{!recItem}</p>
</dd>
</dl>
</aura:if>
</aura:iteration>
</aura:if>
</aura:iteration>
</lightning:tile>
</div>
I am playign with component Lightning:tile and trying to display some records(retrieved from Opportunities and related Account) in tiles
I am able to do this but the tiles are in 1 column
I would like to have 2 columns
This is what I have now.
The information I want to display are stored in a 2 dimensional strign array (v.mydataLst in my code)
The columns are in a separate string array
I am using a couple of aura:iteration to fetch the array data items and the column headers but it does not looks as I would like to look
Any advice?
Thanks in advance
Csaba
<aura:iteration items="{!v.mydataLst}" var="records" >
<div id="Tilu" class="slds-size_1-of-2 slds-box">
<lightning:tile label="{!records[0]}">
<aura:set attribute="media">
<lightning:icon iconName="standard:groups"/>
</aura:set>
<aura:iteration items="{!v.mycolumnsLst}" var="col" indexVar="colCount">
<aura:if isTrue="{!(colCount > 0)}">
<aura:iteration items="{!records}" var="recItem" indexVar="rowcount">
<aura:if isTrue="{!(rowcount == colCount)}">
<dl class="slds-dl_horizontal" >
<dt class="slds-dl_horizontal__label">
<p class="slds-truncate" >{!col.label}:</p>
</dt>
<dd class="slds-dl_horizontal__detail slds-tile__meta">
<p class="slds-truncate" >{!recItem}</p>
</dd>
</dl>
</aura:if>
</aura:iteration>
</aura:if>
</aura:iteration>
</lightning:tile>
</div>
- Matyas Csaba
- March 07, 2018
- Like
- 0
- Continue reading or reply
How to show the list of records in Tiles format with 2 colums instead of dataTable
I have displayed the records in Tiles format. However, I am unable to show the tiles in 2 columns. Below is the Component and the attachment. Any suggestions please?

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" controller="OppRelatedListApex">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="oppty" type="Opportunity" />
<aura:attribute name="opportunities" type="opportunity[]" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler name="init" value="{!this}" action="{!c.createItems}" />
<aura:attribute name="actions" type="Aura.Action"/>
<article class="slds-card_boundary">
<div class="slds-card__header slds-grid">
<header class="slds-media slds-media_center slds-has-flexi-truncate">
<div class="slds-media__figure">
<lightning:icon iconName="standard:opportunity" size="small" />
</div>
<div class="slds-media__body">
<h2>
<a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Open Opportunities">
<span class="slds-text-heading_small">Open Opportunities</span>
</a>
</h2>
</div>
</header>
<div class="slds-no-flex">
<ui:button label="New" press="{!c.createRecord}"/>
</div>
</div>
<div class="slds-card__body">
<aura:iteration items="{!v.opportunities}" var="opp" >
<ul class="slds-card__body_inner slds-grid slds-wrap slds-grid_pull-padded ">
<li class="slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3">
<article class="slds-tile slds-media slds-card__tile slds-hint-parent">
<div class="slds-media__figure">
<lightning:icon iconName="standard:opportunity" size="small"/>
</div>
<div class="slds-media__body">
<div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
<h3 class="slds-tile__title slds-truncate" title="{!opp.Name}"><a href="{!'/one/one.app?#/sObject/'+ opp.Id + '/view'}" target="_blank">{!opp.Name}</a></h3>
</div>
<div class="slds-tile__detail">
<dl class="slds-list_horizontal slds-wrap">
<dt class="slds-item_label slds-text-color_weak slds-truncate" title="Opportunity Name">Name:</dt>
<dd class="slds-item_detail slds-truncate" title="Opportunity Name">{!opp.Name}</dd>
<dt class="slds-item_label slds-text-color_weak slds-truncate" title="Opportunity Stage">Stage:</dt>
<dd class="slds-item_detail slds-truncate" title="Opportunity Stage">{!opp.StageName}</dd>
</dl>
</div>
</div>
</article>
</li>
</ul>
</aura:iteration>
</div>
<footer class="slds-card__footer"> View All </footer>
</article>
</aura:component>
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" controller="OppRelatedListApex">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="oppty" type="Opportunity" />
<aura:attribute name="opportunities" type="opportunity[]" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler name="init" value="{!this}" action="{!c.createItems}" />
<aura:attribute name="actions" type="Aura.Action"/>
<article class="slds-card_boundary">
<div class="slds-card__header slds-grid">
<header class="slds-media slds-media_center slds-has-flexi-truncate">
<div class="slds-media__figure">
<lightning:icon iconName="standard:opportunity" size="small" />
</div>
<div class="slds-media__body">
<h2>
<a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Open Opportunities">
<span class="slds-text-heading_small">Open Opportunities</span>
</a>
</h2>
</div>
</header>
<div class="slds-no-flex">
<ui:button label="New" press="{!c.createRecord}"/>
</div>
</div>
<div class="slds-card__body">
<aura:iteration items="{!v.opportunities}" var="opp" >
<ul class="slds-card__body_inner slds-grid slds-wrap slds-grid_pull-padded ">
<li class="slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3">
<article class="slds-tile slds-media slds-card__tile slds-hint-parent">
<div class="slds-media__figure">
<lightning:icon iconName="standard:opportunity" size="small"/>
</div>
<div class="slds-media__body">
<div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
<h3 class="slds-tile__title slds-truncate" title="{!opp.Name}"><a href="{!'/one/one.app?#/sObject/'+ opp.Id + '/view'}" target="_blank">{!opp.Name}</a></h3>
</div>
<div class="slds-tile__detail">
<dl class="slds-list_horizontal slds-wrap">
<dt class="slds-item_label slds-text-color_weak slds-truncate" title="Opportunity Name">Name:</dt>
<dd class="slds-item_detail slds-truncate" title="Opportunity Name">{!opp.Name}</dd>
<dt class="slds-item_label slds-text-color_weak slds-truncate" title="Opportunity Stage">Stage:</dt>
<dd class="slds-item_detail slds-truncate" title="Opportunity Stage">{!opp.StageName}</dd>
</dl>
</div>
</div>
</article>
</li>
</ul>
</aura:iteration>
</div>
<footer class="slds-card__footer"> View All </footer>
</article>
</aura:component>
- sudarshan Reddy 25
- November 27, 2017
- Like
- 0
- Continue reading or reply
Free Salesforce SSIS connector for SQL server or Auto schduled salesforce data export
HI All,
I am looking for tool which will solve my problem, my problem is i need to auto export salesforce data from few tables on schedule time so is their any such option from in salesforce or a tool which will support this.
I am looking for tool which will solve my problem, my problem is i need to auto export salesforce data from few tables on schedule time so is their any such option from in salesforce or a tool which will support this.
- RF Systems Support
- February 10, 2015
- Like
- 0
- Continue reading or reply