• Doondi
  • NEWBIE
  • 80 Points
  • Member since 2017
  • Sr.Salesforce Developer
  • VRSainyam Technology Solutions Private L

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 28
    Questions
  • 63
    Replies
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
User-added image
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)
Links


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? 
Hi below is my Simple Trigger and Test classes.
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;
    	        }

 
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.
 
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. 
 
Trigger
 
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;
	}}}

 
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
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;
    }

 
Hi,
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 :
sorting
​​​​​​​
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:
<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. 
 
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.
User-added image

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 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?

User-added image

<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>
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.