• GulshanRaj
  • SMARTIE
  • 758 Points
  • Member since 2017


  • Chatter
    Feed
  • 23
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 147
    Replies
Hi,
How can I create a  visualforce page that replicates the list view of my custom object records, and the functionality of being able to select a record and then use the action button to add a New Competitor to this record and to populate the record that I have selected. Please see below.

User-added image

User-added imageI have create numerous visualforce pages in an attempt to replicate this functionality (where the Division is pulled through to the form) but nothing seems to be working. The Division is the master and the Competitor is the child in the master-detail relationship of the field "Division".

Thanks
Hi Gurus,

Please provide me a test class for below look up class
 
/**
* Class used to serialize a single Lookup search result item
* The Lookup controller returns a List<LookupSearchResult> when sending search result back to Lightning
*/
public class LookupSearchResult {

    private Id id;
    private String sObjectType;
    private String icon;
    private String title;
    private String subtitle;

    public LookupSearchResult(Id id, String sObjectType, String icon, String title, String subtitle) {
        this.id = id;
        this.sObjectType = sObjectType;
        this.icon = icon;
        this.title = title;
        this.subtitle = subtitle;
    }

    @AuraEnabled
    public Id getId() {
        return id;
    }

    @AuraEnabled
    public String getSObjectType() {
        return sObjectType;
    }

    @AuraEnabled
    public String getIcon() {
        return icon;
    }

    @AuraEnabled
    public String getTitle() {
        return title;
    }

    @AuraEnabled
    public String getSubtitle() {
        return subtitle;
    }
}

Regards,
Fiona​​​​​​​
    @auraEnabled
    Public static List<string> invokeWebServiceString ssnumber) {
        String [] arrayOfResponsestrings = new List<String>();

        for(String num : ssnumber.split(',')){          
            ResponseWrapper APIResponse = InvokeAPI.invokeRespAPI(num);
            arrayOfResponsestrings.add(JSON.serialize(APIResponse ));
            System.debug('arrayOfResponsestrings :'+arrayOfResponsestrings);
        }
        for(Integer i=0 ;i<arrayOfResponsestrings.size() ; i++) {
        }
        return arrayOfResponsestrings;
    } 
  • September 30, 2018
  • Like
  • 0
The recordEditForm and recordViewForm, while not supported in Lightning Out, do work apart from two errors, neither of which appear to affect the functionality.

Is there any way of preventing these error from displaying so that we can use these components?

The steps to reproduce this: https://github.com/paulroberttaylor/lightning-out-recordeditform
  • March 11, 2018
  • Like
  • 0
Hi,

This should be pretty basic,
I have a vf page to display the value of the name field of a record in a custom object called 'Certification_Accredited_Centres__c'
I also have a controller that the vf page uses.

The URL passes a paramater 'centreId' which is the id of the record I am trying to get the name value of.

At the moment all I am getting on the vf page is "Assesments taken at      " <-- the string is blank

VF Page (not complete)
<apex:page controller="AddingAssessmentsController>
<h3>
<apex:outputText value="Assesments taken at {!asscen}"/>
</h3>
</apex:page>
Controller (not complete)
public class AddingAssessmentsController {

    public Id centreId;
    
    public String asscen{get;set;}
    
    public AddingAssessmentsController(){
        centreId = ApexPages.currentPage().getParameters().get('centreId');
        String asscen = [SELECT name from Certification_Accredited_Centres__c WHERE id =: centreId].name;
    }
}

Please can someone tell me why the {!asscen} is blank in the vf page?

Thanks
Joe 
 
I am taking quantity of product in this field and storing number of quantity.its showing up down arrow..but on down arrow its going below 0 i.e -1,-2... so i dnt want values below 0.how do i restrict it????
public with sharing class expensesLineItem{
    public final Expense_Line_Item__c el;
    
    public expensesLineItem(ApexPages.StandardController stdController){
        this.el = (Expense_Line_Item__c)stdController.getRecord();
    }
    public PageReference Dismiss(){
        el.Display_Alert__c=false;
        update el;
        PageReference page = ApexPages.currentPage();
        page.setRedirect(true);
        return page;
    }
}


Test class:

@isTest
public class expensesLineItem_Test{
  @testSetup
  static void setupTestData()
  {
    Expense__c exp = new Expense__c();
    exp.Period_From__c = system.today();
    exp.Period_To__c =system.today();
    insert exp;
    System.assertNotEquals(null, exp.Id); 
    
    Expense_Line_Item__c expLine = new Expense_Line_Item__c();
    expLine.Name = exp.Id;
    expLine.Expense_Head__c='Food' ;
    expLine.Cost_Head__c= 'Campaign' ;
    expLine.Amount__c= 10000;
    System.assertNotEquals(null, expLine.Id);
    insert expLine;
 }
  
  @isTest 
  static void testCall()
  {
    Expense_Line_Item__c expLine  =  [SELECT Id,Name,Amount__c,Bill_Available__c,Cost_Head__c,Expense_Head__c,Expense__c from Expense_Line_Item__c][0];
   // System.assertEquals(true,expense_line_item_Obj.size()>0);
   // List<Expense__c> expense_Obj  =  [SELECT Id from Expense__c];
    //System.assertEquals(true,expense_Obj.size()>0);
    ApexPages.StandardController stdCon = new ApexPages.StandardController(expLine);
    expensesLineItem obj01 = new  expensesLineItem(stdCon);
    
    //expensesLineItem obj01 = new expensesLineItem(new ApexPages.StandardController(expense_line_item_Obj[0]));
    obj01.Dismiss();
  }
}
I'm trying to create a validation rule that requires a custom opportunity field to be populated (look up field) before being able to add a specific discount product to the opportunity. Is this possible? 

AND(
  ISBLANK(Ambassador_Referral__c),
  TEXT(Product2.ProductCode, 'REFDISCOUNT')
)

Error: Field Product2 does not exist. Check spelling.

i want to test a contoller class using Apex Message passed by the controller on the Vf page 

But i am not able to get any result as pageMessages comes null 

Any ideas how i can do it ?
 

static testMethod void test_Member(){
        
        //start the test process
        Test.startTest();
        
        Test.setCurrentPage(Page.BankManagement_Login);
        
        TransactionController obj = new TransactionController();
        
        ApexPages.Message[] pageMessages = ApexPages.getMessages();
        //List<Apexpages.Message> pageMessages = ApexPages.getMessages();  
        
        Boolean check=false;

        obj.username='aneesh@gmail.com';
        obj.password='12';
        obj.login();
        System.debug('hello1');
        
        for(ApexPages.Message msg:pageMessages){
          
            if (msg.getDetail().contains('Username Or Password is not valid')) {
                
                check = true;
                
            }else{
                
                check = false;
            }
        }
        
        system.assert(check);

        //Stop the test process
        Test.stopTest();
    }
Greetings all,
I have a visualforce page with an apex:inputfield for ownerid for the record to create a timesheet.  I would like to default the record owner name on the page to the current user (the current user will usually be creating a timesheet for themselves), but give them the ability to change the value in the owner field if they choose.  Currently the field is coming up blank, rather than with the current user.  Please advise.  My code is below.

I'm still pretty new to apex so any help is greatly appreciated. 

My VF page:
<apex:page standardController="Timesheet__c" extensions="PayPeriodExtension">
   
    <apex:form >
            
    <apex:pageBlock title="Select Pay Period">
      <apex:pageMessages /> <!-- this is where the error messages will appear -->

        <apex:pageBlockSection >
                
       	<apex:selectList size="1" required="true" value="{!PayPeriodID}">
          <apex:selectOptions value="{!ActivePayperiods}"></apex:selectOptions>
      	</apex:selectList>
        <apex:inputfield value="{!Timesheet__c.ownerid}"/>	<br/>

        </apex:pageBlockSection>
            <apex:pageBlockButtons >
            <apex:commandButton action="{! save }" value="Save" />        
        	<apex:commandButton action="{! cancel }" value="Cancel" />        
        </apex:pageBlockButtons>      
    </apex:pageBlock>
 </apex:form>
           
</apex:page>
My Controller Extension:
 
public class PayPeriodExtension {
    public ApexPages.StandardController stdCntrlr {get; set;}
    Public List  <Pay_Period__c> PPTemp = new List <Pay_Period__c>(); 
    Public String PayPeriodID {get; set;}
   
    // the contact record you are adding values to
  public Timesheet__c timesheet {
    get {
      if (timesheet == null)
        timesheet = new Timesheet__c ();
        timesheet.OwnerId = UserInfo.getUserId();
        return timesheet;
    }
    set;
  }
	public  PayPeriodExtension(ApexPages.StandardController controller) {
        stdCntrlr = controller;    
  }

   
    public List<SelectOption> ActivePayperiods
    {
        get
        {
            PPTemp = [Select Id, Name, Days_Since_Start_Date__c From Pay_Period__c 
                      Where (Days_Since_Start_Date__c <14 AND days_Since_Start_Date__c >-21) 
                      Order BY Days_Since_Start_Date__c desc ];
            ActivePayPeriods = new List<SelectOption>();
            
            for(Pay_Period__c temp : PPTemp)
            {
                ActivePayPeriods.add(new SelectOption(temp.id, temp.Name));
            }
            return ActivePayPeriods;
        }
        set;
    }
    
    public PageReference save() {
		
    try {
        timesheet.Pay_Period__c = PayPeriodID;
        upsert timesheet; // inserts the new record into the database
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new timesheet.'));
      return null;
    }

    // if successfully inserted new survey, then displays the thank you page.
    return (new ApexPages.StandardController(timesheet)).view();
  }

}



 
Hello,

I want to insert a value in my case field on before insert trigger . I have a static variable in controller whose value Iam initializing in a method in controller and when I access that variable in trigger It is showing "NULL".
and if I initialize the value while declaring then trigger prints the value.
refer the code below:

//this is the class.
public with sharing class Demo{
  public static String test;

public void testMethod(){

   test  = 'hello';


}

//this is the trigger.

trigger TestTrigger on Case (before insert) {
   
    System.debug(Demo.test);  //prints null

}
I´m trying to put a google maps on my standard object "Account" , i´m using the billing adress for the location, the map works fine for a few seconds than it appears this message:
User-added image

The code i´m using for this is:

<apex:page standardController="Account">
<head>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions={ zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP,mapTypeControl: false };
var map;
var marker;
var geocoder = new google.maps.Geocoder();
var address ="{!Account.BillingStreet},{!Account.BillingPostalCode}{!Account.BillingCity}, {!Account.BillingState},{!Account.BillingCountry}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingState}<br>{!Account.BillingCountry}"
});
 
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK&&results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
 
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
 
//center map
map.setCenter(results[0].geometry.location);
 
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}"
});
 
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
 
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes&&iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
Suppose i opened visualforce page , That insert the data into the DataBase. Is it possible in VisualForce?
Hi experts,
I need your help to build a formula as I am stuck here and don't know how to achieve the result that I want.

This is my formula :
if(ISNULL(Benefit_End_Date__c),12,round((Benefit_End_Date__c - Expected_Impact_Date__c),2)/30)
This formula returns 0 when the difference between the 2 dates are less than 30 days, so when there is less than a month.
In that case I would like to return 1. How cvan I do that?
It blocks me to implement a method as each time the result is 0 I get an error from Apex ...
Many thanks in advance for the time you will spend on my issue :)
Ludivine
This formula does not work for entire 24 hour clock in Pacific Time Zone.

CASE(MID ( TEXT (CreatedDate), 12, 2),"01",1," 02",2,"03",3,"04",4,"05",5,"06",6,"07",7,"08",8,"09",09,"10",10,"11",11,"12",12,"13",13,"14",14,"15",15,"16",16,"17",17,"18",18,"19",19,"20",20,"21",21,"22",22,"23",23,"00",00,Null)-(7)
Hey,

Im trying to display maps in a visualforce page but the method that builds the map doesnt seem to be called when i preview my page. I would appreciate some help please :)

Here's my map : 

public map<string,string> getMapFieldLabel(){
        
        //List<string> fieldsLabels = new List<string>();
        List<Custom_Object__c> defaultFields = [Select Name from Custom_Object__c where Default__c=True];
        Map<String, Schema.SObjectField> typeMap = Schema.SObjectType.A_second_Custom_Object__c.fields.getMap();
          
        //Get choosen default fields label    
        for(Custom_Object__c defaultField : defaultFields) {
            
            Schema.SObjectField field = typeMap.get(defaultField.Name);
            string fieldLabel =field.getDescribe().getLabel();
            mapFieldLabel.put(defaultField.Name, fieldLabel);
            //fieldsLabels.add(fieldLabel);
            
            
        }
        system.debug(mapFieldLabel);
        return mapFieldLabel;
        
    }

And my VF code : 

         <apex:pageBlockSection columns="3" collapsible="true">
                
            <apex:repeat value="{!MapFieldLabel}" var="item" >
                    
                    <apex:repeat value="{!MapFieldLabel[item]}" var="itemvalue" >                    
                    <apex:outputText value="{!itemvalue}" />
                    </apex:repeat>
            </apex:repeat>   
            </apex:pageBlockSection>

This code doesnt display anything on screen !

Thank you for your help in advance :)
Hi,

I need help on the following requirement as follows,

I have 2 fields called "Latest date" and "Latest date 1"

I have a formula which would convert a text to a formula text

for eg : March-2017 would be stored as 01/03/2017

it works fine but my issue issue

if "Latest date" which holds March -2017 values if its null

then the next field "latest period date 1" is having some incorrect format like 1/01 which should also be null

help me how tyo fix it

Thanks in Advance
MY FORMULA :


"01/"+CASE(UPPER(LEFT(Latest_Period_Date__c, FIND("-", Latest_Period_Date__c)-1)),
"JANUARY","01",
"FEBRUARY","02",
"MARCH", "03",
"APRIL", "04",
"MAY", "05",
"JUNE","06",
"JULY","07",
"AUGUST","08",
"SEPTEMBER","09",
"OCTOBER","10",
"NOVEMBER","11",
"DECEMBER","12","0")+"/"+RIGHT(Latest_Period_Date__c,4)

 
First Namearpitvikash 
Last Namevijaykumar 
Emailabc@gmail.comabc1@gmail.com 
Phone34543543534435454 
Citynoidadelhi 
    
    
Hi ,

I need help on the following requirement as follows,

I have a text field called "Latest date" which has values in "March -2017" format

I want another formula field to convert the above text to dd/mm/yyyy format


The date can be 1st of every month

I shouldnt make any changes to the existing field and need this functionality in  a new field

Help me how to acheive this

Thanks in Advance
I am creating a lightning component and I'm trying to style the data table using the example in the Lightning Design System documentation. I'm having trouble getting this to render correctly. Any ideas? 

Here is what the example looks like:
Lightning Example - Data Table
Link to example:
https://www.lightningdesignsystem.com/components/data-tables/?variant=base


Here is how mine renders:

User-added image
Here is what I am doing in the Component:
 
<aura:component controller="AddPoliciesApexController" implements="force:LightningQuickAction,force:hasRecordId">
	<aura:attribute name="policies" type="Policy__c[]" />
	<aura:attribute name="addToOpp" type="Boolean" />
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
	<table class="slds-table slds-table_bordered slds-table_cell-buffer slds-table_striped">
	 	<thead>
		    <tr class="slds-text-title_caps">
		      <th scope="col">
		        <div class="slds-truncate" title="Policy Number">POLICY NUMBER</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Effective Date">EFFECTIVE DATE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Expiration Date">EXPIRATION DATE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Coverage Code">COVERAGE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Add to Opp">ADD TO OPP?</div>
		      </th>
		    </tr>
  		</thead>

  	<tbody>
   
    
  </tbody>	
	<aura:iteration items="{!v.policies}" var="pol" >

 	 <tr>
      <th scope="row" data-label="Policy Number">
        <div class="slds-truncate" title="Policy Number">
          <a href="javascript:void(0);">{!pol.Name}</a>
        </div>
      </th>
      <td data-label="Effective Date">
        <div class="slds-truncate" title="Effective Date">{!pol.Effective_Date__c}</div>
      </td>
      <td data-label="Expiration Date">
        <div class="slds-truncate" title="Expiration Date">{!pol.Expiration_Date__c}</div>
      </td>
      <td data-label="Coverage Code">
        <div class="slds-truncate" title="Coverage Code">{!pol.Coverage_Code_Product_Code__c }</div>
      </td>
      <td data-label="Add to Opp">
        <div class="slds-truncate" title="Add to Opp">
        	<ui:inputCheckbox class="slds-form-element" label="Add to Opp?"/>
        </div>
      </td>
    </tr>
	 
	</aura:iteration>
  </table>
	 


</aura:component>


Thanks!!
 
Hi,

Case is always taking up from email address (generated from email-to-case ) even after I am selecting email action from feed action bar. Is that possible it takes logged in user email address instead of taking from email address of the case originaly created from email-to-case.

User-added image

Thanks in advance.
Gulshan Raj

 
Suddenly my developer profile is showing everything in Japanese. Any idea where you change language preference ?




Thanks in Advance.User-added image
Hi,
How can I create a  visualforce page that replicates the list view of my custom object records, and the functionality of being able to select a record and then use the action button to add a New Competitor to this record and to populate the record that I have selected. Please see below.

User-added image

User-added imageI have create numerous visualforce pages in an attempt to replicate this functionality (where the Division is pulled through to the form) but nothing seems to be working. The Division is the master and the Competitor is the child in the master-detail relationship of the field "Division".

Thanks
Hi Gurus,

Please provide me a test class for below look up class
 
/**
* Class used to serialize a single Lookup search result item
* The Lookup controller returns a List<LookupSearchResult> when sending search result back to Lightning
*/
public class LookupSearchResult {

    private Id id;
    private String sObjectType;
    private String icon;
    private String title;
    private String subtitle;

    public LookupSearchResult(Id id, String sObjectType, String icon, String title, String subtitle) {
        this.id = id;
        this.sObjectType = sObjectType;
        this.icon = icon;
        this.title = title;
        this.subtitle = subtitle;
    }

    @AuraEnabled
    public Id getId() {
        return id;
    }

    @AuraEnabled
    public String getSObjectType() {
        return sObjectType;
    }

    @AuraEnabled
    public String getIcon() {
        return icon;
    }

    @AuraEnabled
    public String getTitle() {
        return title;
    }

    @AuraEnabled
    public String getSubtitle() {
        return subtitle;
    }
}

Regards,
Fiona​​​​​​​
1. write a soql query to fetch users whole role is Manager and profile is Executive;
 2.write a soql query to fetch all opportunities which are owned by above users;
A person is entered by a sales rep as a "Contact" in salesforce and sends them a cold email.  the person reads the email and checks out our website for more info and fills out a content download on our website produced by Marketing thus landing them in the lead queue.  Marketing assigns the lead to a sales rep.  The rep then sets a meeting with the contact and moves them to a Converted Lead. The lead is then converted to a contact but...the contact already exists so the contacts are merged.  Is this really a 'Converted Lead' if the contact already existed in salesforce?  Should sales be entering cold contacts as leads and making the source their own names instead of entering them as contacts?

How can marketing show they influenced a contact if the contact is already in the system?
I have an apex controller that im using to clone a record and its related records(deepclone). Im having issues getting the attachments to be cloned with it. Let me clarify, im not wanting to clone the attachments im wanting to share them to the new cloned record. Can anybody help? see code below.
public class SRCloneWithItemsController {

    //added an instance varaible for the standard controller
    private ApexPages.StandardController controller {get; set;}
     // add the instance for the variables being passed by id on the url
    private Service_Request__c sr {get;set;}
    // set the id of the record that is created -- ONLY USED BY THE TEST CLASS
    public ID newRecordId {get;set;}

    // initialize the controller
    public SRCloneWithItemsController(ApexPages.StandardController controller) {

        //initialize the stanrdard controller
        this.controller = controller;
        // load the current record
        sr = (Service_Request__c)controller.getRecord();

    }

    // method called from the VF's action attribute to clone the sr
    public PageReference cloneWithItems() {

         // setup the save point for rollback
         Savepoint sp = Database.setSavepoint();
         Service_Request__c newsr;

         try {

              //copy the Service Request - ONLY INCLUDE THE FIELDS YOU WANT TO CLONE
             sr = [select Id, Opportunity__c, Account__c, OwnerId, Designer__c, Estimator__c, SKNA_Plant__c, Plant_DB_Ident__c, DB_Ident__c, Plant_DB_Ident_Name__c, Plant_No__c, Opportunity_Product__c,Billing_Account__c,Primary_Contact__c,Shipping_Address_Code__c,SKNA_Plant_Executed__c,Customer_Description_Item__c from Service_Request__c where id = :sr.id];
             newsr = sr.clone(false);
             insert newsr;

             // set the id of the new SR created for testing
               newRecordId = newsr.id;

             // copy over the line items - ONLY INCLUDE THE FIELDS YOU WANT TO CLONE
             List<Request__c> items = new List<Request__c>();
             for (Request__c req : [Select req.Id, req.Absorb__c , req.Absorb_percentage__c , req.Account__c , req.Actual_Due_Date__c , req.Additional_Comment__c , req.Amtech_Plant_SAP_Customer__c , 
                                    req.Amtech_Sample_Shipping_Address__c , req.Art__c , req.Art_Link__c , req.Art_on_Disk__c , req.Art_on_FTP__c , req.Art_Type__c , req.Artwork__c , req.As_Is_PDF__c , req.Asitrade__c , 
                                    req.Assembled__c , req.Authorized_by__c , req.Blocks__c , req.Blocks_Quantity__c , req.Blocks_Type_Core__c , req.BMC_ECT__c , req.BMC_ECT_Customer_Name__c , req.Box_or_Identifcation__c , 
                                    req.CAD__c , req.CAD_Design_Log__c , req.Change_Description__c , req.Coating__c , req.Color_1__c , req.Color_1_Amtech_Code__c , req.Color_1_percent__c , req.Color_1x__c , req.Color_2__c , 
                                    req.Color_2_Amtech_Code__c , req.Color_2_percent__c , req.Color_2x__c , req.Color_3__c , req.Color_3_Amtech_Code__c , req.Color_3_percent__c , req.Color_3x__c , req.Color_4__c , 
                                    req.Color_4_Amtech_Code__c , req.Color_4_percent__c , req.Color_4x__c , req.Color_5__c , req.Color_5_Amtech_Code__c , req.Color_5_percent__c , req.Color_5x__c , req.Color_6__c , 
                                    req.Color_6_Amtech_Code__c , req.Color_6_percent__c , req.Color_6x__c , req.Color_7__c , req.Color_7_Amtech_Code__c , req.Color_7_percent__c , req.Color_7x__c , req.Color_8__c , 
                                    req.Color_8_Amtech_Code__c , req.Color_8_percent__c , req.Color_8x__c , req.Colors__c , req.Combo_Deal__c , req.Component_Name__c , req.Components__c , req.Corr_Test__c , 
                                    req.CTP_Artwork_Cost__c , req.CTP_Artwork_Sell__c , req.Customer_Laser__c , req.Customer_Product_provided__c , req.Customer_Sample__c , req.Customer_Service__c , req.Customer_Supplied__c , 
                                    req.Cutting_Die__c , req.Cutting_Die_Cost__c , req.Cutting_Die_Quote__c , req.Cutting_Die_Quote_Completed__c , req.Cutting_Die_Sell__c , req.Cutting_Die_Taxable__c , req.Depth__c , 
                                    req.Description__c , req.Description_Item__c , req.Design_Objective__c , req.Design_Request_Type__c , req.Designer__c , req.Digital_Proof__c , req.Disp_of_Sample__c , 
                                    req.Disposition_Ground_Transport__c , req.Disposition_Other__c , req.Drawing__c , req.Eligible_for_Orders__c , req.Estimator__c , req.Existing_Die_or_Old_Sample__c , 
                                    req.Existing_Printing_Plate__c , req.Existing_Printing_Plate_or_Old_Sample__c , req.Existing_Tooling__c , req.Exped_Disposition_5_Samples_Status__c , req.Expedited_Disposition_Approval_Status__c , 
                                    req.Facing_Bottom__c , req.Facings_Top__c , req.Flow__c , req.Flute__c , req.Folding_Carton_Paper_Grade_other__c , req.Folding_Carton_Paper_Grades__c , req.Folding_Carton_to_be_named__c , 
                                    req.GCMI__c , req.Glue_Joint_Type__c , req.Glue_Joint_Type2__c , req.Grade__c , req.Grade_Amtech_Code__c , req.Group_Number__c , req.HAZMAT__c , req.Honeycomb_Skid_Type_Core__c , 
                                    req.Inventory_Flag__c , req.IsDeleted , req.Joint__c , req.Joint_Location_Inside_Outside__c , req.Joint_Location_L_W__c , req.Kraft__c , req.Lab_Testing__c , req.Label_Top_Sheet__c , 
                                    req.Label_Top_Sheet_Color__c , req.Label_Top_Sheet_Full__c , req.Label_Top_Sheet_Length__c , req.Label_Top_Sheet_Spot__c , req.Label_Top_Sheet_Width__c , req.Length__c , req.Liner_Combo__c , 
                                    req.Machine_Affected__c , req.Machine_Erected__c , req.Matched_Sets__c , req.Material__c , req.Material_Certification__c , req.Max_Over_percentage__c , req.Max_Under_percentage__c , 
                                    req.Measurement__c , req.Mock_Up_Required__c , req.Multi_Component__c , req.Multipart__c , req.Multipart_Description__c , req.Mylar__c , req.No_of_Panels__c , req.of_actual_Samples__c , 
                                    req.of_colors__c , req.of_Days__c , req.of_Elements_for_Multiparts__c , req.of_Laser__c , req.of_Proofs__c , req.of_Samples__c , req.Offset_Printing__c , req.Opportunity__c , 
                                    req.Opportunity_Name2__c , req.Order_Comment__c , req.Order_Processing__c , req.Order_Quantity__c , req.Other_Outside_Process__c , req.Outside_Process__c , req.Owner_s_Managers_e_mail__c , 
                                    req.Pallet_Height__c , req.Pallet_Length__c , req.Pallet_Quantity__c , req.Pallet_Wid__c , req.Paper_Core__c , req.Part_Cust_ID__c , req.Part_ID__c , req.Part_Number_per_Set__c , req.PDF__c , 
                                    req.Pdf_cc_1__c , req.Pdf_cc_2__c , req.Pdf_Online_Approval_Request__c , req.Pdf_Online_Approver__c , req.Plant_Amtech_Code__c , req.PMS__c , req.PMS_And_Special_Colors__c , req.PO__c , 
                                    req.Polybag__c , req.Preflight__c , req.Prepress_Type__c , req.Previous_Art_File__c , req.Previous_Estimation_Design__c , req.Price__c , req.Print_Card__c , req.Printcard_CAD__c , req.Printcard_Customer__c , 
                                    req.Printcard_Ident__c , req.Printcard_Spec__c , req.Printed_Before__c , req.Printing__c , req.Printing_Die_Quote__c , req.Printing_Plate_Cost__c , req.Printing_Plate_Sell__c , req.Printing_Plate_Taxable__c , 
                                    req.Printing_Plates__c , req.Printing_Plates2__c , req.Process_Colors__c , req.Project_Item_Number__c , req.Project_Number__c , req.Quantity_per_Bundle__c , req.Quantity_per_Case__c , req.Quote_Quantity__c , 
                                    req.Quote_Quantity_1__c , req.Quote_Quantity_2__c , req.Quote_Quantity_3__c , req.Quote_Quantity_4__c , req.Quote_Quantity_5__c , req.Quote_Request__c , req.Quote_Toolling__c , req.Quoted_Price__c , req.Quoted_Price_2__c , 
                                    req.Quoted_Price_3__c , req.Quoted_Price_4__c , req.Quoted_Price_5__c , req.Record_Type_Name_Formula__c , req.RecordTypeId , req.Related_Order__c , 
                                    req.Request_Keywords__c , req.Request_Type__c , req.Requested_Disposition__c , req.ROS__c , req.Runners__c , req.Runners_Quantity__c , req.Runners_Type_Core__c , req.Sample_Box__c , req.Sample_provided__c , req.Sample_Request_Status__c , 
                                    req.Sample_Requests_Created__c , req.Sample_Shipping_Tracking__c , req.Service_Request__c , req.Shipped_to_Warehouse__c , req.Signed_Quote_Attached__c , req.Sketch__c , req.SKNA_Plant__c , req.Spec__c , req.Spec_Notes__c , req.Special_Core__c , 
                                    req.Special_Instructions__c , req.Split_Delivery__c , req.Standard_Pallet__c , req.Structure__c , req.Style__c , req.Style_Amtech_Code__c , req.Substrate__c , req.Summary_Field__c , req.Tab_Width__c , req.Target_Price_M__c , req.Tooling_Approval_Status__c , 
                                    req.Top_Sheet_Point__c , req.TOPS_C_A_P_E__c , req.Total__c , req.Tracking_link_for_sample_shipment__c , req.Transportation__c , req.Type_Core__c , req.Units_per_Pallet__c , req.UV__c , req.Validation_Depth__c , req.Validation_Length__c , req.Validation_Tab_Width__c , 
                                    req.Validation_Test_for_Zero__c , req.Validation_Width__c , req.Wall__c , req.Warehouse__c , req.WF_Status__c , req.Width__c , req.X4_color_Label__c , req.X5_Samples_Approval_Status__c 
                                    From Request__c req where Service_Request__c = :sr.id]) {
                  Request__c newreq = req.clone(false);
                  newreq.Service_Request__c = newsr.id;
                  items.add(newreq);
             }
             insert items;
             
             
             List<Spec__c> specs = new List<Spec__c>();
             for (Spec__c spc : [Select spc.Id, spc.Amtech_Grade_Code__c , spc.Amtech_Joint_Code__c , spc.Amtech_Part_Item_no__c , spc.Amtech_Spec__c , 
                                spc.Amtech_Style_Code__c , spc.Blank__c , spc.CAD_Design_Log__c , spc.Caliper_Points__c , spc.Color_1_Amtech_Code__c , 
                                spc.Color_1_percent__c , spc.Color_1x__c , spc.Color_2_Amtech_Code__c , spc.Color_2_percent__c , spc.Color_2x__c , 
                                spc.Color_3_Amtech_Code__c , spc.Color_3_percent__c , spc.Color_3x__c , spc.Color_4_Amtech_Code__c , spc.Color_4_percent__c , 
                                spc.Color_4x__c , spc.Color_5_Amtech_Code__c , spc.Color_5_percent__c , spc.Color_5x__c , spc.Color_6_Amtech_Code__c , 
                                spc.Color_6_percent__c , spc.Color_6x__c , spc.Color_7_Amtech_Code__c , spc.Color_7_percent__c , spc.Color_7x__c , 
                                spc.Color_8_Amtech_Code__c , spc.Color_8_percent__c , spc.Color_8x__c , spc.Created_In_Amtech__c , spc.Customer_Description_Item__c , 
                                spc.DB_Ident__c , spc.Depth__c , spc.Grade__c , spc.IsDeleted , spc.Joint__c , spc.Joint_Location_Inside_Outside__c , 
                                spc.Joint_Location_Length_Width__c , spc.Length__c , spc.Max_Over__c , spc.Max_Under__c , spc.Multipart__c , spc.Name , 
                                spc.of_colors__c , spc.of_Elements_for_Multipart__c , spc.of_panels__c , spc.of_Samples__c , spc.Opportunity__c , 
                                spc.Opportunity_Account__c , spc.Part_Name_Multipart_Name__c , spc.Plant_DB_Ident_Name__c , spc.Previous_Estimation_Design__c , 
                                spc.Process_Inks__c , spc.Service_Request__c , spc.Service_Request_Name__c , spc.Service_Request_Status__c , spc.Style__c , 
                                spc.Substrate__c , spc.Tab_Width__c , spc.total_print_coverage__c , spc.Total_Print_Coverage_Calculation__c , spc.Validation_Depth__c , 
                                spc.Validation_Length__c , spc.Validation_Tab_Width__c , spc.Validation_Width__c , spc.Width__c
                            From Spec__c spc where Service_Request__c = :sr.id]) {
                  Spec__c newspc = spc.clone(false);
                  newspc.Service_Request__c = newsr.id;
                  specs.add(newspc);
             }
             insert specs;
           //
           //
           //

            //Get attachment
            Attachment attach = [SELECT Id, Name, Body, ContentType, ParentId From Attachment LIMIT 1 ];//where ParentId = :sr.Id//
 
            //Insert ContentVersion
            ContentVersion cVersion = new ContentVersion();
                cVersion.ContentLocation = 'S'; //S-Document is in Salesforce. E-Document is outside of Salesforce. L-Document is on a Social Netork.
                cVersion.PathOnClient = attach.Name;//File name with extention
                //cVersion.Origin = 'C';//C-Content Origin. H-Chatter Origin.//
                //cVersion.OwnerId = attach.OwnerId;//Owner of the file//
                cVersion.Title = attach.Name;//Name of the file
                cVersion.VersionData = attach.Body;//File content
            Insert cVersion;
 
            //After saved the Content Verison, get the ContentDocumentId
            Id conDocument = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:cVersion.Id].ContentDocumentId;
 
            //Insert ContentDocumentLink
            ContentDocumentLink cDocLink = new ContentDocumentLink();
                cDocLink.ContentDocumentId = conDocument;//Add ContentDocumentId
                cDocLink.LinkedEntityId = attach.ParentId;//Add attachment parentId
                cDocLink.ShareType = 'I';//V - Viewer permission. C - Collaborator permission. I - Inferred permission.
                cDocLink.Visibility = 'InternalUsers';//AllUsers, InternalUsers, SharedUsers
            Insert cDocLink;
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //
            //

         } catch (Exception e){
             // roll everything back in case of error
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
         }

        return new PageReference('/'+newsr.id+'/e?retURL=%2F'+newsr.id);
    }

}
Hi team, 
we are following org base development model and our production org contain one option which is highlighted below in red. We call that option as package.xml generator, and typically, this option helps us to send package.xml file through email based on the installation date and status as “in progress” in SF change tracking. Now, here I like to know how I can get same package.xml using SFDX CLI instead of generating it manually from salesforce UI (attached image). Any leads here is highly appreciable.


package.xml generator in Production environment
Hello,

I have several lwc components that have been in use for several months now and recently, no changes made to the components they have stopped working.  I have put console log entries into the code to try to figure out the problem and it looks like it is happening in the lightning framework after connectedCallback but before renderedCallback and not my components, I need it resolved since I have several customers depending on this code...

screen shot
public class Test
{
List<Contact> acctList = new List<Contact>(); 
Contact a1 = new Contact(FirstName='Account1'LastName='sri'); 
Contact a2 = new Contact(FirstName='Account2' LastName='sri'); 
acctList.add(a1);
acctList.add(a2);
insert acctList;
}

Hi, 

Thanks to you all for the response in advance,

I am not getting old values in my trigger when i use the trigger.oldMap, instead I am getting new values itself

trigger LP_EventAfterTrigger on Event (After insert,After Update) {
    for(Event evtRec:trigger.new){
        
            
        if(trigger.oldMap.get(evtRec.Id).WhoCount !=evtRec.WhoCount){
                  system.debug(evtRec.EventWhoIds+' Difference '+ trigger.oldMap.get(evtRec.Id).EventWhoIds);
                  
              }
        }
    }

can please someone help
Hi,

I am getting owner id in the data table for lightning component, when using

{label: 'Account Name', fieldName: 'linkName', type: 'url', 
            typeAttributes: {label: { fieldName: 'Account_Name__c' }, target: '_blank'}},
            
            {label: 'Created By', fieldName: 'Owner__c'},

and no value when I try to use :

{label: 'Account Name', fieldName: 'linkName', type: 'url', 
            typeAttributes: {label: { fieldName: 'Account_Name__c' }, target: '_blank'}},
            
            {label: 'Created By', fieldName: 'Owner__r.Name'},

on lightning component screen.

Also , the records that get created on save are displayed in tabular form, but gets saved randomly in table ordrer, i want to arrange them in order of creation time, with the last created record to be on the top of table
Product  AND Inventory_Change__c HAVE LOOKUP RELATIONSHIP.PRODUCT IS THE PARENT OF Inventory_Change__c .TRIGGER IS UPDATEING In_Stock__c FIELD ON THE BASIS OF RECORD TYPE CHANGE.
____________________________________________________________________________________________________________________
_____________________________________TRIGGER_______________________________________________________________________
trigger InventoryChangeTrigger on Inventory_Change__c (after update) {
  if(Trigger.isAfter && Trigger.isUpdate) {
    for (Inventory_Change__c oIC : Trigger.new){
      Product2  oP = [SELECT Id, In_Stock__c  FROM Product2 WHERE Id = :oIC.Product__c];
      Id Rid = Schema.SObjectType.Inventory_Change__c.getRecordTypeInfosByName().get('Reduction').getRecordTypeId();
      Id Aid = Schema.SObjectType.Inventory_Change__c.getRecordTypeInfosByName().get('Addition').getRecordTypeId();
      if(trigger.oldmap.get(oIC.id).RecordTypeid != trigger.newmap.get(oIC.id).RecordTypeid){
        if(oIC.RecordTypeid == Rid ){
          oP.In_Stock__c = oP.In_Stock__c - oIC.Quantity__c;
        }
        if(oIC.RecordTypeid == Aid ){
          oP.In_Stock__c = oP.In_Stock__c + oIC.Quantity__c;
        }
      }
    update oP;
    }
  }
}
PRODUCT IS A STANDARD OBJECT AND Inventory_Change__c IS A CUSTOM OBJECT WITH ONLY ONE FIELD REQUIRED THAT IS "RECORD TYPE"

__________________________________________________________________________________________________________________________
                                                                                           TEST CLASS
____________________________________________________________________________________________________________________________


@isTest
public class InventoryChangeTrigger_Test{
  static testMethod void test_Inventory_ChangeTrigger(){
    test.startTest();
    product2 product2_Obj  = new product2(Name = 'Name735', IsActive = true, In_Stock__c = 19, Out_of_Stock__c = false);
    insert product2_Obj;
    Inventory_Change__c inventory_change_Obj = new Inventory_Change__c(RecordTypeId = '01236000000STHgAAO',Quantity__c = 16,product__c = product2_Obj.id );
    Insert inventory_change_Obj;
    product2 product2_Obj1 = [select id,Name,In_Stock__c from product2 where Name = 'Name735'  LIMIT 1];
    product2_Obj1.name= 'xyz';
    product2_Obj1.In_Stock__c = 3;
    update product2_Obj1;
     
    test.stopTest();
  }
}
I have a HttpPost methods. And I really don't know how to test it correctly.
My methods:
public static App__c ParseRequest(RestRequest req) {
    App__c app = new App__c();
    String body = req.requestBody.toString();
    app = (App__c)JSON.deserialize(body, App__c.class);
    return app;  
} 

@HttpPost
global static Id doPost() {
    RestRequest req = RestContext.request;        
    App__c app = ParseRequest(req);
    insert app;
    return app.id;
}

My test (just basis):
public static String GenerateJSON(App__c a){
    Map<String, String> fieldMap = new Map<String, String>{'Title__c' => a.Name};       
    String serialized = JSON.serialize(fieldMap);         
    return serialized;
}

@isTest
static void testPost() {
    App__c record = createTestRecord();
    RestRequest request = new RestRequest();
    request.requestUri = System.URL.getSalesforceBaseUrl().toExternalForm() + '/services/apexrest/App__c/' + record.Id;
    request.httpMethod = 'POST';
    RestContext.request = request;

    record = (App__c)JSON.deserialize(GenerateJSON(record), App__c.class);

    App__c j = Endpoint.ParseRequest(request);
    record = (App__c)JSON.deserialize(body, App__c.class);
}

static App__c createTestRecord() {
    App__c app = new App__c(
        Title__c = 'Title',
    );
    insert app;
    return app;
}

In App__c j = Endpoint.ParseRequest(request); I become Argument cannot be null. without coverage of:
app = (App__c)JSON.deserialize(body, App__c.class);
    return app;  
} 

@HttpPost
global static Id doPost() {
    RestRequest req = RestContext.request;        
    App__c app = ParseRequest(req);
    insert app;
    return app.id;
}

 
I have created two icons which I'd like to use in Salesforce based on the value selected in a picklist... Can anyone point me in the right direction of how to do this?

I have seen some formula fields which use Salesforce fields (I'm asuming text formula) and work something like this...

LEAD( ISPICKVAL(Enquiry_Type__c) , 
"Business", IMAGE( "/servlet/servlet.FileDownload?file=01550000000N4NG", "Green"),
"Personal", IMAGE( "/servlet/servlet.FileDownload?file=01550000000N4NY", "Yellow"),
 "")

The first thing I need to do is get the formula working which I can' seem to do. The picklist is called Enquiry_Type__c and has the options Business and Personal. I'm happy to show the two images detailed above (or even Salesforce images for the time-being).

Onmce I have the formula field working, I'm assuming I can upload my images to Salesforce and reference them instead?
I have created a custom button on a custom object.  The button, when clicked, opens up a Visualforce Page, in which the Lightning Component is placed:
<apex:page docType="html-5.0" standardController="Business_Request__c" extensions="BusinessRequest_BRtoCaseController" showHeader="false" sidebar="false" standardStylesheets="false">
    <apex:stylesheet value="{!URLFOR($Resource.SLDS260, '/styles/salesforce-lightning-design-system.min.css')}"/>    
    <apex:includeScript value="{!$Resource.jQuery331}"/>
    <apex:includeLightning />    
    <apex:outputPanel layout="block">
        <div id="lightning"/>
    </apex:outputPanel>
    
    <!--Lightning Component--> 
    <script>
    
        var base = location.protocol+"//"+location.hostname+(location.port && ":"+location.port);
        var brRecordId = "{!recordId}";
        
        $Lightning.use("c:BusinessRequest_BRtoCaseDependencyApp", function() {
            $Lightning.createComponent("c:BusinessRequest_BRtoCase", 
                                       {
                                           recordId : brRecordId,
                                           baseUrl : base
                                       }, 
                                       "lightning", 
                                       function(component) {
                                       }); 
        });
    </script>
</apex:page>

The component (for which I cannot post the code, sorry) consists of a Lightning Design System modal, with a lightning:recordEditForm inside of it.  Once the form is filled out and saved, the Apex controller creates a related record and passes a success/fail boolean to the Lightning Helper.  

In the Helper I have the code written to show a Toast and automatically close the window after a timeout:
 
action.setCallback(this, function(response){
            var state = response.getState();  
            var caseCreated = Object.keys(response.getReturnValue())[0];
            var caseComCreated = Object.values(response.getReturnValue())[0];
               
            if(state === "SUCCESS" && caseCreated === "true" && caseComCreated === "true") {
                $A.util.addClass(component.find("messageType"),"slds-theme_success");
                $A.util.removeClass(component.find("successIcon"),"slds-hide");
                $A.util.removeClass(component.find("successMessage"),"slds-hide");
                this.showToastHp(component, true);
            }
}

(later in the code...)


       
    showToastHp : function (component, success){
        var $j = jQuery.noConflict();
        
        if(success){
                $j("#toastDiv").addClass('slds-show');
                $j("#toastDiv").removeClass('slds-hide');
            }
            else{
                $j("#toastDiv").addClass('slds-hide');
                $j("#toastDiv").removeClass('slds-show');
            }
        }

            setTimeout(function(){
                window.close();
            },4500);
    }

Now, the window itself closes just fine.  However, I need something else to happen as well.  I need the record on which the button was pushed to refresh/reload.  I've tried many different Javascript methods, but the one I think may work is prohibited by lightning (uses the "opener" syntax).

Is there any way to do this?
Hi All, 

I am getting following error message: 

Challenge not yet complete... here's what's wrong:
A field with an API Name 'Match_Billing_Address__c' does not exist on the Account object

my code is as follows:


trigger AccountAddressTrigger on Account (before insert, before update) {
     for(Account a : Trigger.New) {
        if(a.Match_Billing_Address__c==true){a.ShippingPostalCode=a.BillingPostalCode;}
    }
}

 Thanks in Advance
Hi All,



I want to prepopulate the stage name in Opportunity sales stage with "Prospecting" at the time of new opportunity creation. Can you please suggest me where I can configure the default value sales stage?
User-added image