• Alex Makk
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 14
    Replies
Hi everyone!

I'm having the following JSON:
 
{
	"log": {
		"id": 776812465,
		"date": "2022-02-25",
		"vehicles": [
			{
				"vehicle": {
					"id": 112334,
					"number": "308 R"
				}
			},
			{
				"vehicle": {
					"id": 112337,
					"number": "#309",

				}
			}
		],
		"odometers": {
			"#309": [
				{
					"end": 83810,
					"start": 83810,
					"metric_units": false
				},
				{
					"end": 83823,
					"start": 83810,
					"metric_units": false
				}
			],
			"308 R": [
				{
					"end": 194414,
					"start": 194310,
					"metric_units": false
				},
				{
					"end": 194487,
					"start": 194414,
					"metric_units": false
				}
			]
		}
	}
}

I used JSON to APEX tool to get wrapper class:
 
public class fromJSON{
	public cls_log log;
	class cls_log {
		public Integer id;	//776812465
		public String date;	//2022-02-25
		public cls_vehicles[] vehicles;
		public cls_odometers odometers;
	}
	class cls_vehicles {
		public cls_vehicle vehicle;
	}
	class cls_vehicle {
		public Integer id;	//112334
		public String number;	//308 R
	}
	class cls_odometers {
		public cls_#309[] #309;
		public cls_308 R[] 308 R;
	}
	class cls_#309 {
		public Integer end;	//83810
		public Integer start;	//83810
		public boolean metric_units;
	}
	class cls_308 R {
		public Integer end;	//194414
		public Integer start;	//194310
		public boolean metric_units;
	}
	public static fromJSON parse(String json){
		return (fromJSON) System.JSON.deserialize(json, fromJSON.class);
	}
}

The problem I'm facing is that vehicle numbers under odometers will be always different. So I can't have something like:
public cls_#309[] #309;
public cls_308 R[] 308 R;
Please advise how I can process this dynamically via wrapper class. Thank you!
 
Hello, I'm trying to follow API instructions and I'm stuck at the very beginning. Here is what it says:

Following the example, POST the username and password fields with your email and password, along with the grant_type value of password, to the https://api.safetyculture.io/auth endpoint.
 
curl \
  -X POST \
  --data-urlencode username=example@safetyculture.io \
  --data-urlencode password=your_password \
  -d grant_type=password \
  "https://api.safetyculture.io/auth"
Here is what I do:
String username = 'some.email@domain.com';
String password = 'apple';

HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.safetyculture.io/auth');
req.setMethod('POST');
req.setbody('username='+username+'&password='+password+'&grant_type=password');

Http http = new Http();
HTTPResponse response = http.send(req);

In debug logs I get:
13:17:54:754 CALLOUT_RESPONSE [15]|System.HttpResponse[Status=Bad Request, StatusCode=400]

Please advise. Thank you!
 
Hello, I'm trying to figure out how to get the summary table that will break down data by building, then by the station. At the bottom of each group, it should show subtotals. The last row should display totals per table.

Here is what the end result should look like:
User-added imageHere is what I have now:
User-added image
Here is my controller:
public Map<String, StationListWrapper> getStationTracking() {
		Map<String, StationListWrapper> StationTracking = new Map<String, StationListWrapper>();
		if (logisticId != null) {
			List<Station_Tracking_Metrics__c> st = [SELECT Building_Area_Name__c, Name, Product_Name__c, Picked_Up__c, Delivered__c
			      FROM Station_Tracking_Metrics__c
			      WHERE EPUD__c = :logisticId];
			
			for(Station_Tracking_Metrics__c s: st){
				if(null == s.Building_Area_Name__c) continue;
					StationListWrapper wrapper = StationTracking.get(s.Name);
					if(wrapper == null){
						StationTracking.put(s.Name, new StationListWrapper(new List<Station_Tracking_Metrics__c>()));
					}
					StationTracking.get(s.Name).stationList.add(s);
			}
		}
		return StationTracking;
	}
Here is my VF page component:
<apex:attribute name="LogId" type="String" description="Id of the EPUD" assignTo="{!logisticId}"/>
    <table  width="200px">
        <tr>
            <th>Station</th>
            <th>Product</th>
            <th>Picked Up</th>
            <th>Delivered</th>
        </tr>
        
    <apex:repeat value="{!StationTracking}" var="key">
        <apex:repeat value="{!StationTracking[key].stationList}" var="keyvalue">
            <tr>
                <td RowSpan="{!StationTracking[key].numOfStations}" Style="display:{!IF(CASESAFEID(keyvalue.id)==CASESAFEID(StationTracking[key].firstOfList), 'table-data','none')};">{!keyvalue.name}</td>
                <td>{!keyvalue.Product_Name__c}</td>
                <td>{!keyvalue.Picked_Up__c}</td>
                <td>{!keyvalue.Delivered__c}</td>
            </tr> 
        </apex:repeat>
    </apex:repeat>
    </table>
Please let me know if you have any ideas on how to achieve this. Thank you.
Hello, I have a simple controller that I'd like to test. And the issue is that 'wrapobj.toAdjust' is not getting new value within test class. I'm relatively new to this - please advise. Thank you!

Controller:
public  with Sharing class INV_Audit_tool {
    
    Id whid;
    public list<wrapinv> wrapinvList { get; set; }
    public String WhName { get; set; }
 
    public INV_Audit_tool(){
        whid=ApexPages.CurrentPage().getparameters().get('id'); 
        //system.debug('whid==>'+whid);
        wrapinvList = new list<wrapinv>();
        
        List<Inventory__c> invList= [SELECT Id, WH_Real_Available__c, Product__c,  Product__r.Name, Product__r.Family, Warehouse_Location__c, Warehouse_Location__r.Name
                              FROM Inventory__c 
                              WHERE Warehouse_Location__c=:whid 
                              AND (Product__r.Family != 'COG PPE' AND Product__r.Family != 'COG PPE Scrap') 
                              ORDER BY Product__r.Name ASC];
        
        //system.debug('invList.size()==>'+invList.size());
        for(Inventory__c i : invList){
            
            wrapinvList.add(new wrapinv(i, 0));
            WhName = i.Warehouse_Location__r.Name;
        }
    }
    
    public PageReference save(){
        List <Inventory_Transaction__c > tranToInsert = new List <Inventory_Transaction__c >();
        for(wrapinv wrapobj : wrapinvList){
        system.debug('@@@@@ '+wrapobj);
            if(wrapobj.toAdjust > 0){
                 decimal difference = wrapobj.inv.WH_Real_Available__c - wrapobj.toAdjust;
                 
                 Inventory_Transaction__c tempInvTransObj = new Inventory_Transaction__c();
                 tempInvTransObj.Product__c = wrapobj.inv.Product__c;
                 tempInvTransObj.Warehouse_Location1__c = whid;
                 tempInvTransObj.Quantity__c = wrapobj.toAdjust;
                 tempInvTransObj.Overwrite_Existing_QoH__c  = true;
                 tempInvTransObj.Message__c = 'Audit: Old Quantity ' + wrapobj.inv.WH_Real_Available__c + ' Difference after audit: ' +  difference;
                 tranToInsert.add(tempInvTransObj);  
            }
        }
        try{ 
            if(tranToInsert.size()>0){
                insert tranToInsert;
            }
        }catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,''+e.getMessage()));   
        }
        PageReference redirectPG;
        redirectPG = new PageReference('/'+whid);
        return redirectPG;
    }
    
     public PageReference Cancel(){
        PageReference redirectPG;
        redirectPG = new PageReference('/'+whid);
        return redirectPG;
    } 
    
    public class wrapinv{
        public Inventory__c inv{get;set;}
        public decimal toAdjust{get;set;}
        
        public wrapinv(Inventory__c  i, Decimal adj){
            inv=i;
            toAdjust = adj;
        }
    }
}

Test:
@isTest
private class INV_Audit_tool_test {
    static testMethod void INV_Audit_tool() {
    
    Warehouse_Location__c wh = new Warehouse_Location__c();
    wh.name = 'test';
    insert wh;
    
    product2 prod = new product2();
    prod.Name = 'Test';
    prod.family = 'Absorbents 16Oz';
    insert prod;
    
    Inventory__c inv = new Inventory__c();
    inv.product__c = prod.id;
    inv.Qty_on_Hand__c = 100;
    inv.Qty_allocated__c = 0;
    inv.Warehouse_Location__c = wh.id;
    insert inv;
    
    
       
    test.StartTest();
    
    PageReference pageRef = new PageReference('/apex/INV_Audit_tool');
        pageRef.getParameters().put('id' , wh.id);
        Test.setCurrentPageReference(pageRef);
        INV_Audit_tool audit = new  INV_Audit_tool();

        INV_Audit_tool.wrapinv whObj = new INV_Audit_tool.wrapinv(inv, 5);
      
        audit.save();
        audit.cancel();
       
    test.StopTest();
    
    }
}
Here is test result: wrapobj.ToAdjust is not getting test value of 5. It stays 0.

User-added image
​​​​​​​
Hello there, I'm relatively new to Apex and just wondering how I can get SUM from AgregatedResult per GROUP in a trigger.  We have Products that have different types. I want to know SUM per Type. Currently I do it like this:
 
AggregateResult[] groupedResultsServicesLine = [SELECT QuoteId,SUM(TotalPrice)ExtendedCostSum, SUM(Ext_Price__c)ExtPriceSum, SUM(For_Taxes__c)Taxes
                                                   FROM QuoteLineItem 
                                                   WHERE QuoteId in: QuoteIDs 
                                                   AND Product2.Type__c = 'Services'
                                                   AND Copied_from_Bundle__c = NULL 
                                                   GROUP by QuoteId];

As you see I filter by Product2.Type__c = 'Services' to get specific SUM for this type. Which means I have to do as many queries as we have types. I have a feeling there is a better way of doing that. I could GROUP BY Product2.Type__c but I'm not sure what is the syntax to get this value. Please advise. Thank you!
Hi all! I have following piece of a code that gives me error when I try to deploy:

Variable does not exist: PicklistDescriber

Any ideas?
 
public OpportunityWrapper(String accId, String accName, String oppTitalName, String recordTypeId){
            this.accId = accId;
            this.accName = accName;
            this.oppTitalName = oppTitalName;
            this.recordTypeId = recordTypeId;
            this.lstCurrentUsg = new List<SelectOption>();
            this.lstCurrentPPEType = new List<SelectOption>();
            this.lstCurrentDis = new List<SelectOption>();
            this.lstCompetition = new List<SelectOption>();
            this.lstDisContainer = new List<SelectOption>();

            
            this.oppObj = new Opportunity();
            this.oppObj.recordTypeId = recordTypeId;
            
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Current_Usage__c')) {
                this.lstCurrentUsg.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Current_PPE_Type__c')) {
                this.lstCurrentPPEType.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Disposal_Method__c')) {
                this.lstCurrentDis.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Competition__c')) {
                this.lstCompetition.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Disposal_Container__c')) {
                this.lstDisContainer.add(new SelectOption(optName, optName));
            }
        }
 

Hi all! Tried to use workflows, but it does not work with lookup fields. So I assume I need to use trigger. I need to take field data from Lookup_Field_1__c to Lookup_Field_2__c and add extra word. So if first field has "Example", second field will have "Example-Scrap" whenever I create new record.

Here is what I found in other topics but it did not work. I think I have to query somehow fields before operating them.

 

Trigger scrap on PPE_Metrics__c (before update){
  for (PPE_Metrics__c obj: trigger.new){
    Scrap__c = Produced__c+"-Scrap";
  }
}


Hi all! I'm really new to apex code, trying to figure out how to get related records from Account. Any help is appreciated!

VF page:
<apex:page Controller="UseofRepeatOnEpudsController">
<apex:form >
    <apex:pageBlock title="Accounts with assoicated Contacts">
        <apex:repeat value="{!epudsList }" var="epd">
            <apex:pageBlockSection title="{!epd.name} - {!epd.Account1__r.Name}">
                <apex:pageBlockTable value="{!epudsList}" var="epd2">
                    <apex:column value="{!epd2.Absorbent_drum_1__c}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:repeat>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class UseofRepeatOnEpudsController {
    public List<Logistic__c> epudsList{get;set;}
    public List<Account> AccountList{get;set;}
    public Id accId{get;set;}
    
    public UseofRepeatOnEpudsController() {
        accId = ApexPages.CurrentPage().getparameters().get('Id');
        epudsList = new List<Logistic__c>();
        epudsList = [SELECT id, Name ,  Account1__R.Name, Absorbent_drum_1__c From Logistic__c where Account1__c =:accId] ;
        accountList = [SELECT id, Name From Account];
    }

​Result:
I can't select VF page when setting up a button. My guess is that I need to use Standard controller="Account" and extention (My controller). I'm not sure how to set it correctly. Getting errors.

Also, epudsList is showing related custom object names which is fine, but PageBlockTable will show records not per custom object reocord - but all custom object records together.

So basically I'd like to press button on account and get related records separated. Accoont - > List of custom object records -> (Values related to one record)

Now its showing like: Account -> List of custom object records -> (Values related to multiple records) which is wrong.

Thanks for helping me out!
Hi! I have 2 validation rules that kinda similar but different.

First: I have 2 custom checkboxes on "Contact" object, and I'd like to write a validation rule that will check if at least one of the child records have those checkboxes. It can be one out of two for each contact.

I was guessing that rollup summary fields can help me out. I will have a validation where I can't save record if checkbox count can't be less than 1 for this account..
 
AND( 
ISPICKVAL( Type , "Customer"),
Primary_Contact__r.Number_field1__c < 1 || Primary_Contact__r.Number_field2__c < 1
)

Second validation: Account need to have at least 3 related contacts, and these contacts have to have their Contact Roles (Custom Picklist Field). 

Example:
Contact2 -> Picklist_value1
​Contact2 -> Picklist_value2
​Contact3 -> Picklist_value3

I shouldn't be able to save Account record if one of the (Picklist_value) are missing on one of the related contacts. As far as I know, I can't setup roll-up summary to picklist field..

Any help on that approceiated. Thanks!
Hi all!
I have an email template and trying to post First and Last names of contacts related to account that are used in custom object.

Here is code:
<apex:repeat value="{!relatedTo.Account1__r.Account_Manager__r.Contact}" var="con">
     <tr>
<td>{!con.FirstName}</td> 
 </tr>
                 </apex:repeat>

For some reason contacts are not showing. Header is relatedToType="Logistic__c" meaning I'm using custom object fields. Account1__r.Account_Manager__r.Contact I got by creating a new formula field and got API address. 

The next step would be to show only contacts that have on their record checkbox field set to true.

I was thinking to use:
 
<apex:repeat value="{!relatedTo.Account1__r.Account_Manager__r.Contact}" var="con">
            <apex:outputPanel rendered="{!AND(con.Email_Notice__c = True)}" layout="none">
                <tr>
                    <td>{!con.FirstName}</td>
                </tr>
            </apex:outputPanel>
 </apex:repeat>

But non of these codes work.. I am new to it.. please advise. Thank you!
Hi all!

I am trying to create a field on cutom object that will display Account Primary Contact (First Name Last name) on it. On contact page I have dropdown where I select Role for the contact.

I was thinking if that is possible to do with the formula. But not sure how to implement it right.

Here is suggested solution I found http://salesforce.stackexchange.com/questions/97479/formula-field-to-show-primary-contact-name-on-account-object

But the case is that, I want use field values now and not to wait intil they created/edited.

Thank you for helping me out!
Hi all! On the account page layout I have main contact field. Also I've created fields for extra contacts. So is there way to insert 2-3 checkboxes next to the contact fields in Account object? If checkmarked - this contact field(email address) should be used to send particular emails. Is it possible to do it in Salesforce? Any ideas how to implement it? Not sure if I can use standard tools or I need visualforce coding..

Hi all!
I'd like a web-form with a selection, attachment and text to be posted into salesforce. It will be like a contact form where a person can submit info with attachment. Data should flow into my new custom object.

I haven't really found any guides on how to post data from webform to salesforce. All I know is that there are two tools from the box: Web-to-lead, web-to-case. But this is not what I need.

I've also found some paid apps that can do custom webforms that paste data into any object.

For now, I don't look into something fansy, just want one form running.

Any ideas how can I do that? Thanks!

Hello, I have a simple controller that I'd like to test. And the issue is that 'wrapobj.toAdjust' is not getting new value within test class. I'm relatively new to this - please advise. Thank you!

Controller:
public  with Sharing class INV_Audit_tool {
    
    Id whid;
    public list<wrapinv> wrapinvList { get; set; }
    public String WhName { get; set; }
 
    public INV_Audit_tool(){
        whid=ApexPages.CurrentPage().getparameters().get('id'); 
        //system.debug('whid==>'+whid);
        wrapinvList = new list<wrapinv>();
        
        List<Inventory__c> invList= [SELECT Id, WH_Real_Available__c, Product__c,  Product__r.Name, Product__r.Family, Warehouse_Location__c, Warehouse_Location__r.Name
                              FROM Inventory__c 
                              WHERE Warehouse_Location__c=:whid 
                              AND (Product__r.Family != 'COG PPE' AND Product__r.Family != 'COG PPE Scrap') 
                              ORDER BY Product__r.Name ASC];
        
        //system.debug('invList.size()==>'+invList.size());
        for(Inventory__c i : invList){
            
            wrapinvList.add(new wrapinv(i, 0));
            WhName = i.Warehouse_Location__r.Name;
        }
    }
    
    public PageReference save(){
        List <Inventory_Transaction__c > tranToInsert = new List <Inventory_Transaction__c >();
        for(wrapinv wrapobj : wrapinvList){
        system.debug('@@@@@ '+wrapobj);
            if(wrapobj.toAdjust > 0){
                 decimal difference = wrapobj.inv.WH_Real_Available__c - wrapobj.toAdjust;
                 
                 Inventory_Transaction__c tempInvTransObj = new Inventory_Transaction__c();
                 tempInvTransObj.Product__c = wrapobj.inv.Product__c;
                 tempInvTransObj.Warehouse_Location1__c = whid;
                 tempInvTransObj.Quantity__c = wrapobj.toAdjust;
                 tempInvTransObj.Overwrite_Existing_QoH__c  = true;
                 tempInvTransObj.Message__c = 'Audit: Old Quantity ' + wrapobj.inv.WH_Real_Available__c + ' Difference after audit: ' +  difference;
                 tranToInsert.add(tempInvTransObj);  
            }
        }
        try{ 
            if(tranToInsert.size()>0){
                insert tranToInsert;
            }
        }catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,''+e.getMessage()));   
        }
        PageReference redirectPG;
        redirectPG = new PageReference('/'+whid);
        return redirectPG;
    }
    
     public PageReference Cancel(){
        PageReference redirectPG;
        redirectPG = new PageReference('/'+whid);
        return redirectPG;
    } 
    
    public class wrapinv{
        public Inventory__c inv{get;set;}
        public decimal toAdjust{get;set;}
        
        public wrapinv(Inventory__c  i, Decimal adj){
            inv=i;
            toAdjust = adj;
        }
    }
}

Test:
@isTest
private class INV_Audit_tool_test {
    static testMethod void INV_Audit_tool() {
    
    Warehouse_Location__c wh = new Warehouse_Location__c();
    wh.name = 'test';
    insert wh;
    
    product2 prod = new product2();
    prod.Name = 'Test';
    prod.family = 'Absorbents 16Oz';
    insert prod;
    
    Inventory__c inv = new Inventory__c();
    inv.product__c = prod.id;
    inv.Qty_on_Hand__c = 100;
    inv.Qty_allocated__c = 0;
    inv.Warehouse_Location__c = wh.id;
    insert inv;
    
    
       
    test.StartTest();
    
    PageReference pageRef = new PageReference('/apex/INV_Audit_tool');
        pageRef.getParameters().put('id' , wh.id);
        Test.setCurrentPageReference(pageRef);
        INV_Audit_tool audit = new  INV_Audit_tool();

        INV_Audit_tool.wrapinv whObj = new INV_Audit_tool.wrapinv(inv, 5);
      
        audit.save();
        audit.cancel();
       
    test.StopTest();
    
    }
}
Here is test result: wrapobj.ToAdjust is not getting test value of 5. It stays 0.

User-added image
​​​​​​​
Hello there, I'm relatively new to Apex and just wondering how I can get SUM from AgregatedResult per GROUP in a trigger.  We have Products that have different types. I want to know SUM per Type. Currently I do it like this:
 
AggregateResult[] groupedResultsServicesLine = [SELECT QuoteId,SUM(TotalPrice)ExtendedCostSum, SUM(Ext_Price__c)ExtPriceSum, SUM(For_Taxes__c)Taxes
                                                   FROM QuoteLineItem 
                                                   WHERE QuoteId in: QuoteIDs 
                                                   AND Product2.Type__c = 'Services'
                                                   AND Copied_from_Bundle__c = NULL 
                                                   GROUP by QuoteId];

As you see I filter by Product2.Type__c = 'Services' to get specific SUM for this type. Which means I have to do as many queries as we have types. I have a feeling there is a better way of doing that. I could GROUP BY Product2.Type__c but I'm not sure what is the syntax to get this value. Please advise. Thank you!
Hi all! I have following piece of a code that gives me error when I try to deploy:

Variable does not exist: PicklistDescriber

Any ideas?
 
public OpportunityWrapper(String accId, String accName, String oppTitalName, String recordTypeId){
            this.accId = accId;
            this.accName = accName;
            this.oppTitalName = oppTitalName;
            this.recordTypeId = recordTypeId;
            this.lstCurrentUsg = new List<SelectOption>();
            this.lstCurrentPPEType = new List<SelectOption>();
            this.lstCurrentDis = new List<SelectOption>();
            this.lstCompetition = new List<SelectOption>();
            this.lstDisContainer = new List<SelectOption>();

            
            this.oppObj = new Opportunity();
            this.oppObj.recordTypeId = recordTypeId;
            
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Current_Usage__c')) {
                this.lstCurrentUsg.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Current_PPE_Type__c')) {
                this.lstCurrentPPEType.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Disposal_Method__c')) {
                this.lstCurrentDis.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Competition__c')) {
                this.lstCompetition.add(new SelectOption(optName, optName));
            }
            for(String optName : PicklistDescriber.describe('Opportunity', oppTitalName, 'Disposal_Container__c')) {
                this.lstDisContainer.add(new SelectOption(optName, optName));
            }
        }
 

Hi all! Tried to use workflows, but it does not work with lookup fields. So I assume I need to use trigger. I need to take field data from Lookup_Field_1__c to Lookup_Field_2__c and add extra word. So if first field has "Example", second field will have "Example-Scrap" whenever I create new record.

Here is what I found in other topics but it did not work. I think I have to query somehow fields before operating them.

 

Trigger scrap on PPE_Metrics__c (before update){
  for (PPE_Metrics__c obj: trigger.new){
    Scrap__c = Produced__c+"-Scrap";
  }
}


Hi all! I'm really new to apex code, trying to figure out how to get related records from Account. Any help is appreciated!

VF page:
<apex:page Controller="UseofRepeatOnEpudsController">
<apex:form >
    <apex:pageBlock title="Accounts with assoicated Contacts">
        <apex:repeat value="{!epudsList }" var="epd">
            <apex:pageBlockSection title="{!epd.name} - {!epd.Account1__r.Name}">
                <apex:pageBlockTable value="{!epudsList}" var="epd2">
                    <apex:column value="{!epd2.Absorbent_drum_1__c}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:repeat>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class UseofRepeatOnEpudsController {
    public List<Logistic__c> epudsList{get;set;}
    public List<Account> AccountList{get;set;}
    public Id accId{get;set;}
    
    public UseofRepeatOnEpudsController() {
        accId = ApexPages.CurrentPage().getparameters().get('Id');
        epudsList = new List<Logistic__c>();
        epudsList = [SELECT id, Name ,  Account1__R.Name, Absorbent_drum_1__c From Logistic__c where Account1__c =:accId] ;
        accountList = [SELECT id, Name From Account];
    }

​Result:
I can't select VF page when setting up a button. My guess is that I need to use Standard controller="Account" and extention (My controller). I'm not sure how to set it correctly. Getting errors.

Also, epudsList is showing related custom object names which is fine, but PageBlockTable will show records not per custom object reocord - but all custom object records together.

So basically I'd like to press button on account and get related records separated. Accoont - > List of custom object records -> (Values related to one record)

Now its showing like: Account -> List of custom object records -> (Values related to multiple records) which is wrong.

Thanks for helping me out!
Hi! I have 2 validation rules that kinda similar but different.

First: I have 2 custom checkboxes on "Contact" object, and I'd like to write a validation rule that will check if at least one of the child records have those checkboxes. It can be one out of two for each contact.

I was guessing that rollup summary fields can help me out. I will have a validation where I can't save record if checkbox count can't be less than 1 for this account..
 
AND( 
ISPICKVAL( Type , "Customer"),
Primary_Contact__r.Number_field1__c < 1 || Primary_Contact__r.Number_field2__c < 1
)

Second validation: Account need to have at least 3 related contacts, and these contacts have to have their Contact Roles (Custom Picklist Field). 

Example:
Contact2 -> Picklist_value1
​Contact2 -> Picklist_value2
​Contact3 -> Picklist_value3

I shouldn't be able to save Account record if one of the (Picklist_value) are missing on one of the related contacts. As far as I know, I can't setup roll-up summary to picklist field..

Any help on that approceiated. Thanks!
Hi all!
I have an email template and trying to post First and Last names of contacts related to account that are used in custom object.

Here is code:
<apex:repeat value="{!relatedTo.Account1__r.Account_Manager__r.Contact}" var="con">
     <tr>
<td>{!con.FirstName}</td> 
 </tr>
                 </apex:repeat>

For some reason contacts are not showing. Header is relatedToType="Logistic__c" meaning I'm using custom object fields. Account1__r.Account_Manager__r.Contact I got by creating a new formula field and got API address. 

The next step would be to show only contacts that have on their record checkbox field set to true.

I was thinking to use:
 
<apex:repeat value="{!relatedTo.Account1__r.Account_Manager__r.Contact}" var="con">
            <apex:outputPanel rendered="{!AND(con.Email_Notice__c = True)}" layout="none">
                <tr>
                    <td>{!con.FirstName}</td>
                </tr>
            </apex:outputPanel>
 </apex:repeat>

But non of these codes work.. I am new to it.. please advise. Thank you!
Hi all! On the account page layout I have main contact field. Also I've created fields for extra contacts. So is there way to insert 2-3 checkboxes next to the contact fields in Account object? If checkmarked - this contact field(email address) should be used to send particular emails. Is it possible to do it in Salesforce? Any ideas how to implement it? Not sure if I can use standard tools or I need visualforce coding..

Hi all!
I'd like a web-form with a selection, attachment and text to be posted into salesforce. It will be like a contact form where a person can submit info with attachment. Data should flow into my new custom object.

I haven't really found any guides on how to post data from webform to salesforce. All I know is that there are two tools from the box: Web-to-lead, web-to-case. But this is not what I need.

I've also found some paid apps that can do custom webforms that paste data into any object.

For now, I don't look into something fansy, just want one form running.

Any ideas how can I do that? Thanks!