• Aruna
  • NEWBIE
  • 124 Points
  • Member since 2010

  • Chatter
    Feed
  • 4
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 95
    Questions
  • 135
    Replies
Hi,
I don't know if this is possible. I would appreciate any help. 

The requirement is to dynamically get picklist values and loop through each to display the pick value in each row's screen flow data table with an input text field. Once the data is entered, save the picklist value and input text in another object.

screen flow data example as below
User-added image
  • April 16, 2023
  • Like
  • 0
I am trying to connect Jenkins to sfdx by following below article

http://amitsalesforce.blogspot.com/2019/01/continuous-integration-using-jenkins-with-salesforceDx.html

when I am trying to execute this command 
>openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
Loading 'screen' into random state - done
server.csr: No such file or directory

But I am getting  
server.csr: No such file or directory

I am following same steps as in the article. Can any one please help me.
  • January 04, 2023
  • Like
  • 0
nvalid conversion from runtime type List<ANY> to Map<String,ANY>

Http h = new Http();
HttpResponse res = h.send(req);
 Map<String,Object> resBody = (Map<String, Object>)JSON.deserializeUntyped(res.getBody());

List<String> fieldAPINames = new List<String>(); List<String> headerList = new List<String>();

String fieldQuery = 'SELECT ';

for(Object col : (List<Object>)resBody.get('columns')){

   Map<String, Object> colFieldMap = (Map<String, Object>)col;
   if((Boolean)colFieldMap.get('hidden') == false){
          headerList.add((String)colFieldMap.get('label'));
          fieldAPINames.add((String)colFieldMap.get('fieldNameOrPath'));
          if(fieldQuery == 'SELECT '){ 
                fieldQuery += (String)colFieldMap.get('fieldNameOrPath');
           }
          else
        {
            fieldQuery += ','+(String)colFieldMap.get('fieldNameOrPath');
         }
    }
}

Any help is appreciated 
  • October 21, 2022
  • Like
  • 0
Hi trying to display the picklist drop down instead of with in the cell want out side the cell or on the cell.
following is the css ( did tried position absolute and z-index none working)
.picklist-container, .lookup-container{ width : 90%; margin: 0 auto; } .picklist-container .slds-dropdown, .lookup-container .slds-dropdown{ position: relative !important; z-index: 99 !important; max-height: 120px; overflow: scroll; display: block; } [lightning-combobox_combobox-host]{ margin-bottom: 17px; } th.slds-has-focus, td.slds-has-focus{ box-shadow: none !important; }
  • July 08, 2021
  • Like
  • 0
VF page 

<apex:page standardController="Contact">        
    <apex:includeLightning />
    <div id="Con" />
    <script>
        $Lightning.use("c:ConSearchApp", function() {
            $Lightning.createComponent(
                "c:Comp_SearchContact",
                {},
                "Con",
                function(cmp) {
                    console.log("Component is created!");
                    console.log(cmp);
                });
            });        
      </script>
</apex:page>

Application
<aura:application extends="ltng:outApp" >
     <c:Comp_SearchContact />
</aura:application>

Apex class
public with sharing class searchAccountController {
 
 @AuraEnabled
 public static List < account > fetchAccount(String CustomerMasterAccountName,
                                             String CustomerNumber,
                                             String Name,
                                             String Address,
                                             String City,
                                             String State,
                                             String ZipCode) {
  //String searchKey = searchKeyWord + '%';
  List < Account > returnList = new List < Account > ();
  /*List < Account > lstOfAccount = [select id, Name, Type, Industry, Phone, Fax from account
                                   where Name LIKE: searchKey];*/
 
  for (Account acc: [select id, Name, AccountNumber,Type, Industry, Phone, Fax,BillingState,BillingCity from account
                                   where Name=:CustomerMasterAccountName or 
                                          AccountNumber=:CustomerNumber   or
                                         BillingState=:State or
                                         BillingCity=:City]) {
   returnList.add(acc);
  }
  return returnList;
 }
}
 
Component 
 <aura:component controller="searchAccountController">   
       
    <!-- CREATE ATTRIBUTE/VARIABLE-->
    <aura:attribute name="searchResult" type="List" description="use for store and display account list return from server"/>
    
    <aura:attribute name="CustomerMasterAccountName" type="String" description="use for store user search input"/>
    <aura:attribute name="CustomerNumber" type="String" description="use for store user search input"/>
    <aura:attribute name="Name" type="String" description="use for store user search input"/>
    <aura:attribute name="Address" type="String" description="use for store user search input"/>
    <aura:attribute name="City" type="String" description="use for store user search input"/>
    <aura:attribute name="State" type="String" description="use for store user search input"/>
    <aura:attribute name="ZipCode" type="String" description="use for store user search input"/>
    
    <aura:attribute name="Message" type="boolean" default="false" description="use for display no record found message"/>
    <aura:attribute name="TotalNumberOfRecord" type="integer" default="0" description="use for display Number of records"/>
    
    <!-- SHOW LOADING SPINNER--> 
    <lightning:spinner variant="brand" size="large" aura:id="Id_spinner" class="slds-hide" />
    
    <div class="slds-m-around_medium">
       <!-- SEARCH INPUT AND SEARCH BUTTON--> 
        <lightning:layout>
            <lightning:layoutItem size="3" padding="around-small">
                <lightning:input value="{!v.CustomerMasterAccountName}"
                                 required="true"
                                 placeholder="search CustomerMasterAccountName.."
                                 aura:id="CustomerMasterAccountName"
                                 label="Customer Master Account Name"/>
                
                <lightning:input value="{!v.CustomerNumber}"
                                 required="true"
                                 placeholder="search CustomerNumber.."
                                 aura:id="CustomerNumber"
                                 label="Customer Number"/>
                
                <lightning:input value="{!v.Name}"
                                 required="true"
                                 placeholder="search Name.."
                                 aura:id="Name"
                                 label="Name"/>
                
                <lightning:input value="{!v.Address}"
                                 required="true"
                                 placeholder="search Address.."
                                 aura:id="Address"
                                 label="Address"/>
                
                <lightning:input value="{!v.City}"
                                 required="true"
                                 placeholder="search City.."
                                 aura:id="City"
                                 label="City"/>
                
                <lightning:input value="{!v.State}"
                                 required="true"
                                 placeholder="search State.."
                                 aura:id="State"
                                 label="State"/>
                
                <lightning:input value="{!v.ZipCode}"
                                 required="true"
                                 placeholder="search ZipCode.."
                                 aura:id="ZipCode"
                                 label="ZipCode"/>
                
            </lightning:layoutItem>
            <lightning:layoutItem size="2" padding="around-small">
                <lightning:button onclick="{!c.Search}"
                                  variant="brand"
                                  label="Search"
                                  iconName="utility:search"/> 
            </lightning:layoutItem>
        </lightning:layout>
       
        <!-- TOTAL RECORDS BADGES--> 
        <div class="slds-m-around_x-small">
            <lightning:badge label="{!v.TotalNumberOfRecord}" />
        </div>
        
        <!-- ERROR MESSAGE IF NOT RECORDS FOUND--> 
        <aura:if isTrue="{!v.Message}">
            <div class="slds-notify_container slds-is-relative">
                <div class="slds-notify slds-notify_toast slds-theme_error" role="alert">
                    <div class="slds-notify__content">
                        <h2 class="slds-text-heading_small">No Records Found...</h2>
                    </div>
                </div>
            </div>
        </aura:if>
       
        <!-- TABLE CONTENT--> 
        <table class="slds-table slds-table_bordered slds-table_cell-buffer">
            <thead>
                <tr class="slds-text-title_caps">
                    <th scope="col">
                        <div class="slds-truncate" title="S.no">S.no</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Account Name">Account Name</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Type">Type</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Industry">Industry</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Phone">Phone</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Fax">Fax</div>
                    </th>
                </tr>
            </thead>
            <tbody> 
                <!--### display all records of searchResult attribute by aura:iteration ###-->
                <aura:iteration items="{!v.searchResult}" var="acc" indexVar="count">
                    <tr>
                        <td>
                            <div class="slds-truncate">{!count + 1}</div>
                        </td>
                        <td>
                            <div class="slds-truncate">{!acc.Name}</div>
                        </td>
                        <td>
                            <div class="slds-truncate">{!acc.Type}</div>
                        </td>
                        <td>
                            <div class="slds-truncate">{!acc.Industry}</div>
                        </td>
                        <td>
                            <div class="slds-truncate">{!acc.Phone}</div>
                        </td>
                        <td>
                            <div class="slds-truncate">{!acc.Fax}</div>
                        </td>
                    </tr>
                </aura:iteration>
            </tbody>
        </table>
    </div>
</aura:component>
Conteroller
({
    Search: function(component, event, helper) {
        var CustomerMasterAccountName = component.find('CustomerMasterAccountName');
        var CustomerNumber = component.find('CustomerNumber');
        var Name = component.find('Name');
        var Address = component.find('Address');
        var City = component.find('City');
        var State = component.find('State');
        var ZipCode = component.find('ZipCode');
        
        var isValueMissingCMAN = searchField.get('v.CustomerMasterAccountName').valueMissing;
        var isValueMissingCMN = searchField.get('v.CustomerNumber').valueMissing;
        var isValueMissingName = searchField.get('v.Name').valueMissing;
        var isValueMissingAddress = searchField.get('v.Address').valueMissing;
        var isValueMissingCity = searchField.get('v.City').valueMissing;
        var isValueMissingState = searchField.get('v.State').valueMissing;
        var isValueMissingZipCode = searchField.get('v.ZipCode').valueMissing;
        
        // if value is missing show error message and focus on field
        if(isValueMissingCMAN) {
            CustomerMasterAccountName.showHelpMessageIfInvalid();
            CustomerMasterAccountName.focus();
        }
        else if(isValueMissingCMN){
            CustomerNumber.showHelpMessageIfInvalid();
            CustomerNumber.focus();
        }
        else if(isValueMissingName){
            Name.showHelpMessageIfInvalid();
            Name.focus();
        }
        else if(isValueMissingAddress){
            Address.showHelpMessageIfInvalid();
            Address.focus();
        }
        else if(isValueMissingCity){
            City.showHelpMessageIfInvalid();
            City.focus();
        }
        else if(isValueMissingState){
            State.showHelpMessageIfInvalid();
            State.focus();
        }
        else if(isValueMissingZipCode){
            ZipCode.showHelpMessageIfInvalid();
            ZipCode.focus();            
        }
        else{
          // else call helper function 
            helper.SearchHelper(component, event);
        }
    },
})
Helper class
({
    SearchHelper: function(component, event) {
        // show spinner message
         component.find("Id_spinner").set("v.class" , 'slds-show');
        var action = component.get("c.fetchAccount");
        action.setParams({
            'CustomerMasterAccountName': component.get("v.CustomerMasterAccountName"),
            'CustomerNumber': component.get("v.CustomerNumber"),
            'Name': component.get("v.Name"),
            'Address': component.get("v.Address"),
            'City': component.get("v.City"),
            'State': component.get("v.State"),
            'ZipCode': component.get("v.ZipCode")
        });
        action.setCallback(this, function(response) {
           // hide spinner when response coming from server 
            component.find("Id_spinner").set("v.class" , 'slds-hide');
            var state = response.getState();
            if (state === "SUCCESS") {
                var storeResponse = response.getReturnValue();
                
                // if storeResponse size is 0 ,display no record found message on screen.
                if (storeResponse.length == 0) {
                    component.set("v.Message", true);
                } else {
                    component.set("v.Message", false);
                }
                
                // set numberOfRecord attribute value with length of return value from server
                component.set("v.TotalNumberOfRecord", storeResponse.length);
                
                // set searchResult list with return value from server.
                component.set("v.searchResult", storeResponse); 
                
            }else if (state === "INCOMPLETE") {
                alert('Response is Incompleted');
            }else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        alert("Error message: " + 
                                    errors[0].message);
                    }
                } else {
                    alert("Unknown error");
                }
            }
        });
        $A.enqueueAction(action);
    },
})

Getting  following Error  : Can any one help what mistake In above code.
This page has an error. You might just need to refresh it. Action failed: c:Comp_SearchContact$controller$Search [searchField is not defined] Failing descriptor: {c:Comp_SearchContact$controller$Search}
 
  • February 08, 2021
  • Like
  • 0
Hello everyone,

We do have requirement where in trigger need to check only some fields changed in the trigger dynamically.
I know generally we do by using old and new values in trigger to check if the field values are changed.
Oldmap.Fieldname__c!=new.FieldName__c
But our requirement instead of using field in the code dynamically need to get only some field and check if they have changed the data.
That means we do not want list each and every field api name .
Want to get field API name with old and new values dynamically.
is this possible.
I was looking at some blog where we can get all the fields but I want only some fields
https://developer.salesforce.com/forums/?id=906F00000008xFXIAY

is this possible to get dynamically get only get couple of fields changed in the apex code (trigger) if it can any on please send sample code.
  • August 07, 2020
  • Like
  • 0
I Hellow friends,

We have a javascript button in classic on a custom object related lisWhenWen the button is clicked it will open the task edit page by passing record type id and some other default values to URL. below is the code.
if({!Iobject.filedname}==false) 
{ 
window.alert("You must integration the some record to someother system before using this button"); 
} 
else{ 
var uri="/00T/e?recordtype=012j0000000m7fb&tsk3={! object.Name}&00N11000001sBSr={!object.RecordType}&tsk4={!Today()}&00Nj000000Alu1e={!Today()}&tsk3_lkid={!object.Id}&tsk12=Completed&00N0a00000Bzln4=ProdashInt-SFIntServices005j000000Bydz4&retURL={!object.Id}"; 

var res = encodeURI(uri); 

window.open(res,"_parent"); 
}
I am trying to convert above javascript button into lighting action. I am struggling to get the task edit page with some parameters passed to url .

I mean how do I convert below URL into lighting  working URL

var uri="/00T/e?recordtype=012j0000000m7fb&tsk3={! object.Name}&00N11000001sBSr={!object.RecordType}&tsk4={!Today()}&00Nj000000Alu1e={!Today()}&tsk3_lkid={!object.Id}&tsk12=Completed&00N0a00000Bzln4=ProdashInt-SFIntServices005j000000Bydz4&retURL={!object.Id}";
var res = encodeURI(uri);
window.open(res,"_parent");

Thanks In advance.

 
  • February 01, 2019
  • Like
  • 0
Hello every one ,
We have a Javascript button which calls the web service method.  Below is the code 
 
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

if (!window.createxxAccountInProgress) {
window.createxxAccountInProgress = true;
var result = sforce.apex.execute("RelatedxxAccountActions","CreatexxxAccount", {relatedxxAccountId:" {!Related_xxx_Account__c.Id}"});
result = JSON.parse(result[0]);
window.createxxxAccountInProgress = false;
if (!result || !result.isSuccess) {
alert("An error occurred and your xxxx Account was not created. Please try again." +
result && result.errorMessage 
? '\r\n' + result.errorMessage
: '');
}
else {
alert("Create xxxx Account request was sent successfully.");
}
}
can anyone please suggest me how do i convert above Javascript button into lighting quick action.

Thank you,
Aruna.
  • January 30, 2019
  • Like
  • 0
Hi friends,

We are having custom List view Buttons on Account, Contacts, Lead, Case, Opportunity, and on other custom objects which does export all the objects listview records.
I did create a Listview Quick Action in Search Layout (Lighting) by using Lighting component. The quick action is not visible.

I was reading some blog if you create a Listview quick action using lighting component it is not visible only you can do is create, update and task.
can any please confirm can we create a Listview quick action using Lighting component if it is can we create.
 
  • January 30, 2019
  • Like
  • 0
Hi I need to access the helper2 variable in the helper1 method for example
 
Sample apex class

Public class SampleApexCls{


 @AuraEnabled
  public static List<String> testSmapleMethod(){
     //some code here
      Return ListofValues;
   }
 @AuraEnabled
  public static Map<Id,String> testSmapleMethod2(){
     //some code here
      Return map;
   }

}
 
({
	getSmapleData :function(component){

        var action=component.get("c.testSmapleMethod");
		action.setCallback(this,function(response){
			var returnValue=response.getReturnValue();
		
                     this.getSmapleData1 (component) // I know how to call the funcation
                   // Whant to get "returnValue2" results in this method.

		});

	},
	getSmapleData1 :function(component){
		var action=component.get("c.testSmapleMethod2");
		action.setCallback(this,function(response){
			var returnValue2=response.getReturnValue();
		
		});
	}
})
how do I access "returnValue2" in  "getSmapleData"  funcation.
can  "getSmapleData1" return some value.

can any please help to get the one funcation values or varaible to display in other funcation like how we do in general apex class

 
  • January 25, 2019
  • Like
  • 0
Hi, I am trying to convert below javascript button into a lighting component.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
// query the record 
var qr = sforce.connection.query("SELECT Id, SyncedQuoteId FROM Opportunity where Id='" + "{!Opportunity.Id}" + "'"); 
var records = qr.getArray("records"); 

var qr1 = sforce.connection.query("SELECT Id, OpportunityId FROM Quote where OpportunityId='" + "{!Opportunity.Id}" + "'"); 

// display the field from the query 
var recTypeId='{!Opportunity.RecordTypeId}'; 

var oppQuoteId=qr.records.SyncedQuoteId; 
var quoteRecord=qr1.getArray("records"); 

if((recTypeId=='{!$Setup.Opportunity_Record_Types__c.New_Record_Type_Id__c}' || 
recTypeId=='{!$Setup.Opportunity_Record_Types__c.Pilot_Record_Type_Id__c}' || 
recTypeId=='{!$Setup.Opportunity_Record_Types__c.Renew_Upsell_Record_Type_Id__c}') 
&& (oppQuoteId==null && quoteRecord!='')) { 
window.alert("There is a root quote already attached to this Opportunity. If you need assistance with this opportunity, please reach out to xxxxx "); 

else {
window.open ("http://{!$Setup.Integration_Settings__c.Quoting_Tool_URL__c}/reps/xxxxx.aspx?SFAccountId={!CASESAFEID(Opportunity.AccountId)}&SFOppId={!CASESAFEID(Opportunity.Id)}"); 
}

Lighting component

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.oppRecordTypes}"/>
    <!--<aura:attribute name="Opportunity" type="Opportunity" />-->
    
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="syncedQuoteId" type="String" />
    <aura:attribute name="quoteId" type="String" />
    <aura:attribute name="lstOfRecordType" type="String[]" />
    <aura:attribute name="lstOfCutomObjectRecordType" type="String[]" />
   
 </aura:component>

Javascript controller
({
    oppRecordTypes : function(component, event, helper) {
        var action=component.get("c.oppRecordTypes");
       // action.setParams({"objectName" : Opportunity});
        action.setParams({"recordId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
           var state = response.getState();
            if(state=="SUCCESS"){
                component.set("v.lstOfRecordType",response.getReturnValues());
                var oppRecordTypeNamesList=response.getReturnValues();                
                console.log("Record type names11="+oppRecordTypeNamesList);
                          
                var syncedQuoteId=component.get("c.getSyncedQuoteId");
                console.log("oppSyncedQuoteId111=" + syncedQuoteId);
                               
                var quoteId=component.get("c.getQuoteId");
                console.log("oppquoteId111=" + quoteId);
                
                var oppCustomRecordTypeNamesList=component.get("c.getOppCutomRecordTypes");
               console.log("oppCustomRecordTypeNamesList11="+oppCustomRecordTypeNamesList);                
            }
            else{
                console.log("cannot get record type names");
            }            
        } );
    },
        getSyncedQuoteId : function(component,event,helper){
        var action=component.get("c.getSyncedQuoteId");
        action.setParams({"oppId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
            var state = response.getState();
            if(state="SUCCESS"){
                component.set("v.syncedQuoteId",response.getReturnValues());
                var oppSyncedQuoteId=response.getReturnValues();           
                console.log("oppSyncedQuoteId=" + oppSyncedQuoteId);
                            }
            else{
                console.log("cannot get syncedQuote ID");
            }
        });
    },
     getQuoteId : function(component,event,helper){
        var action=component.get("c.getQuoteId");
        action.setParams({"oppId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
            var state=response.getState();
            if(state="SUCCESS"){
                componet.set("v.quoteId",response.getReturnValues());
                var oppQuoteId=response.getReturnValues();
                console.log("oppQuoteId="+oppQuoteId);
            }
            else{
                console.log("cannot get quote id")
            }
        });
    },    
    getOppCutomRecordTypes :function(component,event,helper){
        var action=component.get("c.getOppCutomRecordTypes");
        action.setCallback(this,function(response){
            var state=response.getState();
            if(state="SUCCESS"){
                component.set("v.lstOfCutomObjectRecordType",response.getReturnValues());
                var oppCustomRecordTypeNamesList=response.getReturnValues();
                   
                console.log("oppCustomRecordTypeNamesList="+oppCustomRecordTypeNamesList);
            }
            else{
                console.log("cannot get custom report type names");
            }
        });        
    }
})
APEX Class
public class AttachQuoteCntrl {
    public static List<String> recordTypeNames;
    
    @AuraEnabled     
    public static List<String> oppRecordTypes(){
         List<Schema.RecordTypeInfo> recordtypes = Schema.getGlobalDescribe().get('Opportunity').getDescribe().getRecordTypeInfos();    
         recordTypeNames=new List<String>();
         for(RecordTypeInfo rt : recordtypes){
            recordTypeNames.add(rt.getName());
        }    
        System.debug('********recordTypeNames='+recordTypeNames);
        
        return recordTypeNames;
    }
    @AuraEnabled 
    public static string getSyncedQuoteId(string oppId){
        Opportunity oppSyncedQuote= [Select id,SyncedQuoteId from opportunity where Id=:oppId limit 1];
        string syncedQuoteId=oppSyncedQuote.SyncedQuoteId;
        System.debug('********syncedQuoteId='+syncedQuoteId);
        return syncedQuoteId;
    }
    
    @AuraEnabled 
    public static string getQuoteId(string oppId){
        Quote oppQuote= [Select id,OpportunityId from Quote where OpportunityId=:oppId limit 1];
        string QuoteId=oppQuote.id;
        System.debug('********QuoteId='+QuoteId);
        return QuoteId;
    }
    
    @AuraEnabled 
    public static Opportunity_Record_Types__c getOppCutomRecordTypes(){
        return Opportunity_Record_Types__c.getInstance();
    }
}

I am unable to see the console.log in javascript console(developer tools)
can any please correct my code I am sure something is wrong with the code I am able to save the code and added quick action lighting component.
when clicking the quick action, first of all, I want to see if the records are coming are not in the console log.I am understanding why I am unable to see the logs in the developer tools console.
Please help me 



 
  • January 23, 2019
  • Like
  • 0
Hello everyone,

now we are moving from classic to lighting I need to convert all the javascript button to lighting.
We have a custom button which has below url on it

window.open('/apex/vfpagename?id=xxxxx'); 
User-added image
how do I replace window.open  in lighting and I want the button to work both in lighting and in classic.
Can any please help me on this if any sample code will be appreciated.

Thank you,
Aruna.
 
  • December 20, 2018
  • Like
  • 0
Hi is anyone got the solution to this sorting problem.

I am unable to do descending order sorting.
My requirement is I have map Of <Id,Name>  when user click on the link the map values need to sort either ascending or descending order

Example If the Map values contain
Map.put(id1,Name1);  
Map.put(id3,Name3);  
Map.put(id2,Name2);  
Map.put(id5,Name5);  
Map.put(id6,Name6);  
Map.put(id4,Name4);  

Result for ascending 
Map.put(id1,Name1);  
Map.put(id2,Name2);  
Map.put(id3,Name3);  
Map.put(id4,Name4);  
Map.put(id5,Name5);  
Map.put(id6,Name6); 

Result for desendoing\

Map.put(id6,Name6);  
Map.put(id5,Name5);  
Map.put(id4,Name4);  
Map.put(id3,Name3);  
Map.put(id2,Name2);  
Map.put(id1,Name1); 

I did use different methods to solve this but nothing is working me out. Please, anyone, help me out I need to solve this issue.
One ve page I need to display these values.

Thank you
Aruna
  • May 30, 2018
  • Like
  • 0
Hello there,

I am creating 2 pablock section . which display data with checkbox's and select all check box for each section .
when I am selecting top section select all chekbox it is also selecting below check checkbox data and If  i am using mutilple object getting too many quiry error also.
below is the class and vf page. can any one please solve this issue. an

public class Checkbox_Class
{

 
    List<accountwrapper> accountList = new List<accountwrapper>();
    List<accountwrapper_Two> accountList2 = new List<accountwrapper_Two>();
    List<Account> selectedAccounts = new List<Account>();

    public List<accountwrapper> getAccounts()
    {
        for(Account a : [select Id, Name, AccountNumber, Phone from Account ])
        accountList.add(new accountwrapper(a));
        return accountList;
    }
     public List<accountwrapper_Two> getAccounts2()
    {
        for(Account a : [select Id, Name, AccountNumber, Phone from Account ])
        accountList2.add(new accountwrapper_Two(a));
        return accountList2;
    }

    public PageReference getSelected()
    {
        selectedAccounts.clear();
        for(accountwrapper accwrapper : accountList)
        if(accwrapper.selected == true)
        selectedAccounts.add(accwrapper.acc);
        return null;
    }
      public PageReference getSelected2()
    {
        selectedAccounts.clear();
        for(accountwrapper_Two accwrapper2 : accountList2)
        if(accwrapper2.selected == true)
        selectedAccounts.add(accwrapper2.acc);
        return null;
    }

    public List<Account> GetSelectedAccounts()
    {
        if(selectedAccounts.size()>0)
        return selectedAccounts;
        else
        return null;
    }    

    public class accountwrapper
    {
        public Account acc{get; set;}
        public Boolean selected {get; set;}
        public accountwrapper(Account a)
        {
            acc = a;
            selected = false;
        }
    }
     public class accountwrapper_Two
    {
        public Account acc{get; set;}
        public Boolean selected {get; set;}
        public accountwrapper_Two(Account a)
        {
            acc = a;
            selected = false;
        }
    }
}
vf page

<!-- http://tablesorter.com/docs/-->
<apex:page controller="Checkbox_Class" Tabstyle="Account">
    
    <apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
    <apex:includeScript value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/js/jquery.tablesorter.min.js" />
    <apex:stylesheet value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/css/theme.blue.css" />

    
    <apex:form >
     
        <apex:pageBlock Title="Accounts with CheckBoxes">
            <apex:pageBlockSection Title="List of Available Accounts">
                <apex:dataTable value="{!accounts}" var="a" columnswidth="50px,50px" cellpadding="4" border="1" id="accsTable" styleclass="tablesorter">
                    <apex:column >
                        <apex:facet name="header"> <apex:inputCheckbox >
                            <apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" reRender="Selected_PBS"/>
                            </apex:inputCheckbox>
                        </apex:facet>
                        <apex:inputCheckbox value="{!a.selected}" id="checkedone">
                        <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Account Name" value="{!a.acc.Name}" />
                    <apex:column headervalue="Account Number" value="{!a.acc.AccountNumber}" />
                    <apex:column headervalue="Phone" value="{!a.acc.Phone}" />
                </apex:dataTable>
            </apex:pageBlockSection>
            
            
            <apex:pageBlockSection Title="List of Available Accounts">
                <apex:dataTable value="{!accounts2}" var="a" columnswidth="50px,50px" cellpadding="4" border="1" id="accsTable" styleclass="tablesorter">
                    <apex:column >
                        <apex:facet name="header"> <apex:inputCheckbox >
                            <apex:actionSupport event="onclick" action="{!GetSelected2}" onsubmit="checkAll2(this)" reRender="Selected_PBS"/>
                            </apex:inputCheckbox>
                        </apex:facet>
                        <apex:inputCheckbox value="{!a.selected}" id="checkedone2">
                        <apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Account Name" value="{!a.acc.Name}" />
                    <apex:column headervalue="Account Number" value="{!a.acc.AccountNumber}" />
                    <apex:column headervalue="Phone" value="{!a.acc.Phone}" />
                </apex:dataTable>
            </apex:pageBlockSection>

        </apex:pageBlock>
    </apex:form>
    <script>
        function checkAll(cb)
        {
            var inputElem = document.getElementsByTagName("input");
            for(var i=0; i<inputElem.length; i++)
            {
                if(inputElem[i].id.indexOf("checkedone")!=-1)
                inputElem[i].checked = cb.checked;
            }
        }
         function checkAll2(cb)
        {
            var inputElem = document.getElementsByTagName("input");
            for(var i=0; i<inputElem.length; i++)
            {
                if(inputElem[i].id.indexOf("checkedone2")!=-1)
                inputElem[i].checked = cb.checked;
            }
        }
        
      $(document).ready(function()
      {
        $("[id$='accsTable']").tablesorter({theme: 'none', dateFormat : "dd/mm/yyyy"});
      });

    </script>
</apex:page>
  • February 02, 2018
  • Like
  • 0
Hello,

We do have salesforce classic right now. in future, we are going to roll out to lighting.
the visual force pages whatever I am going to develop in classic version should be lighting friendly i,e, when we roll out to lighting the vf page, should not give any issue.
my question is when I am developing vf page in the classic version is it enough to use  lightningStylesheets="true" or should I develop vf page using lighting API.
Can anyone please guide how can develop vf page in a classic which can be used both in classic and lighting.

If I need to develop using lighting API, please give some example 
the page should display table formate  account records with checkboxes and sortable header's




 
  • January 26, 2018
  • Like
  • 0
Hello,

on vf page When I am displaying user full name and LastModifiedDate field. The LastmodifiedDate filed is displaying UK date and time.

User-added image the above date/ timr should be 2017-08-11 7:57:44

I did  used LastModifiedDate .format('YYYY-MM-DD hh:mm:ss','EST') 
can anyone please help how can display lastmodifieddate from UK time zone  to USA time zone

Thank you,
Aruna.
  • November 09, 2017
  • Like
  • 0
Hello there,

When record manually deleted in salesforce send that record id to other system as URL parameter.
I know it is asynchronous process with @future(callout=true).
I was looking at the HttpRequest  API document I did not find the method to set parameters and send to as request.
instead of sending JSON file in the body send as URL parameter.
Can anyone suggest me how can I send URL parameters to other systems using HttpRequest .

Thank you.



 
  • February 02, 2017
  • Like
  • 0
Hello there,

I am having below requirement.
In salesforce when a record is updated then send data of that record to external system using reset API JSON file.
I have written below code but I am not sure whether I am going in right direction 

Trigger

rigger ImplementationPlanActivity on Implementation_Plan_Activity__c (after update) {
    Trigger_Settings__c triggerSettings = Trigger_Settings__c.getInstance();
    if(triggerSettings.ImplementationPlanActivity__c == false){
        return;
    }
            set<Id> IPAIdSet=new Set<Id>();
            for(Implementation_Plan_Activity__c IPArecord : trigger.new ){
                IPAIdSet.add(IPArecord .id);
            }
            IPAResetAPIClass.IPAData(IPAIdSet);

        }
    }
Webservice class

global class IPAResetAPIClass{
@future(callout=true)
    global static void IPAData(Set<Id> newIPASetId){
    
        List<Implementation_Plan_Activity__c> ipaNewList=[SELECT id,Name,
                                                                    Account_Manager__r.Name,
                                                                    Account_Manager__r.Email,
                                                                    Account_Specialist__r.Name,
                                                                    Account_Specialist__r.Email,    
                                                                    SFID18__c ,
                                                                    RecordTypeId
                                                            FROM Implementation_Plan_Activity__c where Id IN : newIPASetId];
        
        List<impWarpperClass> warpperIPAList=new List<impWarpperClass>();
        
            warpperIPAList.add(new impWarpperClass(ipaNewList[0].id,
                                                    ipaNewList[0].Name,
                                                    ipaNewList[0].Account_Manager__r.Name,
                                                    ipaNewList[0].Account_Manager__r.Email,
                                                    ipaNewList[0].Account_Specialist__r.Name,
                                                    ipaNewList[0].Account_Specialist__r.Email,
                                                    ipaNewList[0].SFID18__c,
                                                    ipaNewList[0].RecordTypeId));
        
 
       RecordType recordTypeRecord=[Select id,Name from RecordType  where id=:ipaNewList[0].RecordTypeId limit 1];
       
       string  resource=null;
       if(recordTypeRecord.Name=='Auto Provisioning'){
           resource='Auto Provisioning';
       }
       else if(recordTypeRecord.Name =='Workbook'){
           resource='Workbook';
        }      
        system.debug('*********warpperIPAList='+warpperIPAList);
        
        string JSONString=JSON.serializePretty(warpperIPAList);
        system.debug('*********serialized imp='+JSONString);
        
        string endURL;
        
        endURL=geURL+resource+'/'+ipaNewList[0].id;
        system.debug('*********endURL='+endURL);
        HttpRequest req=new HttpRequest();
        //Set HttpRequest Method
        req.setMethod('POST');
      
        req.setHeader('content-type', 'application/json');
        //Set HTTPRequest Endpoint dummy url
        req.setEndpoint('http://requestb.in/13auzf41');
        //req.setEndpoint(endURL);
        
        //Set HTTP Request Body
        req.setBody(JSONString);
        Http http = new Http();
        try{
            HTTPResponse res = http.send(req);
            //Helpful debug messages
            System.debug(res.toString());
            System.debug('STATUS:'+res.getStatus());
            System.debug('STATUS_CODE:'+res.getStatusCode());
            System.debug('Content: ' + res.getBody());
            
            //we can create success object record
        }
        catch(Exception e){
            System.debug('******* error message='+e);
            //we can create error object record
        }
    
    }
    
    global class impWarpperClass{
    
        global string IPAId{get;set;}
        global string IPAName{get;set;}   
        global string IPAAccManagerName{get;set;}   
        global string IPAAccManagerEmail{get;set;} 
        global string IPAAccSpecialListrName{get;set;}   
        global string IPAAccSpecialListEmail{get;set;} 
           
        global string IPASFDCId{get;set;}
        global string IPARecordTypeId{get;set;}
        
        global impWarpperClass(string IPAId,string IPAName,
                                        string IPAAccManagerName,
                                        String IPAAccManagerEmail,
                                        string IPAAccSpecialListrName,
                                        string IPAAccSpecialListEmail,
                                        string IPASFDCId,
                                        string IPARecordTypeId){
            this.IPAId=IPAId;
            this.IPAName=IPAName;
            this.IPAAccManagerName=IPAAccManagerName;
            this.IPAAccManagerEmail=IPAAccManagerEmail;
            this.IPAAccSpecialListrName=IPAAccSpecialListrName;
            this.IPAAccManagerEmail=IPAAccSpecialListEmail;
            this.IPASFDCId=IPASFDCId;
            this.IPARecordTypeId=IPARecordTypeId;
            
        }
       
    }
  
       }

}
am I going right dirction. is this correct way to send data from salesforce to external system using rest api JSON file.
If I am wrong can any please let me know how can I expose salesforce data to external system when records is updted in salesforce.
Thank you.
  • December 28, 2016
  • Like
  • 0
Hello there,

I have created a Github remote repository and also created local branch and did some changes and pushed all the way to remote repo master.
But when I login into salesforce sandbox I don't see those changes.

how do I sync Github remote master repo to salesforce sandbox.

Note : I am not using eclipse force.com ide to clone the git hub project. I am using Gitshell command prompt to clone and to create the local branches.

Please help me to see the changes which I have done in git hub in salesforce sandbox.


 
  • December 22, 2016
  • Like
  • 0
Hello,

I am trying to get the report information  like  what are the filters on the report by using  report metadata.
But I am getting below error

reports.MetadataException: Can't run the report because it doesn't have any columns selected. Be sure to add fields as columns to the report through the user interface.

below is my code 
List <Report> reportList = [SELECT Id,Name,DeveloperName FROM Report ORDER BY Name DESC];
     for(Integer i=0;i<reportList.size();i++){
         
         String reportId = (String)reportList.get(i).get('Id');
         String Name = (String)reportList.get(i).get('Name');
         
         Reports.ReportResults results = Reports.ReportManager.runReport(reportId);
         Reports.ReportMetadata rm = results.getReportMetadata();
         
        system.debug('---Name---'+Name);
         system.debug('---reportId---'+reportId);
         system.debug('---results'+results);
         system.debug('---rm'+rm);
          
         for(Reports.ReportFilter rf : rm.getreportFilters()){
             if(rf!=null){
                 system.debug('---col name---'+rf.getcolumn());
                 system.debug('---col value---'+rf.getValue());
             }
         }
 
Please let me know how do overcome with this error.
 
  • August 29, 2016
  • Like
  • 0
I am trying to create excel sheet with multiple tabs using visulaforce page .
I am facing some issues in formating number for example below cell is having number formate with comma separated but when I look @ out put excel sheet the number is not with comma 
<Cell ss:StyleID="s23"><Data ss:Type="Number">1,76,213</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">680</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">465</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,756</Data></Cell>
                
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,566</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,35,353</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">567</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,564</Data></Cell>
                
                <Cell ss:StyleID="s23"><Data ss:Type="Number">26,752</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">23,015</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">6</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,56,6</Data></Cell>

Out put, if you look @ below screen i need to put some % and $ and different symbols in the cells .
when I ma trying to put those symbols excel sheet is not considering and it is not opening getting file is corrupted and when see the more details is saying one of the cell is having invalid data.

NumberFormateIssue

any please suggest how to formate a number using apex visualforce.
Example will be help full
 
  • December 10, 2015
  • Like
  • 1
Hi there,

I have a task need to select a opportunities using standatd list  view page under "Action " check box.
when i check a check box select those opportunities and do some business logic and diaply message.
my question how can i know what are the opportunities are selected using Action check box  is it possible ? since that is standard page opportunity list view page .

  • September 02, 2014
  • Like
  • 1
I am trying to connect Jenkins to sfdx by following below article

http://amitsalesforce.blogspot.com/2019/01/continuous-integration-using-jenkins-with-salesforceDx.html

when I am trying to execute this command 
>openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
Loading 'screen' into random state - done
server.csr: No such file or directory

But I am getting  
server.csr: No such file or directory

I am following same steps as in the article. Can any one please help me.
  • January 04, 2023
  • Like
  • 0
  Map<String,Object> results = (Map<String,Object>)JSON.deserializeUntyped(response.getBody());
              
                list<object> attchlist;
                list<ContentVersion> CV = new list<ContentVersion>();
                list<ContentDocumentLink> CDLink = new list<ContentDocumentLink>();
                Set<Id> contentDocumentIds = new Set<Id>();
                Set<FileData> fileFromSAP = new Set<FileData>();
                
                for(Object mapa:results.values() ){
                    Map<String,Object> tempMap = (Map<String,Object>)mapa;
                    map<string,object> attc = (Map<String,Object>)tempMap.get('Attachment');
}

This exception is coming while running the code...someone please help

First I'll preface this by saying my HTML is lacking.  That being said I think I'm 80% of the way to where I need to be.

My use case:  When my Salesforce users open an Account in Lightning, I want a visual force page to open.  That VF Page will be a Card in Domo.  That Card in Domo will be specific to that Account my users are viewing.  

Currently I have a basic VF Page that can display a generic card from Domo: 

<apex:page standardController="Account">

<iframe src="https://mycompany.domo.com/embed/card/199079?enable=drill" width="600" height="275" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe></apex:page>
 

But now I'm trying to pass the Account.ID into this code which I think is almost correct.  I know people have been able to get this to work in the past, I just can't figure it out:

 

https://mycompany.domo.com/embed/card/12345679?enable=title,summary,&pfilters=
[{%22column%22:%22<Account.Id>>%22,%22dataType%22:%22<STRING>%22,%22operand%22:%22<IN=>%22,%22values%22:[%22<VALUE TO FILTER AS>%22]}]
 



 

Hi, I am trying to convert below javascript button into a lighting component.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
// query the record 
var qr = sforce.connection.query("SELECT Id, SyncedQuoteId FROM Opportunity where Id='" + "{!Opportunity.Id}" + "'"); 
var records = qr.getArray("records"); 

var qr1 = sforce.connection.query("SELECT Id, OpportunityId FROM Quote where OpportunityId='" + "{!Opportunity.Id}" + "'"); 

// display the field from the query 
var recTypeId='{!Opportunity.RecordTypeId}'; 

var oppQuoteId=qr.records.SyncedQuoteId; 
var quoteRecord=qr1.getArray("records"); 

if((recTypeId=='{!$Setup.Opportunity_Record_Types__c.New_Record_Type_Id__c}' || 
recTypeId=='{!$Setup.Opportunity_Record_Types__c.Pilot_Record_Type_Id__c}' || 
recTypeId=='{!$Setup.Opportunity_Record_Types__c.Renew_Upsell_Record_Type_Id__c}') 
&& (oppQuoteId==null && quoteRecord!='')) { 
window.alert("There is a root quote already attached to this Opportunity. If you need assistance with this opportunity, please reach out to xxxxx "); 

else {
window.open ("http://{!$Setup.Integration_Settings__c.Quoting_Tool_URL__c}/reps/xxxxx.aspx?SFAccountId={!CASESAFEID(Opportunity.AccountId)}&SFOppId={!CASESAFEID(Opportunity.Id)}"); 
}

Lighting component

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.oppRecordTypes}"/>
    <!--<aura:attribute name="Opportunity" type="Opportunity" />-->
    
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="syncedQuoteId" type="String" />
    <aura:attribute name="quoteId" type="String" />
    <aura:attribute name="lstOfRecordType" type="String[]" />
    <aura:attribute name="lstOfCutomObjectRecordType" type="String[]" />
   
 </aura:component>

Javascript controller
({
    oppRecordTypes : function(component, event, helper) {
        var action=component.get("c.oppRecordTypes");
       // action.setParams({"objectName" : Opportunity});
        action.setParams({"recordId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
           var state = response.getState();
            if(state=="SUCCESS"){
                component.set("v.lstOfRecordType",response.getReturnValues());
                var oppRecordTypeNamesList=response.getReturnValues();                
                console.log("Record type names11="+oppRecordTypeNamesList);
                          
                var syncedQuoteId=component.get("c.getSyncedQuoteId");
                console.log("oppSyncedQuoteId111=" + syncedQuoteId);
                               
                var quoteId=component.get("c.getQuoteId");
                console.log("oppquoteId111=" + quoteId);
                
                var oppCustomRecordTypeNamesList=component.get("c.getOppCutomRecordTypes");
               console.log("oppCustomRecordTypeNamesList11="+oppCustomRecordTypeNamesList);                
            }
            else{
                console.log("cannot get record type names");
            }            
        } );
    },
        getSyncedQuoteId : function(component,event,helper){
        var action=component.get("c.getSyncedQuoteId");
        action.setParams({"oppId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
            var state = response.getState();
            if(state="SUCCESS"){
                component.set("v.syncedQuoteId",response.getReturnValues());
                var oppSyncedQuoteId=response.getReturnValues();           
                console.log("oppSyncedQuoteId=" + oppSyncedQuoteId);
                            }
            else{
                console.log("cannot get syncedQuote ID");
            }
        });
    },
     getQuoteId : function(component,event,helper){
        var action=component.get("c.getQuoteId");
        action.setParams({"oppId" : component.get("v.recordId")});
        action.setCallback(this,function(response){
            var state=response.getState();
            if(state="SUCCESS"){
                componet.set("v.quoteId",response.getReturnValues());
                var oppQuoteId=response.getReturnValues();
                console.log("oppQuoteId="+oppQuoteId);
            }
            else{
                console.log("cannot get quote id")
            }
        });
    },    
    getOppCutomRecordTypes :function(component,event,helper){
        var action=component.get("c.getOppCutomRecordTypes");
        action.setCallback(this,function(response){
            var state=response.getState();
            if(state="SUCCESS"){
                component.set("v.lstOfCutomObjectRecordType",response.getReturnValues());
                var oppCustomRecordTypeNamesList=response.getReturnValues();
                   
                console.log("oppCustomRecordTypeNamesList="+oppCustomRecordTypeNamesList);
            }
            else{
                console.log("cannot get custom report type names");
            }
        });        
    }
})
APEX Class
public class AttachQuoteCntrl {
    public static List<String> recordTypeNames;
    
    @AuraEnabled     
    public static List<String> oppRecordTypes(){
         List<Schema.RecordTypeInfo> recordtypes = Schema.getGlobalDescribe().get('Opportunity').getDescribe().getRecordTypeInfos();    
         recordTypeNames=new List<String>();
         for(RecordTypeInfo rt : recordtypes){
            recordTypeNames.add(rt.getName());
        }    
        System.debug('********recordTypeNames='+recordTypeNames);
        
        return recordTypeNames;
    }
    @AuraEnabled 
    public static string getSyncedQuoteId(string oppId){
        Opportunity oppSyncedQuote= [Select id,SyncedQuoteId from opportunity where Id=:oppId limit 1];
        string syncedQuoteId=oppSyncedQuote.SyncedQuoteId;
        System.debug('********syncedQuoteId='+syncedQuoteId);
        return syncedQuoteId;
    }
    
    @AuraEnabled 
    public static string getQuoteId(string oppId){
        Quote oppQuote= [Select id,OpportunityId from Quote where OpportunityId=:oppId limit 1];
        string QuoteId=oppQuote.id;
        System.debug('********QuoteId='+QuoteId);
        return QuoteId;
    }
    
    @AuraEnabled 
    public static Opportunity_Record_Types__c getOppCutomRecordTypes(){
        return Opportunity_Record_Types__c.getInstance();
    }
}

I am unable to see the console.log in javascript console(developer tools)
can any please correct my code I am sure something is wrong with the code I am able to save the code and added quick action lighting component.
when clicking the quick action, first of all, I want to see if the records are coming are not in the console log.I am understanding why I am unable to see the logs in the developer tools console.
Please help me 



 
  • January 23, 2019
  • Like
  • 0
Hello everyone,

now we are moving from classic to lighting I need to convert all the javascript button to lighting.
We have a custom button which has below url on it

window.open('/apex/vfpagename?id=xxxxx'); 
User-added image
how do I replace window.open  in lighting and I want the button to work both in lighting and in classic.
Can any please help me on this if any sample code will be appreciated.

Thank you,
Aruna.
 
  • December 20, 2018
  • Like
  • 0
Hi is anyone got the solution to this sorting problem.

I am unable to do descending order sorting.
My requirement is I have map Of <Id,Name>  when user click on the link the map values need to sort either ascending or descending order

Example If the Map values contain
Map.put(id1,Name1);  
Map.put(id3,Name3);  
Map.put(id2,Name2);  
Map.put(id5,Name5);  
Map.put(id6,Name6);  
Map.put(id4,Name4);  

Result for ascending 
Map.put(id1,Name1);  
Map.put(id2,Name2);  
Map.put(id3,Name3);  
Map.put(id4,Name4);  
Map.put(id5,Name5);  
Map.put(id6,Name6); 

Result for desendoing\

Map.put(id6,Name6);  
Map.put(id5,Name5);  
Map.put(id4,Name4);  
Map.put(id3,Name3);  
Map.put(id2,Name2);  
Map.put(id1,Name1); 

I did use different methods to solve this but nothing is working me out. Please, anyone, help me out I need to solve this issue.
One ve page I need to display these values.

Thank you
Aruna
  • May 30, 2018
  • Like
  • 0
Hi,

It was really simple to open URL in new window with passing parameters and some Validations using salesforce classic Onclick Java. for example:
if({!ISBLANK( Account.CSOne_Case_Number__c )})
{
window.open('https://.na29.visual.force.com/apex/Relationship360?rId={!Account.Gainsight_Relationship_ID__c}');
}

Now we are moving to Salesforce Lightning and As Onclick Javascript is not supported. can someone please let me know how can I achieve this in Lightning.

Thanks in advance.

Saurabh Sisodia
Hello Reader

I  have a Custom object  (called API_Order__c) which has  lookup  field to Account
My plan is  to insert  MULTIPLE  records  in 1  REST API call and I am trying to build  the good JSON
I am not able to do this. I tried  the stanbdard REST  and I tried  to  use the COmposite/tree  REST

Seee below what I havew tried:

TEST 1

I want to  create  1 record  using REST command AND I want to reference the Account with External ID.
I use the below  REST
Method: POST
URL: /services/data/v39.0/sobjects/API_Order__c/

{
  "SourceFile__c" : "DE_1A_MSV3",
  "Order_Date__c" : "2017-07-07",
  "Account__r" : 
         {
         "External_ID_vod__c":"WDEF01663170"
         },
  "Account_Name__c" : "Adler-Apotheke",
  "NumberOfExpectedItemLines__c" : "2", 
  "External_Id__c" : "API_O_1003"
}

this is WORKING

​TEST 2
BUT  if I want to insert  MULTIPLE  records  I do not  know  what is  the right syntax


[
{
  "SourceFile__c" : "Value 1",
  "Order_Date__c" : "2017-07-07",
  "Account__r" : 
         {
         "External_ID_vod__c":"XXXX"
         },
  "External_Id__c" : "API_O_1003"
},
{
  "SourceFile__c" : "Value 2",
  "Order_Date__c" : "2017-07-08",
  "Account__r" : 
         {
         "External_ID_vod__c":"YYYY"
         },
  "External_Id__c" : "API_O_1003"
}
]

I god  JSON parsng ERROR

TEST 3

I tried to use  the COMPOSITE  REST  call  to insert Multiple records and if I am passing the Salesforce ID  of  the  Account lookup is OK 

POST
/services/data/v39.0/composite/tree/API_Order__c

{
"records" :[
  {
  "attributes" : {"type" : "API_Order__c", "referenceId" : "ref1"},
  "SourceFile__c" : "DE_1A_MSV3",
  "Order_Date__c" : "2017-07-07",
  "Account__c" : "0015E000004jH2I"
  }, 
  {
  "attributes" : {"type" : "API_Order__c", "referenceId" : "ref2"},
  "SourceFile__c" : "Val2",
  "Order_Date__c" : "2017-07-07",
  "Account__c" : "0015E000004jH2I"
   }]
}

TEST 4
BUT IF  I TRY  TO REFERENC ETHE ACCOUNT WITH EXTER NAL ID  I FAIL

POST
/services/data/v39.0/composite/tree/API_Order__c

{
"records" :[
  {
  "attributes" : {"type" : "API_Order__c", "referenceId" : "ref1"},
  "SourceFile__c" : "DE_1A_MSV3",
  "Order_Date__c" : "2017-07-07",
  "Account__r" : 
         {
         "External_ID_vod__c":"WDEF01663170"
         },
  "Account_Name__c" : "Adler-Apotheke",
  "NumberOfExpectedItemLines__c" : "2", 
  "External_Id__c" : "API_O_1001"
  },
  {
  "attributes" : {"type" : "API_Order__c", "referenceId" : "ref2"},
  "SourceFile__c" : "DE_1A_MSV3",
  "Order_Date__c" : "2017-07-07",
  "Account__r" : 
         {
         "External_ID_vod__c":"WDEF01663170"
         },
  "Account_Name__c" : "Adler-Apotheke",
  "NumberOfExpectedItemLines__c" : "2",
  "External_Id__c" : "API_O_1002"
   }]
}

I have the ERROR  message: Cannot reference a foreign key field Account__r.


Any help?  

Thanks in advance Csaba
Hello there,

I am having below requirement.
In salesforce when a record is updated then send data of that record to external system using reset API JSON file.
I have written below code but I am not sure whether I am going in right direction 

Trigger

rigger ImplementationPlanActivity on Implementation_Plan_Activity__c (after update) {
    Trigger_Settings__c triggerSettings = Trigger_Settings__c.getInstance();
    if(triggerSettings.ImplementationPlanActivity__c == false){
        return;
    }
            set<Id> IPAIdSet=new Set<Id>();
            for(Implementation_Plan_Activity__c IPArecord : trigger.new ){
                IPAIdSet.add(IPArecord .id);
            }
            IPAResetAPIClass.IPAData(IPAIdSet);

        }
    }
Webservice class

global class IPAResetAPIClass{
@future(callout=true)
    global static void IPAData(Set<Id> newIPASetId){
    
        List<Implementation_Plan_Activity__c> ipaNewList=[SELECT id,Name,
                                                                    Account_Manager__r.Name,
                                                                    Account_Manager__r.Email,
                                                                    Account_Specialist__r.Name,
                                                                    Account_Specialist__r.Email,    
                                                                    SFID18__c ,
                                                                    RecordTypeId
                                                            FROM Implementation_Plan_Activity__c where Id IN : newIPASetId];
        
        List<impWarpperClass> warpperIPAList=new List<impWarpperClass>();
        
            warpperIPAList.add(new impWarpperClass(ipaNewList[0].id,
                                                    ipaNewList[0].Name,
                                                    ipaNewList[0].Account_Manager__r.Name,
                                                    ipaNewList[0].Account_Manager__r.Email,
                                                    ipaNewList[0].Account_Specialist__r.Name,
                                                    ipaNewList[0].Account_Specialist__r.Email,
                                                    ipaNewList[0].SFID18__c,
                                                    ipaNewList[0].RecordTypeId));
        
 
       RecordType recordTypeRecord=[Select id,Name from RecordType  where id=:ipaNewList[0].RecordTypeId limit 1];
       
       string  resource=null;
       if(recordTypeRecord.Name=='Auto Provisioning'){
           resource='Auto Provisioning';
       }
       else if(recordTypeRecord.Name =='Workbook'){
           resource='Workbook';
        }      
        system.debug('*********warpperIPAList='+warpperIPAList);
        
        string JSONString=JSON.serializePretty(warpperIPAList);
        system.debug('*********serialized imp='+JSONString);
        
        string endURL;
        
        endURL=geURL+resource+'/'+ipaNewList[0].id;
        system.debug('*********endURL='+endURL);
        HttpRequest req=new HttpRequest();
        //Set HttpRequest Method
        req.setMethod('POST');
      
        req.setHeader('content-type', 'application/json');
        //Set HTTPRequest Endpoint dummy url
        req.setEndpoint('http://requestb.in/13auzf41');
        //req.setEndpoint(endURL);
        
        //Set HTTP Request Body
        req.setBody(JSONString);
        Http http = new Http();
        try{
            HTTPResponse res = http.send(req);
            //Helpful debug messages
            System.debug(res.toString());
            System.debug('STATUS:'+res.getStatus());
            System.debug('STATUS_CODE:'+res.getStatusCode());
            System.debug('Content: ' + res.getBody());
            
            //we can create success object record
        }
        catch(Exception e){
            System.debug('******* error message='+e);
            //we can create error object record
        }
    
    }
    
    global class impWarpperClass{
    
        global string IPAId{get;set;}
        global string IPAName{get;set;}   
        global string IPAAccManagerName{get;set;}   
        global string IPAAccManagerEmail{get;set;} 
        global string IPAAccSpecialListrName{get;set;}   
        global string IPAAccSpecialListEmail{get;set;} 
           
        global string IPASFDCId{get;set;}
        global string IPARecordTypeId{get;set;}
        
        global impWarpperClass(string IPAId,string IPAName,
                                        string IPAAccManagerName,
                                        String IPAAccManagerEmail,
                                        string IPAAccSpecialListrName,
                                        string IPAAccSpecialListEmail,
                                        string IPASFDCId,
                                        string IPARecordTypeId){
            this.IPAId=IPAId;
            this.IPAName=IPAName;
            this.IPAAccManagerName=IPAAccManagerName;
            this.IPAAccManagerEmail=IPAAccManagerEmail;
            this.IPAAccSpecialListrName=IPAAccSpecialListrName;
            this.IPAAccManagerEmail=IPAAccSpecialListEmail;
            this.IPASFDCId=IPASFDCId;
            this.IPARecordTypeId=IPARecordTypeId;
            
        }
       
    }
  
       }

}
am I going right dirction. is this correct way to send data from salesforce to external system using rest api JSON file.
If I am wrong can any please let me know how can I expose salesforce data to external system when records is updted in salesforce.
Thank you.
  • December 28, 2016
  • Like
  • 0
Hi there,

I know Batch class is asynchronous

I am having a requirement where the soql will get larger set of data with all the joining queries.
I need to display larger data   on excel sheet when I click on vf page button.

By using normal apex class soql  will only return 50,000 records . so I thought of using apex batch and process the soql and then display the results in excel sheet.

is it possible to display apex batch results on excel ? or is there any other where we can process more than 1 million data and display on excel sheet.
 
  • August 25, 2016
  • Like
  • 0
Hi there I have created excel workbook with help of XML Spreadsheet Reference.
I am unable to insert the image in the sheet.
can any one please suggest me how to insert an image in the sheet.
below is the code which i have used to generate sheet with multiple tabs.
<apex:page id="pg" standardStylesheets="false" controller="MorningReportwithExcelTabs" contenttype="application/vnd.ms-excel#CAMorningReportWithMultipleTabs.xls" >

{!xmlheader}

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
        <WindowHeight>8535</WindowHeight>
        <WindowWidth>12345</WindowWidth>
        <WindowTopX>480</WindowTopX>
        <WindowTopY>90</WindowTopY>
        <ProtectStructure>False</ProtectStructure>
        <ProtectWindows>False</ProtectWindows>
    </ExcelWorkbook>
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
    <Author></Author>
    <LastAuthor></LastAuthor>
    <Company></Company>
    <Version>11.6360</Version>
    </DocumentProperties>
    <Styles>
        <Style ss:ID="Default" ss:Name="Normal">
        <Alignment ss:Vertical="Bottom"/>
        <Borders/>
        <Font ss:bgcolor="#FF0000"/>
        <Interior ss:bgcolor="#FF0000"/>
        <NumberFormat/>
        <Protection/>
    </Style>
    <Style ss:ID="s16">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#FFFFFF" ss:Bold="1" ss:Italic="1"/>
        <Interior ss:Color="#92D050" ss:Pattern="Solid"/>
        <Alignment ss:Horizontal="CenterAcrossSelection"/>
    </Style>
    <Style ss:ID="s23">
        <Font x:Family="Swiss" ss:Bold="0" ss:bgcolor="#FF0000"/>
        
    </Style>
 <Worksheet ss:Name="Top 5 Daily Orders">
 <Table ss:ExpandedColumnCount="200">


        <Column ss:Width="200"/>
        <Column ss:Width="200"/>
        <Column ss:Width="80"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>
        <Column ss:Width="100"/>

            
            <Row>
                <Cell ss:StyleID="s16" ><Data ss:Type="String">Rep Name</Data></Cell>
                <Cell ss:StyleID="s16" ><Data ss:Type="String">Bill to </Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">State</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">Ready</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">Toolbox w/I-Ready</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">i-Ready</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">Training</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">Brigance</Data></Cell>
                <Cell ss:StyleID="s16"><Data ss:Type="String">Other</Data></Cell>
                <Cell ss:StyleID="s24"><Data ss:Type="String">TOTAL</Data></Cell>
                
            </Row>
            
            <Row>
                <Cell ss:StyleID="s23"><Data ss:Type="String">OGDEN</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">ELK GROVE USD</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">CA</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">123456678901</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2343</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2344</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">23342</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2342432</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">55789</Data></Cell>
                <Cell ss:StyleID="s24"><Data ss:Type="Number">23424543</Data></Cell>
            
            </Row>
            
            <Row>
                <Cell ss:StyleID="s23"><Data ss:Type="String">SHARZER</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">ELK GROVE USD</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">CA</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">3,220</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">4,210</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">5,320</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2,456,100</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">23,456,789</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">45675</Data></Cell>
                <Cell ss:StyleID="s24"><Data ss:Type="Number">176100</Data></Cell>
            
            </Row>
            
            <Row>
                <Cell ss:StyleID="s23"><Data ss:Type="String">DOMESTIC HOUSE</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">ELK GROVE USD</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">CA</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">3,220</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">4,210</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">5,320</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2,456,100</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">23,456,789</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">67788</Data></Cell>
                <Cell ss:StyleID="s24"><Data ss:Type="Number">176100</Data></Cell>
            
            </Row>
            
            <Row>
                <Cell ss:StyleID="s23"><Data ss:Type="String">MCMATH</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">ELK GROVE USD</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="String">CA</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">3,220</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">4,210</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">5,320</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">2,456,100</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">23,456,789</Data></Cell>
                <Cell ss:StyleID="s30"><Data ss:Type="Number">87766</Data></Cell>
                <Cell ss:StyleID="s24"><Data ss:Type="Number">176100</Data></Cell>
            
            </Row>
  • March 07, 2016
  • Like
  • 0
i have created
1.AnimalLocator User-added image



2.AnimalLocatorMock
User-added image

3.AnimalLocatorTest

User-added image


error i am getting

User-added image

please help me
Hi,
Need help in udnerstanding the error type and resolving the same.​
System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden

We are trying to integrate with Perlchain CPQ machine, There is no provision for passing the user name and password in the wsdl provided by CPQ. I have followed the link and tweaked to pass these two as part of header.
http://blog.dacology.com/callouts-from-salesforce-adding-soap-headers-for-wsse-security/

I'm still getting the error, 
System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden

Need help in resolving this.

//Generated by wsdl2apex

public class xsServicesOp {

        public class Security {
            public UsernameToken usernameToken;
            private String[] usernameToken_type_info = new String[]{'UsernameToken','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','UsernameToken','0','1','true'};
            private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
            private String[] field_order_type_info = new String[]{'usernameToken'};
        }
        public class UsernameToken {
            public String username;
            public String password;
            private String[] username_type_info = new String[]{'Username','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','string','0','1','true'};
            private String[] password_type_info = new String[]{'Password','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','string','1','1','true'};
            private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
            private String[] field_order_type_info = new String[]{'username','password'};
        }  
    public class CreateOpportunityPortType {
        public String endpoint_x = //'http://localhost:8010/CreateOpptyMed/1';
           (I have replace endpoint with the correct url)
                                    
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
            //instantiate the header
            public UsernameToken userToken;
            public Security Header;
            private String Header_hns = 'Security=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
            //end
        private String[] ns_map_type_info = new String[]{'http://www.test.machine/messages/opportunity/1', 'CdmMessagesOpport', 'http://www.test.machine/opportunity/1', 'CdmOpportunity', 'http://www.test.machine/services/opportunity/1', 'CdmServicesOpport', 'http://www.test.machine/common/1', 'CdmCommon', 'urn:codelist:ISO639-2-2002', 'CdmCodelist', 'http://www.test.machine/customer/1', 'CdmCustomer'};
        public CdmMessagesOpport.CreateOpportunityResponseMessageType CreateOpportunity(CdmOpportunity.OpportunityType Opportunity,CdmOpportunity.AccountType Account,CdmOpportunity.ProductsType[] Products) {
            CdmMessagesOpport.CreateOpportunityRequestMessageType request_x = new CdmMessagesOpport.CreateOpportunityRequestMessageType();
            request_x.Opportunity = Opportunity;
            request_x.Account = Account;
            request_x.Products = Products;
            CdmMessagesOpport.CreateOpportunityResponseMessageType response_x;
            Map<String, CdmMessagesOpport.CreateOpportunityResponseMessageType> response_map_x = new Map<String, CdmMessagesOpport.CreateOpportunityResponseMessageType>();
            response_map_x.put('response_x', response_x);
            
            userToken = new UsernameToken();
            userToken.username = 'onecanon';
            userToken.password = 'password';


            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://www.test.machine/services/opportunity/1',
              'CreateOpportunityRequestMessage',
              'http://www.test.machine/services/opportunity/1',
              'CreateOpportunityResponseMessage',
              'CdmMessagesOpport.CreateOpportunityResponseMessageType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }
    }
}

 
Hello everybody,

I would like to run a report (Matrix report with lookup and formula fields) from Apex with the code below:

// Get the report ID
List <Report> reportList = [SELECT Id,DeveloperName FROM Report where 
    DeveloperName = 'My_custom_report'];
String reportId = (String)reportList.get(0).get('Id');

// Run a report synchronously
Reports.reportResults results = Reports.ReportManager.runReport(reportId);

The following exception is thrown:

reports.MetadataException: Can't run the report because it doesn't have any columns selected. Be sure to add fields as columns to the report through the user interface.

Can somebody explain me what the problem is?

Cheers

HI all,

 

I want to do sorting of map based on value. here is code:

 

for (Pricebook2 pb : [select id, Name from Pricebook2 where id in :ids order by name])
        {
            myPBNames.put(pb.id, pb.name);
        }

 

Results are got sorted based on id. But i want this should be based on name.

 

Even Order by is not working. Please suggest.