• sachin kadian 5
  • SMARTIE
  • 554 Points
  • Member since 2015

  • Chatter
    Feed
  • 14
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 5
    Questions
  • 110
    Replies
One is a condition another one is Apex function, how to put them in one rendered:-
1. rendered="{!massEdit}"
2.rendered="{!IF(selectedProductLine.item.RecordTypeId = ICRecTypeId),true,false )}"

This Syntax not working:-
rendered="{!IF(((selectedProductLine.item.RecordTypeId = ICRecTypeId)&&(!massEdit)),true,false )}"
Even I tried with AND OR Operator not working. I need to render a section on picklist value change for the same, so i have to put the two condition in one rendered.
Hi,

I have two objects Account, and abc_and_sale_summary__c. I am trying to implement before update trigger on Account which will update values in abc_and_sale_summary__c.

Account has fields club__c(text), created_date__c, and down_payment__c(text later converted to decimal).
abc_and_sale_summary__c has fields ABC_Down_payment__c, club__c, and date__c.

My trigger on account will update down_payment__c field with value from down_payment__c field.

for example: Account A for club vancouver, date mar 07 has down_payment__c of $100.
Account B for club vancouver, date mar 07 has down_payment__c of $50.
Account C for club vancouver, date mar 07 has down_payment__c of $150.

Trigger will update existing record in abc_and_sale_summary__c for club vancouver and date mar 07. Value of ABC_Down_payment__c should be $300.


Code of update trigger. Right now, it is not updating the ABC_Down_payment__c field. Please help me point out the problem in logic.
List<ABC_and_Sale_Summary__c> abc= New List<ABC_and_Sale_Summary__c>();
    Map<Id, ABC_and_Sale_Summary__c> abcMap= New Map<Id, ABC_and_Sale_Summary__c>();

if(Trigger.isUpdate ){
        ABC_and_Sale_Summary__c abc2= New ABC_and_Sale_Summary__c();
        List<ABC_and_Sale_Summary__c> abc3= New List<ABC_and_Sale_Summary__c>();
        
        abc3 = [Select id, club__c, date__c, sale_Summary_Revenue__c, ABC_Down_payment__c from ABC_and_Sale_Summary__c];

        for(ABC_and_Sale_Summary__c abc_sale: abc3){

        for(integer c = 0; c < Trigger.Old.size(); c++){
            Date d = date.newinstance(Trigger.New[c].created_date__c.year(), Trigger.New[c].created_date__c.month(), Trigger.New[c].created_date__c.day());
	    	Date d2 = date.newinstance(Trigger.Old[c].created_date__c.year(), Trigger.Old[c].created_date__c.month(), Trigger.Old[c].created_date__c.day());
			
            
                if((abc_sale.club__c == Trigger.Old[c].club__c) && (abc_sale.date__c == d2))
				{
                    system.debug(abc_sale.Id);
					String dp = Trigger.New[c].Down_Payment__c;
            
					if(dp.contains('$')){
						dp = dp.substring(1);
					}
					
					Double downpayment = Decimal.valueOf(dp);
            
					
						String dpold = Trigger.Old[c].Down_Payment__c;
						if(dpold.contains('$')){
							dpold = dpold.substring(1);
						}
						
						Double downpaymentold = Decimal.valueOf(dpold);
						
						double diff = downpayment - downpaymentold;
                    	if(abc_sale.ABC_Down_payment__c ==null){abc_sale.ABC_Down_payment__c = 0;}
						abc_sale.ABC_Down_payment__c = abc_sale.ABC_Down_payment__c + diff;
						
						abc.add(abc_sale);
                        
				}	
			}	
        }
        abcMap.putAll(abc);
            update abcMap.values();
    }

this code is working for single insert/update of record. But, it is not working in case of mass upsert.

I have a process builder which invokes the Apex class. This Apex sends out an email to the Contact. The attachment of the Email is a VF page which gets the list of line items.
The issue here is that I would like to capture the record id of the record invoked by Process Builder and pass it on all the way to the VF page.
Any sample code or ideas would greatly help
  • March 26, 2018
  • Like
  • 0
Hi all.

I have a lightning component where i am using lightning:listview. Below is the code.

I want to fix the header of the listview. How can i achieve this?

 <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >     
    <lightning:listView aura:id="listViewAccounts"
    objectApiName="object__c"
    listName="Default"
    rows="20"
    showActionBar="true"
    enableInlineEdit="false"
    showRowLevelActions="true"
/>        
</aura:component>

Thanks
I have a user that would like to have his email templates refer to a contact by their Nickname-unless that field is blank.  In which case, refer to them as the Contact First Name.  I've tried this format, but it's not working...

{!if(Contact.Nickname_Alias__c ="", Contact.FirstName,) Contact.Nickname_Alias__c }
 
Hello,

I have a Lightning component on my opportunity page that does the following:
  • When clicking on the button, it opens a Lightning modal box
  • This modal box display a Visualforce page, renderas PDF, inside an iframe.
  • I have two button bellow: Cancel, Save
The purpose is to generate and save a PDF to the current record. the modal box allows to preview the document before saving attach it.

-> My issue is: how to save the PDF generated by the Visualforce page, and attach it to the Opportunity?
Any ideas?

demoModal.cmp:
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
  <!--use boolean attribute for Store true/false value,
    make default to "false" so modal box are not display on the load of component. 
    --> 
    
    <aura:attribute name="recordId" type="Id" />

  <aura:attribute name="isOpen" type="boolean" default="false"/>
 
  <!--Use "slds-m-around- -xx-large" class to add standard Large padding to the component--> 
  <div class="slds-m-around--xx-large">
    <button class="slds-button slds-button--brand" onclick="{!c.openModel}">Create a document</button>  
    
  <!--Use aura:if tag to display Model Box, on the bese of conditions. [isOpen boolean attribute] -->   
    <aura:if isTrue="{!v.isOpen}">
      
   <!--###### MODAL BOX Start From Here ######--> 
      <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
        <div class="slds-modal__container">
          <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
          <div class="slds-modal__header">
            <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
            X
            <span class="slds-assistive-text">Close</span>
            </button>
            <h2 id="header99" class="slds-text-heading--medium">Your document</h2>
          </div>
          <!--###### MODAL BOX BODY Part Start From Here ######-->
            <iframe src="{! '/apex/monpdf?Id='+v.recordId}" width="100%" height="500px;" frameBorder="0"/>
          <div class="slds-modal__content slds-p-around--medium">
            <p><b>Some random text.
              </b>
            </p>
          </div>
          <!--###### MODAL BOX FOOTER Part Start From Here ######-->
          <div class="slds-modal__footer">
            <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
            <button class="slds-button slds-button--brand" onclick="{!c.savenClose}">Save the document</button>
          </div>
        </div>
      </div>
      <div class="slds-backdrop slds-backdrop--open"></div>
      <!--###### MODAL BOX Part END Here ######-->
    
 </aura:if>
  </div>
</aura:component>

monpdf.vfp:
<apex:page standardController="Opportunity" showHeader="false" renderAs="pdf">
{!Opportunity.Account.Name}
</apex:page>

demoModalController.js
({
   openModel: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"
      component.set("v.isOpen", true);
   },
 
   closeModel: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpen", false);
   },
 
   savenClose: function(component, event, helper) {
      // Display alert message on the click on the button from Model Footer 

      
       alert('It works');
      component.set("v.isOpen", false);
   },
})

 
if suppose i had created Two fields on main page 1)Enter an Area   2)Find the Restaurents.

Now we clickon Enter an area Some values are Shown,click on That Value,,,,
After we go for click on  Find the restaurents .....To display the restaurents page.


pls tel me
Hi,
How custom labels can be used in the picklist. While creating a picklist field, can we directly refer the values from the Custom labels?. I know about the translation settings, but what I want, I don't want the picklist values to be hardcoded, since the picklist value is referred in Apex coding in multiple place. And Hence, a change in Picklist means, I have change every where in the code. What is the best solution to such scenario?
 

Hi,

  I need a suggestion this is do able or not in salesforce In opportunity we created a field called Billing Email which is a email field. We want this field to be pre fill if Account Billing email field has value. Still if user over writes opportunity Billing email it should update both in opportunity and account field please suggest me can we implement if not please advive an alternative way to do.

Thanks

Sudhir

I want to get all the product associated with an order. like shown in order product related list. how can i do This.
Need urgent help thanks in advance.
Hi all,
 
  I have a scenario  asked in interview, list is loaded with all the countrys, now question is , in the list first need to show UK, US and after that display sorted list of countrys

can any one help how to achive it?

Thanks
 
Hi All I have a futre class and I have written a test class for the same which is passing but the parent class is just not covering any percent. Can some one hellp. Below is class and the test class.

Class
global class ABfutureclass {
   
  
    @future
    public static void createABdetails(){
          string timePSetName=Label.Time;
       PermissionSet timePSet =[SELECT Id,IsOwnedByProfile,Label FROM PermissionSet where Name=:timePSetName limit 1];
        Id myID2 = userinfo.getUserId();
        string permissionsetid = timePSet.id; 
        List<PermissionSetAssignment> lstPsa = [select id from PermissionsetAssignment where PermissionSetId =: permissionsetid AND AssigneeId =:myID2];
    
        if(lstPsa.size() == 0)
        {
            PermissionSetAssignment psa1 = new PermissionsetAssignment(PermissionSetId= permissionsetid, AssigneeId = myID2 );
            database.insert(psa1);
        }
    }

}



Test Class

@isTest
public class ABfutureclasstest {
    
    public static testMethod void createABdetails(){
        test.startTest();
        Profile Profile1 = [SELECT Id, Name FROM Profile WHERE Name = 'Basic Profile'];
       
     
      User u = [SELECT Id FROM User WHERE ProfileId =:Profile1.Id AND isActive = true LIMIT 1];
        PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name =: Label.Time];
        system.runAs(u){
   PermissionSetAssignment psa = new PermissionSetAssignment();
        psa.AssigneeId = u.Id;
        psa.PermissionSetId = ps.Id;
        insert psa;
        }
        test.stopTest();
    }

}
  • November 19, 2015
  • Like
  • 0
Hello,

I have below trigger
trigger temp on test__c (before update, before insert) {
    String one= '';
    Id two;
    for (test__c obj : Trigger.new) {
        one = obj.Custom__r.one__c ;
        two = obj.Id;
        System.debug(one); //null
        System.debug(two); // has a Id
        System.debug(obj); // Custom__r gives a Id
    }
}
I am trying to get the "obj.Custom__r.one__c", this value is present but its alwys showing as null

Thank you for suggestion !
  • November 19, 2015
  • Like
  • 0

public with sharing class Active {
    public PageReference fts() {
       return Network.communitiesLanding();
    }
    public Active() {}
}
Need 100% Code coverage
I am trying to solve the trailhead superbadge "Lightning Experience Rollout Specialist " challenge 2 . This challenge is to convert existing vf page "AccountsTab" to lightning .   

Here is my code - 
<apex:page standardController="Account" recordSetVar="accounts" applyHtmlTag="false" applyBodyTag="false" showHeader="false" >
    <apex:slds> </apex:slds>
    <body class="slds-scope">
        <table class="slds-table slds-table_bordered slds-table_cell-buffer">
            <thead>
            <tr class="slds-text-title--caps">
              <th scope="col">
                Name 
              </th>
              
            </tr>
          </thead>
                    
            <tbody>
                <apex:repeat value="{!accounts}" var="a">
                    <tr>
                        <td ><apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink> </td>
                    </tr>
                    
                </apex:repeat>
                
            </tbody>
            
        </table>
    </body>
    
</apex:page>



But i am getting the error below - 

User-added image

Any help will be really appreciated.

Thanks
HI,

I created one chrome extension and i am trying to upload one attachment to a record using forcetk. Here is my content script - 
 
function getValueFromCookie(b) {
    var a, c, d, e = document.cookie.split(";");
    for (a = 0; a < e.length; a++)
        if (c = e[a].substr(0, e[a].indexOf("=")), d = e[a].substr(e[a].indexOf("=") + 1), c = c.replace(/^\s+|\s+$/g, ""), c == b) return unescape(d)
}

var showingApi = false;
var keyPrefixToObjName = new Object();
chrome.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {
	var sendResponse = sendResponse;
	var client = new forcetk.Client();
	client.setSessionToken(getValueFromCookie("sid"));
	console.log(getValueFromCookie("sid"));
	if(request.queryString == 'getCurrentPageFields'){
		console.log('==inside==');
		var file = request.fileToUpload;
		console.log(file);
		//$('input[id$="_Id"]').each(function(){
			// var pId = $(this).val();
			// console.log(pId);
			 client.createBlob('Attachment', {'parentId': '0012800000VNnuV','Name': 'testImg','ContentType': 'image/jpeg'},'test from tk', 'Body',file,function(response){
				console.log(response);
				console.log(response.id);
			}, function(request, status, response){
				$("#message").html("Error: " + status);
			});
		 //})
		 
		 
	}
	
    // Needed so the callbacks can return a response when they complete
    return true;
  });

Now the thing is, if i am running this extension from any standard page or home page of salesforce, it is running fine and creating the Attachement but if i am on a visualforce page and trying to run this extension, i am getting 401(unauthorized) error. I am adding both the screenshots. Any help would be great here.

Screeshot from standard page - 
User-added image 

From VF Page - 

User-added image

Thanks,
Hi,

I have one situation in my code where i need a list or Map of records as well as sum of a fields from them. What is the best way to achieve this? i can think 2 ways
1) Use 1 SOQL query to get the Map of records and 1 aggregate query to get the sum of field OR
2) Use 1 SOQL query only to get the record, the loop through them and get the some of field using some variable

In approach first, i think i will have to use 1 extra query and in 2nd approrach, if number of records are more, i could take longer time. 
I am confused which approach i should use. Any suggestions would be great. 

Thanks,
HI,
I want to override view button(Standard detail page) for certain profiles but not for all. What is the standard way to override? I am thinking to use nooverride=1 but not sure if it is a URL hack or standard way. Any help would be appreciated.

Thanks,
Hi,

I am Salesforce Developer with 3.2 years of experience and with following Certificates-

1) Salesforce Certified Advanced Developer
2) Salesforce Certified Plateform Developer 1
3) salesforce certified Developer
4) Salesforce Certified Sales Cloud Consultant
5) Salesforce Certified Service Cloud Consultant

Currently working in Dubai but ready to move anywhere across world. If anyone have any suitable opening for me, please contact me sachin.kadian@gmail.com or +971551321466.

Thanks
Hi,

I am Salesforce Developer with 3.2 years of experience and with following Certificates-

1) Salesforce Certified Advanced Developer
2) Salesforce Certified Plateform Developer 1
3) salesforce certified Developer
4) Salesforce Certified Sales Cloud Consultant
5) Salesforce Certified Service Cloud Consultant

Currently working in Dubai but ready to move anywhere across world. If anyone have any suitable opening for me, please contact me sachin.kadian@gmail.com or +971551321466.

Thanks
Hi Everyone,

I have a requreiment like
> I have object database
> when I click on the tab of data base, it needs to display the 3 buttons such as db1, db2, db3.
when I click on the respective buttons it should navigate to respective pages.
Could anyone please guide the steps to follow.
 
Hi,

I'm looking for an easy way to change the object's recordtype via a button or something in Lightning.

any suggestion? 

Regards,
Arezou
 
Hi Guys,

I should create a Visualforce page by using SLDS with a dropdown list having all the custom list view names and a table which display the record's of the selected list view.

I have created the basics of VF page with SLDS but, not able to append the List view to dropdown and display the related list view records in a table.

Below is my code. Your help is highly appreciated.

VF Page:

<apex:page controller="example" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">    
<apex:form>
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">    

<head>
  <title>Salesforce Lightning Design System Trailhead Module</title>
  <apex:stylesheet value="{!URLFOR($Resource.SLDS100, 'styles/salesforce-lightning-design-system.css')}" />
</head>    

<body>    

  <!-- REQUIRED SLDS WRAPPER -->
  <div class="slds">    

    <!-- MASTHEAD -->
    <p class="slds-text-heading--label slds-m-bottom--small">Salesforce Lightning Design System Module</p>
    <!-- / MASTHEAD -->    

   <!-- PAGE HEADER -->
<div class="slds-page-header" role="banner">

  <!-- LAYOUT GRID -->
  <div class="slds-grid">

    <!-- GRID COL -->
    <div class="slds-col">

      <!-- HEADING AREA -->
      <p class="slds-text-heading--label">Accounts</p>
      <h1 class="slds-text-heading--medium">My Accounts</h1>
      <!-- /HEADING AREA -->

    </div>

    <!-- GRID COL -->
    <div class="slds-col slds-no-flex slds-align-middle">

      <div class="slds-button-group" role="group">
        <button class="slds-button slds-button--neutral">
          New Account
        </button>
        <button class="slds-button slds-button--neutral">
          More
        </button>
      </div>

    </div>
    <!-- / GRID COL -->

  </div>
  <!-- / LAYOUT GRID -->

  <p class="slds-text-body--small slds-m-top--x-small">COUNT items</p>

</div>
<!-- / PAGE HEADER -->  

<!-- PRIMARY CONTENT WRAPPER -->
<div class="slds-form-element">
    <label class="slds-form-element__label">Account Type</label>
    <div class="slds-form-element__control">
        <div class="slds-select_container">
            <apex:selectList value="{!selectedVal}" size="1"> 
    <apex:selectOption value="{!list}" /> 
</apex:selectList>
        </div>
    </div>
</div>
      
<!-- / PRIMARY CONTENT WRAPPER -->   

<!-- FOOTER -->
<footer role="contentinfo" class="slds-p-around--large">
  <!-- LAYOUT GRID -->
  <div class="slds-grid slds-grid--align-spread">
    <p class="slds-col">Salesforce Lightning Design System Example</p>
    <p class="slds-col">&copy; Your Name Here</p>
  </div>
  <!-- / LAYOUT GRID -->
</footer>
<!-- / FOOTER -->

  </div>
  <!-- / REQUIRED SLDS WRAPPER -->    

</body>    

<!-- JAVASCRIPT -->
<!-- / JAVASCRIPT -->    

</html>
    </apex:form>
</apex:page>

APEX Controller:

Public class example {
    
public String selectedVal{get;set;}  // This will hold the selected value, the id in here

public List<SelectOption> getlist(){
      
        List<SelectOption> optns = new List<SelectOption>();
        // before getting here you must populate your queryResult list with required fields
        for(SelectOption lstObj : [SELECT Id, Name FROM Listview WHERE SobjectType = 'Request__C' order by name ASC]){
            optns.add(new SelectOption (lstObj.Name));
        }
        return optns;
}
    }


Please Note : The requirement is creating the VF ONLY with SLDS.
  • March 27, 2018
  • Like
  • 0
Hi,

Document says:
Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.

I am confused that the class means all test classes in org or only the test class which contains @testSetup if I run all test classes.

I didn't find the details.
Anyone can explain this to me?

Thanks.
Ying

Hello EveryOne,
                           I have two objects Standard(Child) and custom object (Parent) i want to create a visual force page that includes fields from both parent and child objects , Now when i select Look up field Name (ex:parent record) as some abc in vf page the details(other fields) of abc record is to be auto populated in the vf page (i am trying to create Vf Page on Child object) , i need this functionality either in lightning experience(using lightning components) or Visual force page  ,please help me.
Thank you Every One.

One is a condition another one is Apex function, how to put them in one rendered:-
1. rendered="{!massEdit}"
2.rendered="{!IF(selectedProductLine.item.RecordTypeId = ICRecTypeId),true,false )}"

This Syntax not working:-
rendered="{!IF(((selectedProductLine.item.RecordTypeId = ICRecTypeId)&&(!massEdit)),true,false )}"
Even I tried with AND OR Operator not working. I need to render a section on picklist value change for the same, so i have to put the two condition in one rendered.
Hi all,
We are creating a custom case form using lightning:recordEditForm and lightning:inputField. The form is generated off of a fieldset here;
<lightning:recordEditForm aura:id="test"
                              objectApiName="{! v.sObjectName }"
                              recordId="{! v.recordId }"
                              recordTypeId="{! v.recordTypeId }">
        <lightning:messages />

        <aura:iteration items="{! v.fields }" var="field">
            <lightning:inputField aura:id="caseField" fieldName="{! field.APIName }" class="slds-p-top_small slds-m-top_medium"/>
        </aura:iteration>
        
        <lightning:button class="slds-m-top_small" type="submit" label="Save" /></lightning:recordEditForm>
The fieldset is passed correctly with all the correct information. The desired result comes through ok hosted in an App here;
User-added image

The issue is when the component is placed in a community, the HTML generated has the fields as 'disabled';
User-added image
We cannot seem to find a permission in the Guest user profile that would cause this. Case is Read/Create, all fields on Case are Read/Edit Access, and all Record Types have been made available. None of the fields in the field set have been set to Read-Only.

Perplexed as to why this is happening, and can't seem to find a lot of documentation surrounding the new lightning:recordEditForm.

Appreciate any input.
Thanks,
I'm trying to remove line breaks and white spaces in Rich Text Area field when Text Area is not containing any words or characters.I'm doing this by using workflow.I used "^[\\s<>br]+$"  regex,but this is not satisfield in Rule criteria.
Any one can suggest the correct regex to do this?

Thanks in advance
Looking for Salesforce Job having 3 years of experience in salesforce  with certifications (Salesforce Certified Platform Developer I,Salesforce Certified Platform Developer II(first Level),Salesforce Certified Administrator,Salesforce Certified Service Cloud Consultant,Salesforce Certified Force.com Developer)(Immediately Available). 

Thanks & Regard,

(+971 - 554315139)
I was wondering how to share badges on linkedin that I've already earned. I know when I complete a module, I am prompted to share future badges but is there no way to share ones I have to date? I had not synced up my linkedin account to trailhead and now wish to display the badges. I would prefer not to just share a URL of my profile. 

Thanks