• Prady01
  • SMARTIE
  • 997 Points
  • Member since 2010

  • Chatter
    Feed
  • 18
    Best Answers
  • 13
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 137
    Replies

Hello folks,

I have a problem with displaying my visualforce page. What I have right now ist this:
User-added image
What I want is this:

User-added image

  • <apex:form style="width:100%"> is fine and should stay this way (displaying the checkboxes and the commandButtons)
  • <apex:map width="70%"> seems to be working as well (displaying the map)
  • <apex:pageBlockTable width="30%"> is what seems to be the problem (displaying a table)

User-added image
Here is my Page:

 

<apex:page standardcontroller="Account" extensions="FindNearbyController" docType="html-5.0" lightningStylesheets="true" action="{!findNearby}"> 

    <apex:pageBlock >
      <apex:pageBlockSection columns="1" id="geomap">
         

      <apex:outputText style="font-size:19px;" value="
       
      {!IF(myInput = 'ger' && fcb = true,
       
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} deutschlandweit gefunden.',    
      
       IF(myInput = 'state'  && fcb = false, 
       
       '{0} Kunden aus den letzten {1} Tagen in {5} gefunden.',
            
        IF(myInput = 'state' && fcb = true,
        
       '{0} Kunden aus den letzten {1} Tagen in der Branche {2} in {5} gefunden.', 
       
       IF(myInput != 'state' && myInput != 'ger' && fcb = true,
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen in der Branche {2} gefunden.',
       
       '{0} Kunden im {3} km Umkreis aus den letzten {1} Tagen gefunden.'
       
       ))))}">
       
       <apex:param value="{!warehouses.size}"/>
       <apex:param value="{!myTime}"/>
       <apex:param value="{!currentAccount.WZ_Abteilung__c}"/>
       <apex:param value="{!myInput}"/>
       <apex:param value="{!currentAccount.Name}"/>
       <apex:param value="{!currentAccount.ShippingState}"/>
       
       </apex:outputText> 

        <apex:form style="width:100%">
        
        
          <!-- FILTER 1 (Branche) --> 
        <apex:inputCheckBox id="filter1" disabled="{!currentAccount.WZ_Buchstabe__c = null || myinput = 'ger' }" value="{!fcb}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter1" value="nur aus verwandter Branche ({!currentAccount.WZ_Abteilung__c})" />
      
        <!-- FILTER 2 (Owner) -->     
        <apex:inputCheckBox id="filter2" value="{!fco}" >
        <apex:actionSupport event="onclick" action="{!findNearby}" rerender="geomap"/>
        </apex:inputCheckBox>
        <apex:outputLabel for="filter2" value="nur meine Kunden" />
  
    <!-- Textfeld zur Angabe von km -->
          <apex:inputText value="{!myinput}" style="width:60px" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
          <apex:commandButton value="Umkreis anpassen (in km)" rerender="geomap" action="{!findNearby}" rendered="{!myinput != 'ger' && myinput != 'state' }"/>
                  
         <!-- Button zurück -->  
        <apex:commandButton action="{!findNearby}" value="Zurück zur lokalen Suche" reRender="geomap" rendered="{!myinput = 'ger' || myinput = 'state' }">
         <apex:param assignTo="{!myInput}" name="back" id="back" value="{!currentAccount.MetaData_Distance_Customer__c}"/>
        </apex:commandButton>
                
              <!-- Button deutschlandweit --> 
        <apex:commandButton action="{!findNearby}" value="Deutschlandweit" reRender="geomap" rendered="{!myinput != 'ger'}" disabled="{!IF(fcb = false && fco = true,false,IF(fcb = true && fco = true,false,IF(fcb = true && fco = false,false,true)))}">
         <apex:param assignTo="{!myInput}" name="ger" id="ger" value="ger"/>
        </apex:commandButton>
        
        <!-- Button Bundesland-->  
        <apex:commandButton action="{!findNearby}" value="nur in {!currentAccount.ShippingState}" reRender="geomap" rendered="{!myinput != 'state'}">
         <apex:param assignTo="{!myInput}" name="state" id="state" value="state"/>
        </apex:commandButton>
  
     <!-- Textfeld zur Angabe von Zeitraum -->     
          <apex:inputText value="{!myTime}" style="width:60px"/>
          <apex:commandButton value="Zeitraum anpassen (in Tagen)" rerender="geomap" action="{!findNearby}"/>
      
 
    
        </apex:form> 

            <apex:map width="70%" height="300px" mapType="roadmap" center="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" showOnlyActiveInfoWindow="false" >
            
          
             <!-- Add a CUSTOM map marker for the current account -->
             <apex:mapMarker title="{! currentAccount.Name }" position="{!currentAccount.ShippingStreet},{!currentAccount.ShippingState},{!currentAccount.ShippingCity},{!currentAccount.ShippingPostalCode}" icon="{!URLFOR($Resource.location)}"/> 
            
            <!-- Add a CUSTOM map marker for the account list -->

                <apex:repeat value="{!warehouses}" var="war">
                    <apex:mapMarker position="{!war.GeoLocPosition__c}" title="{!war.Name}" 
                    icon="{!IF(war.AE_letzte_12_Monate__c > 5000,URLFOR($Resource.ms_star),
                            IF(war.AD_MS_Rel_Anzahl_bez__c <= currentAccount.AD_MS_Rel_Anzahl_bez__c && war.WirtschaftszweigWZ08__c = currentAccount.WirtschaftszweigWZ08__c && war.Mitarbeiternzahl_final__c = currentAccount.Mitarbeiternzahl_final__c,URLFOR($Resource.perfect_fit),
                            IF(war.Accountinhaber_Text__c= 'JOB SHOP',URLFOR($Resource.shop),
                    
                    URLFOR($Resource.ms_marker))))}" >
            

            <!-- Add Info markers -->
                    
                    <apex:mapInfoWindow >
                                                         
                    <!-- Name + Link -->
                     <apex:outputPanel layout="block" style="font-weight: bold;">
                     <apex:outputLink value="{! '/' + war.Id}">
                    <apex:outputText >{! war.Name }</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                      
                    <!-- Straße -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.ShippingStreet }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Owner -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Accountinhaber_Text__c }</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Vertriebskanal -->
                    <apex:outputPanel layout="block">
                    <apex:outputText >{! war.Auftragseingangstyp__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Index -->
                     <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.indexurl__c}">
                    <apex:outputText >{!war.anzeigendaten_de_ID_account__c}</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                        
                    <!-- Branche -->
                     <apex:outputPanel layout="block">
                    <apex:outputText >{! war.WirtschaftszweigWZ08__c}</apex:outputText>
                    </apex:outputPanel>
                    
                    <!-- Link zum Customer Cockpit -->
                    <apex:outputPanel layout="block">
                   <apex:outputLink value="{!war.URL_zum_CC__c}">
                    <apex:outputText >zum Customer Cockpit</apex:outputText>
                    </apex:outputLink>
                    </apex:outputPanel>
                                                         
                    </apex:mapInfoWindow>

                    </apex:mapMarker>
                </apex:repeat>
            </apex:map>

    <!-- TABLE -->
        <apex:pageBlockTable width="30%" value="{!warehouses}"  var="war" >
              
         <apex:column > <input type="checkbox" />
         <apex:facet name="header">Kunde</apex:facet><apex:outputLink value="/{!war.Id}" target="_blank">{!war.Name}</apex:outputLink>
         </apex:column>
         
   <!--      <apex:column ><apex:facet name="header">Straße</apex:facet>{!war.ShippingStreet}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Stadt</apex:facet>{!war.ShippingCity}</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Inhaber</apex:facet>{!war.Accountinhaber_Text__c }</apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Index</apex:facet><apex:outputLink value="{!war.indexurl__c}" target="_blank">{!war.anzeigendaten_de_ID_account__c}</apex:outputLink></apex:column> -->
   <!--      <apex:column ><apex:facet name="header">Customer Cockpit</apex:facet><apex:outputLink value="{!war.URL_zum_CC__c}" target="_blank">zum Customer Cockpit</apex:outputLink></apex:column> -->

      </apex:pageBlockTable>

        </apex:pageBlockSection>

    </apex:pageBlock>
    
    
</apex:page>

When I switch from <apex:pageBlockSection columns="1"> to <apex:pageBlockSection columns="2"> it gets all messed up:

User-added image

What do I have to do?

Hi to everybody,
I need to aggregate some information from a Parent to Child Relationship Query.

For example, with the following basic query:
SELECT Account.Name,(SELECT Contact.Name FROM contacts) FROM Account

I'd like to count the number of contacts for a specific account.
Is that possible?

Thank you!


 
Hello All, 

    Running into problems whilst deleting a custom object. Please help! Attaching the error screenshot ...

User-added image
Regards
Rey
 
Hi,

I am running in to an issue that I was hoping someone might have some insight in to. I have a method in a class triggered by contact insert or update. This method will check to see if a contact has a box checked and if it does, it will create a correspondinng user record with the ContactId set to the Id of the contact that was being created/edited. 

The issue that I am having is with the test code coverage. I am getting the error "UNKNOWN_EXCEPTION, portal account owner must have a role". Now I have seen the workaround for this by creating a user with a role and then putting the community user creation code inside System.runAs context with the user you created. This works for community users created in the test class itself, however, if the test class is not actually creating the community user directly, but rather by creating a contact which triggers the class mentioned above to create a community user, it fails with the same role error mentioned above. 

In all my searching, all I have found is a solution to the first issue where the community user is being created in the test class itself. I have not found any info for resolving it if the test class it then calling out to another class that creates the user. Any info on how I might be able to resolve would be greatly appreciated.

Thanks,

Chris
 
The JSON format is like this
{

"GenerationTime": "20200119170533",
"ResponseCode": "MSK",
"ValidationExceptions": [
    {
        "SettlementDate": "20200113",
        "MSL": "_A",
        "MSN": {
                "ImportMSID": 1000000000059,
                "ExportMSID": null
               },
        "MRA": {
                        "SettlementPeriod": 34,
                        "DeliveredVolume": 23.21,
                        "ExceptionReason": "The import volume doesnot match with the actual allocation"
                    }
    },
    {
        "SettlementDate": "20200114",
        "MSL": "_B",
        "MSN": {
                "ImportMSID": 1000000000060,
                "ExportMSID": null
               },
        "MRA": {
                        "SettlementPeriod": 45,
                        "DeliveredVolume": 21.21,
                        "ExceptionReason": "The import volume doesnot match with the actual allocation"
                    }
    }
]
}

i wrote the wrapper class for it as
public class ExcFileWrapper{
    Public String GenerationTime; 
    Public String ResponseCode;
    Public List <ValidationExcepWrapper> ValidationExceptions; 

    public class ValidationExcepWrapper{ 
        Public String SettlementDate; //20200113"
        Public String MSL; //_A"
        public MSNWrapper MSN;
        Public MRAWrapper MRA;
    }
    public class MSNWrapper {
        Public String ImportMSID;
        Public String ExportMSID;
    }
    Public class MRAWrapper{
        Public integer SettlementPeriod;
        Public decimal DeliveredVolume;
        Public String ExceptionReason;
    }
}

After searching i found this is the correct way to write wrapper class for the JSON. But getting error as "Inner types are not allowed to have inner types". Where can i make change to eliminate this error?
public class StockListController {
    
public List<Stock_Item__c> getStockItems() {
    
    List<Stock_Item__c> results = Database.query(
        'SELECT ID, Item_Name__c, Item_Stock_is_Low__c, Minimum_Stock_Level__c, Stock_on_Hand__c ' +
        'FROM Stock_Item__c ' +
        'WHERE Item_Stock_is_Low__c = true'
    );
    return results;
}
}    



<apex:page lightningStyleSheets="true" Controller="StockListController">
    <apex:form>
        <apex:pageBlock title="Low Stock Items" id="stock_item_list">
            
            <!-- Stock Item List goes here -->
            <apex:pageBlockTable value="{! StockItems }" var="si">
                <apex:column value="{! si.ID }"/>
                <apex:column value="{! si.Item_Name__c }"/>
                <apex:column value="{! si.Item_Stock_is_Low__c }"/>
                <apex:column value="{! si.Minimum_Stock_Level__c }"/>
                <apex:column value="{! si.Stock_on_Hand__c }"/>
    
</apex:pageBlockTable>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

User-added image
How to display multiple line toast messages? 
Hii Friends,
Please help me.
The below javascript code on custom detail page button  shows error on click it.
--------------------------------------------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/47.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/47.0/apex.js")} 

var tempID='{!Offers_Appraisals__c.Id}';
if({!Offers_Appraisals__c.Id}!=Null)
{
sforce.apex.execute("NanoHRSheet","HRSalarySheet",tempID);
}
--------------------------------------------------------------------------------------
Error:
User-added image

What's wrong with code?
Please help me.
Thank you
Hi All,
My requirement is to open a custom lightning modal from the detail page and do the business logic. Like the following New Contact standard modal using button.
Example

Thanks in advance
Hi everybody,
I am stuck with how to modify security settings using triigers.
Please help me to write the following trigger.
Set the OWD on the opportunity as private and Remove modify all permission on a profile using trigger.
Hi, I am new to Apex. I have the below doubt,
trigger ClosedOpportunity on Opportunity (after update) {
    List<task> carry=New List<task>();
    for(opportunity opp:trigger.new){
    if(opp.stagename=='Closed won'){
     task t=new task(
         whatid=opp.id,
         status='Active',
         Subject='Follow Up Opp Task',
         ActivityDate=system.today()
     ) ; 
        carry.add(t);
    }
        }
    insert carry;
}
In the above, code. Its working when i am putting "Insert carry" But not working if i want to put "Insert t", As i can see both are instances created, so why do i have to create "carry" and add "t" in that. Why not i can "insert t" directly ?
 

Hello all,

I've been trying for awhile to create a list button that will allow the creation of multiple child records of the same parent record on one Visualforce page (rather than clicking save and new over and over). I need to pass the parent ID and assign a record type, and I'd prefer that happen without the user having to do anything other than click the button on the related list. My visualforce page works in that if I preview it, I can see each field in a column, and the "add" link is working to add new rows. However, the parent ID isn't getting passed, I can't figure out how to assign the record type ID, and the "x" link to delete a row isn't working.

I've posted on the forum about this multiple times, but have not received many replies.

This would be a huge help for the organizations I work with, and I'd be willing to pay for a few hours of someone's time to help me get the code right. Any one interested in helping me out?

global class UpdateTheValue implements Database.Batchable<Employee_Detail__c>
{
   global final String Query;
   global integer Available_Leave__c;
global SummarizeAccountTotal(String q)
{
       Query=q;
   }

   global Database.QueryLocator start(Database.BatchableContext BC){
      return Database.getQueryLocator(query);
   }
   
   global void execute(Database.BatchableContext BC,List<Employee_Detail__c> scope){
      for(Employee_Detail__c s : scope)
      {
         Available_Leave__c= Integer.valueOf(s.get('Available_Leave__c'))+4;
      }
       update scope;
   }

global void finish(Database.BatchableContext BC){
   }
}

Error:class UpdateTheValue must be implement method:system.iterable Database.Batchable.start.(Database.batchablecontext)
How I can show 5000 Record On the Vf page without using pagination and attribute readonly?
Dear Team ,

Greetings !!!

I am performing REST API UsingWeather Example . M refering this website https://focusonforce.com/integration-and-data-loading/rest-api-using-weather-example/ . On my visual force m experiencing error . Plz have a look on my Code and snapshot .  I enable my API moreover configuration settings also i made . Plz help me to solve this issue .

User-added image
APEX Class :

public with sharing class testopenweather {

	public String city {get;set;}
	public String temp {get;set;}
	public String pressure {get;set;}
	public String humidity {get;set;}
	public String temp_min {get;set;}
	public String temp_max {get;set;}

	public testopenweather(ApexPages.StandardController stdController) {
		Account account = (Account)stdController.getRecord();
		account = [SELECT Id, ShippingCity FROM Account WHERE Id =:account.Id];
		//account = [SELECT Id, ShippingCity FROM Account WHERE Id ='0012v00002pNKoyAAG'];
        
		String accountCity = account.ShippingCity;
		String apiKey = '0284633ceb975c6164fa90f016d87e02';

		String requestEndpoint = 'http://api.openweather.org/data/2.5/weather';
		requestEndpoint += '?q=' + accountCity;
		requestEndpoint += '&units=metric';
		requestEndpoint += '&APPID=' + apiKey;
		
		Http http = new Http();
		HttpRequest request = new HttpRequest();
		request.setEndpoint(requestEndpoint);
		request.setMethod('GET');
		HttpResponse response = http.send(request);

		// If the request is successful, parse the JSON response.
		if (response.getStatusCode() == 200) {

		   // Deserialize the JSON string into collections of primitive data types.
		  Map<string,object> results=( Map<string,object>)JSON.deserializeUntyped(response.getBody());
           // city=string.valueof(result.get('name'));
           city = String.valueOf(results.get('name')); 
             Map<string,object> mainresults=( Map<string,object>)(results.get('main'));
            temp = string.valueOf(mainresults.get('temp'));
             pressure = string.valueOf(mainresults.get(' pressure'));
             humidity = string.valueOf(mainresults.get('humidity'));
             temp_min = string.valueOf(mainresults.get('temp_min'));
             temp_max = string.valueOf(mainresults.get('temp_max'));
            
        }
        else {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Tere was an error');
            ApexPages.addMessage(myMsg);
            
        }
    }
}

Visual Force :

<apex:page standardController="Account" extensions="testopenweather" showHeader="false" sidebar="false">
    <apex:pageBlock title="{!city} Weather">
		<apex:pageBlockSection>

			<apex:pageMessages/>

			<apex:outputText label="Temperature" value="{!temp}"/>
			<apex:outputText label="Pressure" value="{!pressure}"/>
			<apex:outputText label="Humidity" value="{!humidity}"/>
			<apex:outputText label="Minimum Temperature" value="{!temp_min}"/>
			<apex:outputText label="Maximum Temperature" value="{!temp_max}"/>

		</apex:pageBlockSection>
	</apex:pageBlock>
</apex:page>
Thanks & Regards
Sachin Bhalerao
 

I have a Webservice which sends me transactions. We want to track the changes record by record just as a Bank Statement. We are using webservice to store Credit and Debit amount.

In the trigger we are quering for the last record [I know this is not what best practice says, but was not able think of a better way] and then calculating the balance for this record.

trigger:

trigger ASM_Balance on Assembly_Transactions__c (before insert) {
    
    List<Assembly_Transactions__c> trans = [SELECT ID, balance__c FROM Assembly_Transactions__c WHERE Wallet_Owner__c =: Trigger.new[0].Wallet_Owner__c ORDER BY CreatedDate DESC LIMIT 1];
    
    Double balance = 0;
    if(trans.size()>0)
    {
        if(trans[0].balance__c != null)
            balance = trans[0].balance__c;
    }
    Assembly_Transactions__c tr = Trigger.new[0];
    Double cr = tr.credit__c;
    Double dt = tr.debit__c;
    Double amount = balance+cr-dt;
    tr.balance__c = amount;
}

The error occours when we have two transactions at the same time, and the webservice is hit back to back. 

I think this is due to SOQL being run just before we have the last transaction inserted successfully. 

Please help me out with suggestions.

When I open any opportunity from the outlook sidepanel, there is a Log button to the top extreme right, which actually opens a page to send an email.
Is there any way to remove that log button?
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.Opportunity)};
var updateRecords = [];

if (records[0] == null) { //if the button was clicked but there was no record selected
alert("Please select at least one record to update."); //alert the user that they didn't make a selection
} else { //otherwise, there was a record selection
for (var a=0; a<records.length; a++) { //for all records
var update_Opportunity = new sforce.SObject("Opportunity"); //create a new sObject for storing updated record details
update_Opportunity.Id = records[a]; //set the Id of the selected Opportunity record
update_Opportunity.OwnerID= "0050V0000073CQuQAM"; //set the value for Status to 'Unqualified'
updateRecords.push(update_Opportunity); //add the updated record to our array
}
result = sforce.connection.update(updateRecords); //push the updated records back to Salesforce
parent.location.href = url; //refresh the page
}