• Noam
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
Hey all,
So im using File Sync to upload an excel file to salesforce in order to use it in other class ive built (the class is reading the csv file and insert the data to salesforce - that one works fine uploading the file manually).
Ive managed to create a trigger that invoke on each document synchronizing\uploading to salesforce.
The problem is - the content document object doesnt have a "Body" \ "ContentData" field.
Ive tried to call a "FeedItem" or a "ContentDocumentFeed" record that holds that data but no record related to the content document record that been triggered is found.

Hope i managed to explain the situation and if anything comes to your mind i will be glad to hear it.

Thanks in advanced,
Noam
  • April 09, 2015
  • Like
  • 0
Hey,

So ive made those nested wrappers which work fine!

public class firstwrapper{
        public contact con {set;get;}
        public list <secondwrapper> second_list {set;get;}
        public firstwrapper(contact con, list <secondwrapper> second_list){
            this.con = con;
            this.second_list = second_list;
        }
    }
public class secondwrapper{
        decimal counter {set;get;}
        integer num {set;get;}
        decimal average {set;get;}
        sObject__c object_name {set;get;}
        public secondwrapper(decimal counter, integer num, decimal averege, sObject__c object_name){
            this.counter  = counter ;
            this.num = num;
            this.average = average;
            this.object_name = object_name;
        }
    }
  So, the code works good.  
    
My problem is how to display them in my vf page.
 Im trying:

<apex:pageBlock title="Title">
         <apex:pageblocktable value="{!firstwrapper}" var="first">
                <apex:column headervalue="Name">
                    <apex:outputtext value="{!first.contact.Name}"/>
                </apex:column>
                <apex:column  headerClass="ct">
                    <apex:facet name="Facet Name">
                    </apex:facet>
                    <apex:pageblocktable value="{!first.second_list}" var="sec">
                        <apex:column headervalue="fieldname">
                            <apex:outputtext value="{!sec.object_name.sobjectfield}"/>
                        </apex:column>
                        <apex:column headervalue="counter" value="{!sec.counter}"/>
                        <apex:column headervalue="num" value="{!sec.num}"/>
                        <apex:column headervalue="average" value="{!sec.average}"/> 
                     </apex:pageblocktable> 
               </apex:column>
        </apex:pageblocktable>
 </apex:pageBlock>  

but cannot even compile. while i save im getting:

"Error: Unknown property '<classname>.secondwrapper.object_name'"

Any suggestions???

Thanks in advanced
  • December 04, 2014
  • Like
  • 0
Hey All,

Im trying to get the MIN and MAX dates from a related child list in soql.
For example if i have an account list with an Opportunity as a child object:

select Id, Name, (select CloseDate from Opportunities) from Account

ive tried this:
select Id, Name, (select Min(CloseDate) from Opportunities) from Account
 
and "​only root queries support aggregate expressions"

ive tried this:

select Id, Name, (select CloseDate from Opportunities order by CloseDate asc limit 1),  
(select CloseDate from Opportunities order by CloseDate desc limit 1) from Account
 
but of courde: "​Cannot follow the same aggregate relationship twice"

so my last try was doing like this: 
select Id, Name, (select CloseDate from Opportunities order by CloseDate asc) from Account

and then on vf page the min date will be:  AccList.Opportunities[0].CloseDate
and the max date will be: AccList.Opportunities[child list size].CloseDate

and there is the problem:  how can i get the child list size??


Any help or other elegant solution will be appreciated!

P.S
replace between the parent-child (meaning (select CloseDate from Opportunities where Id in: (account list))) is not an option!!!
(Although i know it will solve the problem)
  • November 23, 2014
  • Like
  • 0

Hey everyone Im trying to implemente a formula which i know exist in SQL queries.

Lets say i want to give the end user the option to decide which field he wants to search. so in the VF page i have a picklist field in which the user can pick the value he want to search or can leave it empty and then get all the options (meaning no filtering is execute).

 

lets say i have field TYPE in the contact and also this is the field i put in the VF page. In sql it looks like this:

 

SELECT....

FROM contacts

WHERE  contact.TYPE like Iif(VF_TYPE != null, VF_region, "*")

 

No Iif function founded for SOQL couldnt manage with doing it in a simple IF condition as well:

IF(IIF(CONDITION, VALUE IF TRUE, VALUE IF FALSE))  {

 

    commands...

 

}

 

 

Any suggestions?

 

Thx in advanced!

  • November 19, 2013
  • Like
  • 0

Hi,

 

I have a workflow that is triggered by the creation of an object named p_status__c. this object is connected by a lookup to another object p__c.

I want to create an email alert that will be triggered 30 days after the creation of p_status__c only if another checkbox (fieldname is paid) of the p__c object is FALSE.

The point is that only 30 days after the creation of p_status__c the function shoul evaluate the "paid" field.

 

The regular workflow evaluate both conditions on the creation trigger.

A solution anyone?

 

Thank's

  • August 31, 2011
  • Like
  • 0
Hey,

So ive made those nested wrappers which work fine!

public class firstwrapper{
        public contact con {set;get;}
        public list <secondwrapper> second_list {set;get;}
        public firstwrapper(contact con, list <secondwrapper> second_list){
            this.con = con;
            this.second_list = second_list;
        }
    }
public class secondwrapper{
        decimal counter {set;get;}
        integer num {set;get;}
        decimal average {set;get;}
        sObject__c object_name {set;get;}
        public secondwrapper(decimal counter, integer num, decimal averege, sObject__c object_name){
            this.counter  = counter ;
            this.num = num;
            this.average = average;
            this.object_name = object_name;
        }
    }
  So, the code works good.  
    
My problem is how to display them in my vf page.
 Im trying:

<apex:pageBlock title="Title">
         <apex:pageblocktable value="{!firstwrapper}" var="first">
                <apex:column headervalue="Name">
                    <apex:outputtext value="{!first.contact.Name}"/>
                </apex:column>
                <apex:column  headerClass="ct">
                    <apex:facet name="Facet Name">
                    </apex:facet>
                    <apex:pageblocktable value="{!first.second_list}" var="sec">
                        <apex:column headervalue="fieldname">
                            <apex:outputtext value="{!sec.object_name.sobjectfield}"/>
                        </apex:column>
                        <apex:column headervalue="counter" value="{!sec.counter}"/>
                        <apex:column headervalue="num" value="{!sec.num}"/>
                        <apex:column headervalue="average" value="{!sec.average}"/> 
                     </apex:pageblocktable> 
               </apex:column>
        </apex:pageblocktable>
 </apex:pageBlock>  

but cannot even compile. while i save im getting:

"Error: Unknown property '<classname>.secondwrapper.object_name'"

Any suggestions???

Thanks in advanced
  • December 04, 2014
  • Like
  • 0
Hey All,

Im trying to get the MIN and MAX dates from a related child list in soql.
For example if i have an account list with an Opportunity as a child object:

select Id, Name, (select CloseDate from Opportunities) from Account

ive tried this:
select Id, Name, (select Min(CloseDate) from Opportunities) from Account
 
and "​only root queries support aggregate expressions"

ive tried this:

select Id, Name, (select CloseDate from Opportunities order by CloseDate asc limit 1),  
(select CloseDate from Opportunities order by CloseDate desc limit 1) from Account
 
but of courde: "​Cannot follow the same aggregate relationship twice"

so my last try was doing like this: 
select Id, Name, (select CloseDate from Opportunities order by CloseDate asc) from Account

and then on vf page the min date will be:  AccList.Opportunities[0].CloseDate
and the max date will be: AccList.Opportunities[child list size].CloseDate

and there is the problem:  how can i get the child list size??


Any help or other elegant solution will be appreciated!

P.S
replace between the parent-child (meaning (select CloseDate from Opportunities where Id in: (account list))) is not an option!!!
(Although i know it will solve the problem)
  • November 23, 2014
  • Like
  • 0

Hey everyone Im trying to implemente a formula which i know exist in SQL queries.

Lets say i want to give the end user the option to decide which field he wants to search. so in the VF page i have a picklist field in which the user can pick the value he want to search or can leave it empty and then get all the options (meaning no filtering is execute).

 

lets say i have field TYPE in the contact and also this is the field i put in the VF page. In sql it looks like this:

 

SELECT....

FROM contacts

WHERE  contact.TYPE like Iif(VF_TYPE != null, VF_region, "*")

 

No Iif function founded for SOQL couldnt manage with doing it in a simple IF condition as well:

IF(IIF(CONDITION, VALUE IF TRUE, VALUE IF FALSE))  {

 

    commands...

 

}

 

 

Any suggestions?

 

Thx in advanced!

  • November 19, 2013
  • Like
  • 0

Hello

 
I'm using a code I found to insert record to SF via csv file (here is the blog I used the general template: http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html)
 
I've create a custom object so that users will be able to import log records using excel. I've encountered an issue: all the fields that I created are Number data type and in the original file, the data types are String.
I'm getting an error message:  "Error: Compile Error: Illegal assignment from String to Decimal at line 19 column 13"
 
public class FileUploader 
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    List<Log_File__c> logstoupload;
    
    public Pagereference ReadFile()
    {
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        logstoupload = new List<Log_File__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            Log_File__c a = new Log_File__c();
            a.Number_Of_Hosts__c = inputvalues[0];
            a.Number_Of_VMs__c = inputvalues[1];       
            a.Number_Of_Centers__c = inputvalues[2];
             logstoupload.add(a);
        }
        try{
        insert logstoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
    
    public List<Log_File__c> getuploadedAccounts()
    {
        if (logstoupload!= NULL)
            if (logstoupload.size() > 0)
                return logstoupload;
            else
                return null;                    
        else
            return null;
    }            
}
 
 
Can someone can assist in solving this? this tool is something that I need desperately...(users need to upload files and they can't use the starndard import custom object funcionality - a big permission issue)
Also, does anyone knows how to start writing a test class for this?
 
Thanks in Advance!
 
Itay

Hi,

 

I have a workflow that is triggered by the creation of an object named p_status__c. this object is connected by a lookup to another object p__c.

I want to create an email alert that will be triggered 30 days after the creation of p_status__c only if another checkbox (fieldname is paid) of the p__c object is FALSE.

The point is that only 30 days after the creation of p_status__c the function shoul evaluate the "paid" field.

 

The regular workflow evaluate both conditions on the creation trigger.

A solution anyone?

 

Thank's

  • August 31, 2011
  • Like
  • 0